// JavaScript Document
$(document).ready(function(){
			$('body').append('<div class="" id="addtocartloader"></div>');
            $('#generate').click(function(){
				var sn = $('[name=sn-account]').val();
				var na = $('[name=na-account]').val();
				var id = $('[name=id-account]').val();
								
                sendValue(sn,id,na);                 
            });
           
        });
        function sendValue(sn,id,na){
            $.post("jos-addons/save-sn-clt-log/script.php",{ sn: sn, na: na, id: id },
            function(data){
                $('#save-sn-form span').html(data.returnValue);
            }, "json");
			
			$('#sn1').html('<p>Your saved serial number is '+sn+'</p><p>Use <a href="spa-serial-number-search.php?sn='+sn+'" id="">Customized Parts List for that Serial Number >>></a></p>');
			$('#sn2').html('<a href="spa-serial-number-search.php?sn='+sn+'">'+sn+'<span id="sn2over">Customize Parts List for your Spa</span></a>');
        }
/*$(document).ready(function(){
   $("#generate").click(function(){
	 var v = $('#sn-account').val(); 
	 var id = $('#id-account').val(); 
	 var na = $('#na-account').val(); 
	 sendValue($(this).val());
     $("#save-sn-form span").load('jos-addons/save-sn-clt-log/script.php?sn='+v);
	 
		 $.post(
		   
		"jos-addons/save-sn-clt-log/script.php", //Ajax file
	   
		{ sendValue: v },  // create an object will all values
	   
		//function that is called when server returns a value.
		function(data){
			$('#save-sn-form span').html(data.returnValue);
		},
	   
		//How you want the data formated when it is returned from the server.
		""
		);
	
	
   });
 }); */
 /*$(document).ready(function(){
   $("#generate").click(function(){
	 var v = $('#sn-account').val(); 
     $("#sn-account").html('<a href="spa-serial-number.php?sn'+v+'">'+v);
   });
 });*/
// categories


