
/*
all these functions are used in various sections of the site (yp, shopping, etc.)
functions in this file: (please update if you change something)
yOffset(o)
isClickOnAnchor(e)
popupHelp(anchor, idealHeight)
verifySE(C)
showform(nr)
hideform(nr)
overlay(nr)
hideoverlay(nr)
*/
/* Since OffsetTop represent the top coordinates of the element's content relative to the containing element,
we need to find out the position relative to the page by recursively finding the containing element's parent
*/
function yOffset(o) {
var ycoord;
ycoord = o.offsetTop;
if (o.offsetParent != null)
ycoord += yOffset(o.offsetParent);
return ycoord;
}
function isClickOnAnchor(e) {
var targ;
if (!e) var e = window.event;
if (e.target)
targ = e.target;
else if (e.srcElement)
targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
return(targ.href != null);
}
function popupHelp(anchor, idealHeight) {
var margin = 80; // a margin for window positioning which acount for menus, etc.
var width = 500;
var left = (screen.width - width) / 2; // left position = (WidthOfScreen - WidthOfthePopup) / 2
var height = idealHeight;
if(screen.height <= height) {
height = screen.height - margin;
}
var top = (screen.height - height) / 2 - margin/2;
if(top < 0) top = 0;
var windowprops = "toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,"+
"top="+top+",left="+left+",width="+width+",height="+height;
self.name = "main"; // names current window as "main"
OpenWindow = window.open(anchor.href, anchor.target, windowprops); // opens remote control
if (OpenWindow.open) {
OpenWindow.focus();
return true;
}
}
function verifySE(C) {
C.value = C.value.replace(/^\s*|\s*$/g,"");
if (C.value == "") {
alert("Please enter a Keyword");
C.focus();
return false;
}
}
function showform(nr) {
if (document.layers) {
if (document.layers[nr] != null)
document.layers[nr].display = 'block';
} else if (document.all) {
if (document.all[nr] != null)
document.all[nr].style.display = 'block';
} else if (document.getElementById) {
if (document.getElementById(nr) != null)
document.getElementById(nr).style.display = 'block';
}
}
function hideform(nr) {
if (document.layers) {
if (document.layers[nr] != null)
document.layers[nr].display = 'none';
} else if (document.all) {
if (document.all[nr] != null)
document.all[nr].style.display = 'none';
} else if (document.getElementById) {
if (document.getElementById(nr) != null)
document.getElementById(nr).style.display = 'none';
}
}
function overlay(nr) {
if (document.all) {
if (document.ypform && document.ypform.S && yOffset(document.all[nr]) < yOffset(document.ypform.S) && yOffset(document.all[nr]) + document.all[nr].offsetHeight >= yOffset(document.ypform.S))
document.ypform.S.style.visibility = 'hidden';
if (document.searchform) {
if (document.searchform.s && yOffset(document.all[nr]) < yOffset(document.searchform.s) && yOffset(document.all[nr]) + document.all[nr].offsetHeight >= yOffset(document.searchform.s))
document.searchform.s.style.visibility = 'hidden';
else if (document.searchform.state && yOffset(document.all[nr]) < yOffset(document.searchform.state) && yOffset(document.all[nr]) + document.all[nr].offsetHeight >= yOffset(document.searchform.state))
document.searchform.state.style.visibility = 'hidden';
}
}
if (document.layers) {
if (document.layers[nr] != null)
document.layers[nr].visibility = 'visible';
} else if (document.all) {
if (document.all[nr] != null)
document.all[nr].style.visibility = 'visible';
} else if (document.getElementById) {
if (document.getElementById(nr) != null)
document.getElementById(nr).style.visibility = 'visible';
}
}
function hideoverlay(nr) {
if (document.all) {
if (document.ypform && document.ypform.S)
document.ypform.S.style.visibility = 'visible';
if (document.searchform) {
if (document.searchform.s)
document.searchform.s.style.visibility = 'visible';
else if (document.searchform.state)
document.searchform.state.style.visibility = 'visible';
}
}
if (document.layers) {
if (document.layers[nr] != null)
document.layers[nr].visibility = 'hidden';
} else if (document.all) {
if (document.all[nr] != null)
document.all[nr].style.visibility = 'hidden';
} else if (document.getElementById) {
if (document.getElementById(nr) != null)
document.getElementById(nr).style.visibility = 'hidden';
}
}
