/* -------------------------------------------------------------------------------------------------------------- */
// SiteSwitch function is used for going between different domains and maintaining the users cart
function SiteSwitch(value) {
	if ('www.valleynaturals.com' == value.substr(7,22) || 'vn.' == value.substr(7,15)) { document.SiteSwitch.action = value; }
	document.SiteSwitch.submit();
}
/* -------------------------------------------------------------------------------------------------------------- */
// Function to open a new window
function NewWin(page, name, width, height) {
OpenWin = this.open(page, name, 'toolbar=no,menubar=no,location=no,scrollbars=yes,width='+width+',height='+height+',resizable=yes,status=no');
OpenWin.focus();
} 
/* -------------------------------------------------------------------------------------------------------------- */
// 7/3/03 nh - added bookmark/favicon scripts
function bookmarkNav() {
	// IE 4+ check
	if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) { document.write('<div align="center"><a href="javascript:addbookmark()"><img src="/images/btn_favorites_nav.gif" height="25" width="105" border="0"></a></div><br>'); }
}
function addbookmark() { window.external.AddFavorite('http://www.valleyvet.com', document.title); }
/* -------------------------------------------------------------------------------------------------------------- */
// Tooltip JS by texSoft.it
function tooltipBox_show(tooltipId, parentId, posX, posY) 
{
    it = document.getElementById(tooltipId);
    
    if ((it.style.top == '' || it.style.top == 0) 
        && (it.style.left == '' || it.style.left == 0))
    {
        // fix default size (MSIE problem)
        it.style.width = '204px';  //it.style.width = it.offsetWidth + 'px';
        it.style.height = it.offsetHeight + 'px';
        
        obj = document.getElementById(parentId); 
    
        // if tooltip is too wide, shift left to be within parent
        //if (posX + it.offsetWidth > obj.offsetWidth) posX = obj.offsetWidth - it.offsetWidth;
        //if (posX < 0 ) posX = 0; 
        
		var curleft = 0;
		var curtop = 0;
		if (obj.offsetParent) {
			while (obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.x) {
			curleft += obj.x;
			curtop += obj.y;
		}
        x = curleft + posX;
        y = curtop + posY;
        
        it.style.top = y + 'px';
        it.style.left = x + 'px';
    }
    it.style.visibility = 'visible'; 
}
function tooltipBox_hide(id)
{
    it = document.getElementById(id); 
    it.style.visibility = 'hidden'; 
}
