function movetotop()
{
	if (navigator.userAgent.toLowerCase().indexOf( 'win' ) + 1) 
	{
		var csLoc = new String(window.parent.document.location);

		if (csLoc.toLowerCase().indexOf('#_top') == -1)
		{
			window.parent.document.location.replace(csLoc + '#_top');
		}
		else
		{
			window.parent.document.location.replace(csLoc);
		}
	}
}

function customizeheader()
{
	var strURL = document.location.toString().toLowerCase();
	
	if (strURL.indexOf("search") != -1)
		document.getElementById("imgProductSearch").src = document.getElementById("imgProductSearch").src.replace("off", "on");
	if (strURL.indexOf("login") != -1)
		document.getElementById("imgLogin").src = document.getElementById("imgLogin").src.replace("off", "on");
		
	if (strURL.indexOf("aboutus") != -1)
		document.getElementById("imgAboutUs").src = document.getElementById("imgAboutUs").src.replace("off", "on");
	if (strURL.indexOf("newsroom") != -1)
		document.getElementById("imgNewsroom").src = document.getElementById("imgNewsroom").src.replace("off", "on");
	if (strURL.indexOf("faqs") != -1)
		document.getElementById("imgFAQ").src = document.getElementById("imgFAQ").src.replace("off", "on");

	if (strURL.indexOf("contact_us") != -1)
		document.getElementById("imgContactUs").src = document.getElementById("imgContactUs").src.replace("off", "on");
	if (strURL.indexOf("designertips") != -1)
		document.getElementById("imgDesignerTips").src = document.getElementById("imgDesignerTips").src.replace("off", "on");
	if (strURL.indexOf("designers") != -1)
		document.getElementById("imgDesigners").src = document.getElementById("imgDesigners").src.replace("off", "on");
	if (strURL.indexOf("blog") != -1)
		document.getElementById("imgBlog").src = document.getElementById("imgBlog").src.replace("off", "on");
	if (strURL.indexOf("sitemap") != -1)
		document.getElementById("imgSiteMap").src = document.getElementById("imgSiteMap").src.replace("off", "on");
	if (strURL.indexOf("policies") != -1)
		document.getElementById("imgPolicies").src = document.getElementById("imgPolicies").src.replace("off", "on");


}

	function PopUpFileNotFound(){

		alert("Sorry, there is no file to download at the moment.");

		return false;

	}

	function PopUpNoImage(){

		alert("Sorry, there is no image to view or download at the moment.");

		return false;

	}
	
function CheckQuantityOnHand(quantity, quantity_on_hand)
			{
					var intquantityValue = parseInt(quantity);
					var intquantity_on_handValue = parseInt(quantity_on_hand);

					if (!isNaN(intquantityValue) && !isNaN(intquantity_on_handValue))
					{
						if 	(intquantityValue > intquantity_on_handValue)
						{
							alert("The quantity " + intquantityValue + " that you just entered is larger than the inventory " + intquantity_on_handValue + ". Please contact Uttermost about it.");
						}
					}
			}

function PrintPageWithoutButton()
{
	document.getElementById("lblprint").style.visibility = "hidden"; 
	document.getElementById("tdButtons").style.visibility = "hidden"; 
	
	window.print();
	
	document.getElementById("lblprint").style.visibility = "visible";
	document.getElementById("tdButtons").style.visibility = "visible";
}

function EmailPage()
{
	
	var strURL=window.location;
	//alert('strURL');
	//window.open('EmailProductDetail.aspx?PageURL=' + strURL, '', 'width=650,height=650')
	//window.open('EmailPage.aspx?strSubject=xxx&PageURL=' + strURL, '', 'width=650,height=650')
	//window.open('EmailPage.aspx?strIntro=The following is the URL of a page from www.uttermost.com that I would like to invite you to review:&strSubject=xxx&PageURL=' + strURL, '', 'width=650,height=650')
	window.open('EmailPage.aspx?Type=NormalPage&PageURL=' + strURL, '', 'width=650,height=650')
	
}

function ToStoreLocator()
{
	var zip = document.getElementById("txtStoreZip").value;
						
	var intValue = parseInt(zip);
	if (!isNaN(intValue))
		window.location.replace("store_locator_Results.aspx?zip=" + zip + "&Miles=25");
	else
		window.location.replace("store_locator.aspx");
}

function ToSearchResult()
{
	var SearchEntry = document.getElementById("txtQuickSearch").value;

	if (SearchEntry != "")
		window.location.replace("search_results.aspx?Type=QuickSearch&Entry=" + SearchEntry);
	else
		window.location.replace("search_results.aspx?Type=QuickSearch&Entry=");
}
					
						  
function cleartext(inputBox){
	if (inputBox.defaultValue==inputBox.value)
	inputBox.value = ""
} 

function ChangeFrameClient(OID)
{
	//alert(OID);
	if (OID == -1)
	{
		document.getElementById('imgtop_left').src = "images/spacer.gif";
		document.getElementById('imgtop_right').src = "images/spacer.gif";
		document.getElementById('imgbottom_left').src = "images/spacer.gif";
		document.getElementById('imgbottom_right').src = "images/spacer.gif";
		
		cellBckImg('tdtop', "images/spacer.gif");
		cellBckImg('tdbottom', "images/spacer.gif");
		cellBckImg('tdleft', "images/spacer.gif");
		cellBckImg('tdright', "images/spacer.gif");
	}
	else
	{
		document.getElementById('imgtop_left').src = "images/frames/" + OID + "_top_left.jpg";
		document.getElementById('imgtop_right').src = "images/frames/" + OID + "_top_right.jpg";
		document.getElementById('imgbottom_left').src = "images/frames/" + OID + "_bottom_left.jpg";
		document.getElementById('imgbottom_right').src = "images/frames/" + OID + "_bottom_right.jpg";
				
		cellBckImg('tdtop', "images/frames/" + OID + "_top.jpg");
		cellBckImg('tdbottom', "images/frames/" + OID + "_bottom.jpg");
		cellBckImg('tdleft', "images/frames/" + OID + "_left.jpg");
		cellBckImg('tdright', "images/frames/" + OID + "_right.jpg");
	}
}
			
function cellBckImg(idcell, imgName) 
{ 
	//alert(imgName);
	document.getElementById(idcell).style.background = "url(" + imgName + ")"; 
} 
		


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
    }
  }
}

function mm_swapimgrestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function mm_preloadimages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=mm_preloadimages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
    }
  }
}

function mm_swapimage() { //v3.0
  var i,j=0,x,a=mm_swapimage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=mm_findobj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
  }
}

function mm_findobj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findobj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}



function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
  }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function CAS_preloadImages() {
	MM_preloadImages('images/nav/logo_on.gif','images/nav/product_on.gif','images/nav/search_on.gif',
						  'images/nav/yourrep_on.gif','images/nav/login_on.gif','images/nav/faq_on.gif',
						  'images/nav/contact_on.gif')
}