// SIMPLE IMAGE ROLLVERS
// call using: onmouseover="hoverImage(this);" onmouseout="resetImage(this);"
// note: make sure images are in the same folder with similar names like: home_off.gif, home_on.gif
// note: make sure images don't have the words 'off' or 'on' in them (like online.gif or offer.gif or even worse online_offer.gif)

function openPrintable() 
{
	alert('commom');
	popup = window.open("printable.htm", "popup", "width=800,height=600,scrollbars=yes,menubar=yes");
} 

function openPrintableRec() 
{
	popup = window.open("printable_rec.htm", "popup", "width=800,height=600,scrollbars=yes,menubar=yes");
} 

function openPrintableAut() 
{
	popup = window.open("printable_aut.htm", "popup", "width=800,height=600,scrollbars=yes,menubar=yes");
} 

function hoverImage(image){
	image.src = image.src.replace(/_off/, "_on");
}

function resetImage(image){
	image.src = image.src.replace(/_on/, "_off");
}

function setValue(ddl, div) {
	document.getElementById(div).innerHTML = ddl.selectedIndex-1;	
}

// Button Rollovers

function goLite(FRM,BTN)
{
   window.document.forms[FRM].elements[BTN].style.color = "#a1c27e";
   window.document.forms[FRM].elements[BTN].style.borderColor = "#a1c27e";
}

function goDim(FRM,BTN)
{
   window.document.forms[FRM].elements[BTN].style.color = "#ffffff";
   window.document.forms[FRM].elements[BTN].style.borderColor = "#d6d6d6";
}

// NAV ROLLOVERS
	function r_closelast(){
		document.lastM.style.visibility='hidden' ;
		document.lastMB.style.visibility='hidden' ;
		document.lastMH.style.visibility='hidden' ;}
		
	function r_openmenu(name){
		if(document.lastM){
			if(document.lastM!=document.getElementById(name)) document.getElementById(name+"Highlight").style.top=0 ;
			r_closelast() ;}
		menu=document.getElementById(name) ;
		menu.style.visibility='visible' ;
		var divs=menu.childNodes ;
		var icntr=0 ;
		for(i=0;i<divs.length;i++){
			if(divs[i].className=="menuI"){
				divs[i].style.top = icntr*24 ;
				icntr++ ;}}
		menu.style.height=icntr*24 ;
		document.getElementById(name+"Back").style.visibility='visible' ;
		document.getElementById(name+"Highlight").style.visibility='visible' ;
		document.lastM=menu ;
		document.lastMB=document.getElementById(name+"Back") ;
		document.lastMH=document.getElementById(name+"Highlight") ;}
		
	function r_menuitem(index){
		document.lastM.style.visibility='visible' ;
		document.lastMB.style.visibility='visible' ;
		var divs=document.lastM.childNodes ;
		var icntr=0 ;
		for(i=0;i<divs.length;i++){
			if(divs[i].className=="menuI"){
				icntr++ ;
				if(index==icntr){
					//Found clicked item...
					document.lastMH.style.top=parseInt(divs[i].style.top) ;}}}}
					
	// function r_highlight(name, updown)
		// {document.getElementById(name).src="images/top-"+updown+".gif" ;}
		
	function r_highlight(name, updown){
		if (updown == "up") document.getElementById(name).src=document.getElementById(name).src.replace("down","up");
		else document.getElementById(name).src=document.getElementById(name).src.replace("up","down");}

function open_window(url)
		{			
		var logpage = '';
		eval("logpage = window.open(url, 'Display1', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0, width=658, height=410, left=300,top=200');");	  
		}
function open_window2(url)
		{			
		var logpage = '';
		eval("logpage = window.open(url, 'Display1', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0, width=658, height=410, left=300,top=200');");	  
		}
		
		
		
	function clickButton(btn) {
		if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
			document.getElementById(btn).click();
			return false;
		} 
    	else return true;
	}

	function viewPhoto(id, width, height, title)
   {
      if (id != "0") {
      view = window.open("viewer.htm?id="+id, id, "width="+width+",height="+height+",scrollbars=no,toolbar=no,status=no,resizable=no,menubar=no,location=no");
      view.focus();
      }
   }
 
function showPhoto(obj_photo,id,width,height,text) {
	while(obj_photo.indexOf(":") > -1) {
		obj_photo = obj_photo.replace(':','_');
	}
	document.getElementById(obj_photo).src = "../photos/"+id+"_310_0.jpg";
	document.getElementById(obj_photo).alt = text;
	document.getElementById(obj_photo).parentNode.href = "javascript:viewPhoto(" + id + "," + width + "," + height + ",'" + text + "');";
}

function showRelatedPhoto(obj_photo,id,width,height,text) {
	while(obj_photo.indexOf(":") > -1) {
		obj_photo = obj_photo.replace(':','_');
	}
	document.getElementById(obj_photo).src = "../photos/"+id+"_138_0.jpg";
	document.getElementById(obj_photo).alt = text;
	document.getElementById(obj_photo).parentNode.href = "javascript:viewPhoto(" + id + "," + width + "," + height + ",'" + text + "');";
}

   function setCost() {		
	var id = setCost.arguments[1].replace(":", "_").replace(":", "_").replace(":", "_");
		document.getElementById(id).innerHTML =  setCost.arguments[setCost.arguments[0].selectedIndex + 2];
		   
   }
   
   function jumpGroup(obj) {
	 document.location.href = "catalog.aspx?group="+obj.options[obj.selectedIndex].value;
   }




function showPreOrder() {
	alert('This item is a pre-order. Items offered for pre-order are in high demand, but by reserving yours you are guaranteed to be the first to own it. Your credit card will not be charged until it ships. The delivery date for pre-orders varies and is only an estimate. Please check the item\'s description for more information.');
}



function showSwatchTitle(title, space) {
	if (title == "") {
		document.getElementById("swatch_title").innerHTML = "&nbsp;";
	}
	else {
		space = 44 * space;
		image = "<img src='../images/blank.gif' height='2' width='"+space+"'>";
		document.getElementById("swatch_title").innerHTML = "&nbsp;"+image+"<span class='alert'>"+title+"</span>";
	}
}

function showPhotoTitle(title) {
	if (title == "") {
		document.getElementById("photo_title").innerHTML = "&nbsp;";
	}
	else {
		document.getElementById("photo_title").innerHTML = "&nbsp;<span class='alert'>"+title+"</span>";
	}
}
function emailPageLink() {
	urlAddress = window.location.href;
	pageName = document.title;
	
	//efpopup = window.open("http:///common/pk_emailfriend.php?url="+urlAddress+"&title="+pageName, "efpopup", "width=400,height=300,scrollbars=no,menubar=no");
}




   function openWindow(url,win)
   {
      view = window.open(url, "", win);
      view.focus();
   }
   
   function hov(loc,cls)
{
   if(loc.className)
      loc.className=cls;
}
