// JavaScript Document
<!--
function setPic(myID)
{
	$.post('include/get_productGallery.inc.php', { id: myID },
			  function(data){
				$("#PHOTO").attr("src", "images/DB/"+data.pic);
				$("#PhotoComment").html(data.cap);
		  }, "json");
	return false;
}

function switchPic (pic, cap, myVar)
{
	$("#dlp"+myVar).attr("src", "images/DB/"+pic);
	$("#dlpt"+myVar).html(cap);
	return false;
}

function sectionClick (myVar)
{
	//	set #breadCrumb;
	$.post('include/get_breadcrumb.inc.php', { id: myVar },
			  function(data){
				$('#breadCrumb').html(data);
		  });
	
	// set #Cats
	$.post('include/get_category.inc.php', { id: myVar },
			  function(data){
				$('#Cats').html(data);
		  });

	$('#ProductLoad').hide(); 
	$('#ProductGrid').show(); 
	
	$('#Brands').html('');
	$('#CatSub').html('');
	return false;
}

function categoryClick (myVar)
{
	$("td[id^='Pcat']").css('background-color','');
	$("#Pcat"+myVar).css('background-color','#7CBE49');
	$("img[id^='IPcat']").attr("src", "images/greyarrow.gif");
	$("#IPcat"+myVar).attr("src", "images/spacer.gif");
//	set #breadCrumb;
	$.post('include/get_breadcrumb.inc.php', { sid: myVar },
			  function(data){
				$('#breadCrumb').html(data);
		  });
// set #CatSub
	$.post('include/get_category_sub.inc.php', { id: myVar },
			  function(data){
				$('#CatSub').html(data);
		  });
	$('#Brands').html('');  
	return false;
}

function subCategoryClick (myVar)
{
	$("td[id^='Pcatsub']").css('background-color','');
	$("#Pcatsub"+myVar).css('background-color','#7CBE49');
	
	$("img[id^='IPcatsub']").attr("src", "images/greyarrow.gif");
	$("#IPcatsub"+myVar).attr("src", "images/spacer.gif");
//	set #breadCrumb;
	$.post('include/get_breadcrumb.inc.php', { pid: myVar },
			  function(data){
				$('#breadCrumb').html(data);
		  });

// set #Brands
	$.post('include/get_brand.inc.php', { id: myVar },
			  function(data){
				$('#Brands').html(data);
		  });
	
		  
	return false;
}

function loadAll (sect, cat, prod)
{
	$('#ProductLoad').hide(); 
	$('#ProductGrid').show();
	
	$.post('include/get_breadcrumb.inc.php', { pid: prod },
			  function(data){
				$('#breadCrumb').html(data);
		  });


	$.post('include/get_brand.inc.php', { id: prod },
			  function(data){
				$('#Brands').html(data);
		  });
	$.post('include/get_category_sub.inc.php', { id: cat, sel: prod},
			  function(data){
				$('#CatSub').html(data);
		  });
	$.post('include/get_category.inc.php', { id: sect, sel: cat },
			  function(data){
				$('#Cats').html(data);
		  });
		  
	return false;
}

function submitSection(){
		if ($('#name').val() == '') {
			alert ("Please enter your name.");
			$('#name').focus();
			return false;
		}
		
		if ($('#email').val() == '') {
			alert ("Please enter your email.");
			$('#email').focus();
			return false;
		}
		
		if ($('#phone').val() == '') {
			alert ("Please enter your phone number.");
			$('#phone').focus();
			return false;
		}

		if ($('#question').val() == '') {
			alert ("Please enter your question.");
			$('#question').focus();
			return false;
		}
	
		var options = { 
			target:        '#Question'
		}; 

    // submit the form 
     $('#QFRM').ajaxSubmit(options); 
	return false;

}

function submitLocatorRequest(){
		if ($('#LRname').val() == '') {
			alert ("Please enter your name.");
			$('#LRname').focus();
			return false;
		}
		
		if ($('#LRemail').val() == '') {
			alert ("Please enter your email.");
			$('#LRemail').focus();
			return false;
		}
		
		if ($('#LRphone').val() == '') {
			alert ("Please enter your phone number.");
			$('#LRphone').focus();
			return false;
		}
	
		var options = { 
			target:        '#LRFRMbox'
		}; 

    // submit the form 
     $('#LRFRM').ajaxSubmit(options); 
	return false;

}

function submitCalculator(){
	
	
		var options = { 
			target:        '#CALCresult'
		}; 

    // submit the form 
     $('#calculator').ajaxSubmit(options); 
	return false;

}

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_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];}
}
//-->