$(document).ready(function(){
	$(".example5").colorbox();
	$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
	$(".example45").colorbox({width:"600px", height:"80%", inline:true });			
});	
function toUrl(file){
	window.open(file,target='_self');
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



$(document).ready(function(){	
	$('.cat_menu ul li ul').hide();		
	$('.cat-link').click(function() {
		$(this).next('.cat_menu ul li ul').toggle('fast');
		return false;
	});
	
	$('#search-form :submit, #orderstatus :submit, #tracking-form :button, .serialform :submit, .inputform :submit,.inputform :button').css({"background": "url(template/images/gree-bg.png)", "color":"#fff","font-weight":"bold","cursor":"pointer" });
	
});

//position:relative;
//	left: 0px;
// search field -------------------------------------------------------------------


$(document).ready(function() {
	$('.searchbox').click(
		function() {
			if (this.value == this.defaultValue) {
				this.value = '';
				$(this).css("color", "#000"  );
				$(this).css("font-size", "14px"  );
				$(this).css("font-weight", "bold"  );
				$(this).css("font-style", "normal"  );
			}
		}
		);
		$('.searchbox').blur(
		function() {
			if (this.value == '') {
				this.value = this.defaultValue;
				$(this).css("color", "#666"  );
				$(this).css("font-size", "14px"  );
				$(this).css("font-weight", "normal"  );
				$(this).css("font-style", "italic"  );
			}
		}
	);
});
// --------------------------------------------------------------------------------

// show hide table in category pages ---------------------------------------------- 
$(document).ready(function(){
	//for table row
	$("#cat-table-expand-link2").hide();						  
	$("#cat-table-find").hide();
	/*$(".cat-table-find tr:even").css("background-color", "#ffffff");*/
	$(".cat-table-find tr:odd").css("background-color", "#eeeeee");
	$('#hideh1').click(function(){
		$('div.showhide,h1').hide();
	});
	$('#showh1').click(function(){
		$('div.showhide,h1').show();
	});
	$('.cat-table-expand-link').click(function(){
		$('#cat-table-find').slideToggle('slow');
		$('#cat-table-expand-link2').toggle();
		$('#cat-table-expand-link').toggle();
	});
});
//-----------------------------------------------------------------------------------

// show hide tip perts fider --------------------------------------------------------
$(document).ready(function(){
	var thelink = $('.find-with-parts-finder').html();
	$('.find-with-parts-finder').mouseenter(function(){
		//var thelink = $('.find-with-parts-finder').html();
		var thetip = '<span class="parttip">Try our new Parts Finder Tool to be certain of the correct replacement part(s) for your spa model. Simply enter your spa\'s serial number to quickly find the exact parts match. It\'s easy!</span>';
		$('.find-with-parts-finder').html(thelink+thetip);
		$('.parttip').show('slow');
	});
	$('.find-with-parts-finder').mouseleave(function(){
		var thetip = '';
		$('.parttip').hide('slow',function(){
			$('.find-with-parts-finder').html(thelink);	
		});
	});
});
//-----------------------------------------------------------------------------------

// popup window  --------------------------------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-----------------------------------------------------------------------------------


function na(){ } //empty function for <a href="


function showAnyDiv(div,status){ // status = show or hide
	
	if (status=='show'){
		document.getElementById(div).style.display = "block" ;
	}
	if (status=='hide'){
		document.getElementById(div).style.display = "none" ;	
	}
	
}
function expandDiv(div,status){ // status = show or hide
	
	if (status=='show'){
		document.getElementById(div).style.left = "0" ;
		document.getElementById(div).style.position = "relative" ;
	}
	if (status=='hide'){
		document.getElementById(div).style.display = "none" ;	
	}
	
}

function showIframe(div,status){ // status = show or hide
	
	if (status=='show'){
		document.getElementById(div).style.display = "block" ;
	}
	if (status=='hide'){
		document.getElementById(div).style.display = "none" ;	
	}
	
}
	
// Zone warning for products outside the USA
    /* getElementByClass
    /**********************/

    var allHTMLTags = new Array();

    function getElementByClasstest(theClass) 
		{
        //Create Array of All HTML Tags
		var allHTMLTags=document.getElementsByTagName('span');

		//Loop through all tags using a for loop
		for (i=0; i<allHTMLTags.length; i++) 
			{

			//Get all tags with the specified class name.
			if (allHTMLTags[i].className==theClass) 
				{

			//Place any code you want to apply to all
			//pages with the class specified.
			//In this example is to “display:none;” them
			//Making them all dissapear on the page.

    			allHTMLTags[i].style.display='block';

   				}
    		}
   	 	}
//determine language and location
function start(){
						// IE default language for the browser
						if (navigator.browserLanguage){language=navigator.browserLanguage} 					
						// IE browser language set by the user
						if (navigator.userLanguage){language=navigator.userLanguage} 					
						// IE operating system language
						if (navigator.systemLanguage){language=navigator.systemLanguage}					
						// Netscape language sniff
						if (navigator.language){language=navigator.language}
						if (language=='en-us' || language=='en-US') {
							
							}
						else { 
							getElementByClasstest('warning');
						}						
					} //end languageFunc()
					
			
window.onload = start;						


					
//--minicart
function showimg(x,y){
var divName = 'mydiv'; // div that is to follow the mouse
                       // (must be position:absolute)
var offX = x;          // X offset from mouse position
var offY = y;          // Y offset from mouse position

function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}

function follow(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; obj.visibility = 'visible';
obj.left = (parseInt(mouseX(evt))+offX) + 'px';
obj.top = (parseInt(mouseY(evt))+offY) + 'px';}}
document.onmousemove = follow;
}
function viewimg(img,x,y){
showimg(x,y);	
document.getElementById('mydiv').innerHTML = '<div id="mydiv2"><img src="'+img+'" /></div>';
}                    
function hiddeimg(){
document.getElementById('mydiv').innerHTML = '';
}	
// ----------------ADS----------------------------------------------------------------------------
if (document.all || document.getElementById){ //if IE4 or NS6+
 document.write('<style type="text/css">\n');
 document.write('.dyncontent{display: none; width: 150px; height: 250px;}\n');
 document.write('</style>');
}

