// JavaScript Document
<!-- hide me
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET",dname,false);
xhttp.send(null);
return xhttp.responseXML;
}


function LoadFreight(str)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  xhttp.onreadystatechange=function()
  {
  if (xhttp.readyState==4 && xhttp.status==200)
    {
 
   document.au.fixed_fee_1.value=xhttp.responseText;
   txt=document.au.fixed_fee_1.value;
   txt=txt-0;
   txt=txt*1.05;
   txt=txt.toFixed(2);
  
   txt="Your freight cost is $" + txt + ".";
	document.getElementById("freightCal").innerHTML=txt;   
    
    }
  }
  if(origin_zip.length > 5)
  {
	  var origin_country='CA';
  }
  else
   {
	  var origin_country='US';
  }
document.getElementById("freightCal").innerHTML="Please Wait...";
xhttp.open("GET",'http://www.kirbysupply.com/php_simple.php?dest_zip='+str+'&iclass='+item_class+'&weight='+item_weight+'&origin_zip='+origin_zip+'&origin_country='+origin_country+'',true);
xhttp.send(null);
return xhttp.responseText;
}

function popZoom()
{	
	var winattributes='width='+mwidth+',height='+mheight+',toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=yes,top=5'
	window.open('../../../../zoom.asp?caption='+item_name+'&image='+item_image+'','item_window',winattributes);
				
}


function popTell()
{	
	var winattributes='width=560, height=600, toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=yes,top=5'
	window.open('http://www.kirbysupply.com/Forms/tell_a_friend/tellafriend.php?url='+document.location.href+'&itemname='+item_name+'&itemimage=http://www.kirbysupply.com'+item_image+'&price='+pricei+'&lprice='+pricel+'','tell_window',winattributes);
				
}

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id.slice(0,7); if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+= 'You must enter a Zip Code. \r\rOtherwise the shipping calculator will be unable to determine your rate.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		  
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'Zip Code is required.\n'; }
  } if (errors) alert('Please Enter Your Zip Code and Click on the "Get Freight Rate" button. \r\r Otherwise your item cannot be added to your shopping cart. \r\r'+errors);
  document.MM_returnValue = (errors == '');
}

function discontinued()
{
	if (instock=="Discontinued")
	{
		alert("We're Sorry this Model has been discontinued. \r\r");
		  window.location.replace(disc)
		

  }
  
  if (instock=="Out of Stock")
	{
		alert("We're Sorry this Model is currently Out of Stock. \r\r");
		  window.location.replace(disc)
		

  }
  
}


function getprice()
{

x=xmlDoc.getElementsByTagName('products');

for(i=0;i<x.length;i++)
{ 
if ((x.item(i).attributes[0].nodeValue) == modelid)
{

pricei=(x[i].getElementsByTagName('price')[0].childNodes[0].nodeValue)
pricel=(x[i].getElementsByTagName('listp')[0].childNodes[0].nodeValue)
instock=(x[i].getElementsByTagName('available')[0].childNodes[0].nodeValue)


}
  }
 pricesection=("<span class=\"\itempriceslarge\"\>");
 pricesection=pricesection + pricei
 pricesection=pricesection +("</span></p> List Price: ");
 pricesection=pricesection + pricel
 pricesection=pricesection + (" &nbsp;-&nbsp;&nbsp;&nbsp;");
 pricesection=pricesection + instock
    
 document.write(pricesection);
}

function mainPrice()
{
  
	pricei=pricei.replace(/,/gi, "");
	pricei=pricei.replace("$", "");
	
	document.au.amount.value=pricei;
	
}



function coupon()
{
x=xmlDoc.getElementsByTagName('products');
var coupon_check=" ";

<!-- hide me
for(i=0;i<x.length;i++)
{ 
if ((x.item(i).attributes[0].nodeValue) == modelid)
{
	if ((x[i].getElementsByTagName("coupon")[0].childNodes[0].nodeValue) != "0")
		{
			
			    coupon_check=("<table width='361' align=\"\center\"\ class=\"\coupon\"\><tr><td width='361 height='40'><span class=\"\itempriceslarge\"\>");
				coupon_check=coupon_check+(x[i].getElementsByTagName("coupon_des")[0].childNodes[0].nodeValue)
				coupon_check=coupon_check+("</span></td></tr><tr><td width='361' class=\"\DarkGray-18px\"\> CODE: ");
				coupon_check=coupon_check+(x[i].getElementsByTagName("coupon_code")[0].childNodes[0].nodeValue)
				coupon_check=coupon_check+("</td></tr><tr><td width='361' height='20' align=\"\center\"\ class=\"\Gray-10px\"\> Enter code in the Promotions &amp; Discounts section of your shopping cart.</td></tr></table> <br />");
				
			
		}
		else
		{
			coupon_check="";
		}

}

document.getElementById("coupon_sec").innerHTML=coupon_check;
}

}
// stop hiding -->