var curcontentindex=0;
var messages=new Array();

function getElementByClass(classname){
 var inc=0;
 var alltags=document.all? document.all : document.getElementsByTagName("*");
 for (i=0; i<alltags.length; i++){
   if (alltags[i].className==classname)
     messages[inc++]=alltags[i];
 }
}

function rotatecontent(){
 //get current message index (to show it):
 curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0;
 //get previous message index (to hide it):
 prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1;
 messages[prevcontentindex].style.display="none"; //hide previous message
 messages[curcontentindex].style.display="block"; //show current message
}


// ----------------------------END ADS --------------------------------------------------------------
// -------review module and page --------------------------
function more(id,state,id2,state2){
hidden = document.getElementById(id);
hidden.style.display = state; 
if (id2){
hidden2 = document.getElementById(id2);
hidden2.style.display = state2;
}
}

function showact(id,elem,state){
hidden = document.getElementById(id);
hidden.style.elem = state; 
}


<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  return false;
}
function show(id,id2) { 
		idname = id;
		id2name = id2;
		elem = document.getElementById(idname);
 elem.style.display = "block" ;
 elem.style.cursor = "pointer";
 elem2 = document.getElementById(id2name);
 elem2.style.display = "none" ;
 elem2.style.cursor = "pointer";
	}
    function hide(idh){
	idhname = idh
	elem = document.getElementById(idhname);
 elem.style.display = "none" ;
	}   
 
//-->

<!--

function OpenFullWindow(inURL,inTitle,inParams) {
	window.open(inURL,inTitle,inParams);
}
//-->
$(document).ready(function(){
	$(".genericlink").hover( function() { 
		$(this).addClass("ieoemgenhover"); 
	}, 
	function() { 
		$(this).removeClass("ieoemgenhover"); 
	} ); 
});
  
     

function openIframe(w,h) {
	$(".iframe").colorbox({width:w, height:h, iframe:true});	
	
	
}

// alter table look in pro descriptions
$(document).ready(function(){
	$(".detaildescriptionfull table").attr("cellspacing","0"); 
	$(".detaildescriptionfull table").attr("border","0"); 
	$(".detaildescriptionfull table").css("margin","20px"); 
	$(".detaildescriptionfull table").css("border","1px solid #ccc"); 
	$(".detaildescriptionfull table").css("background","#eee");
	$(".detaildescriptionfull table").css("width","auto"); 
	$(".detaildescriptionfull table td").css("border","1px solid #ccc"); 
	$(".detaildescriptionfull table td").css("padding","5px");
	$(".detailprice").parent().next().css("border-right","1px solid #ccc");
	$(".detailprice").parent().next().css("border-bottom","1px solid #ccc");
	$(".detailprice").parent().next().css("border-top","1px solid #ccc");
	$(".detailprice").parent().prev().css("border-left","1px solid #ccc");
	$(".detailprice").parent().prev().css("border-bottom","1px solid #ccc");
	$(".detailprice").parent().prev().css("border-top","1px solid #ccc");
	$(".detailprice").parent().css("border-bottom","1px solid #ccc");
	$(".detailprice").parent().css("border-top","1px solid #ccc");
	$(".detailprice").parent().next().css("border-right","1px solid #ccc");
	
	$(".detailprice").parent().next().css("padding","5px");
	$(".detailprice").parent().css("padding","5px");
	$(".detailprice").parent().prev().css("padding","5px");
	/* prooption table layout  */
	$('table.prodoptions tr:nth-child(odd)').css("background","#eee");
	$('table.prodoptions tr:nth-child(even)').css("background","#fff");
	
});


