_uacct = "UA-278425-1";
//urchinTracker();

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

function cRLCL() {
	thing = "";
	thing += String.fromCharCode(97 + Math.round(Math.random() * 25));
	thing += String.fromCharCode(97 + Math.round(Math.random() * 25));
	thing += String.fromCharCode(97 + Math.round(Math.random() * 25));
	thing += String.fromCharCode(97 + Math.round(Math.random() * 25));
	thing += String.fromCharCode(97 + Math.round(Math.random() * 25));
	return thing;
}

function checkOrderData() {
	fail = 0;
	if (document.CustomerInfo.ShipFirstName.value=="") {
		document.CustomerInfo.ShipFirstName.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipFirstName.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipFirstName.style.borderColor = "#999999";
		document.CustomerInfo.ShipFirstName.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipLastName.value=="") {
		document.CustomerInfo.ShipLastName.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipLastName.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipLastName.style.borderColor = "#999999";
		document.CustomerInfo.ShipLastName.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipEmail.value==""||echeck(document.CustomerInfo.ShipEmail.value)) {
		document.CustomerInfo.ShipEmail.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipEmail.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipEmail.style.borderColor = "#999999";
		document.CustomerInfo.ShipEmail.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipPhone.value=="") {
		document.CustomerInfo.ShipPhone.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipPhone.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipPhone.style.borderColor = "#999999";
		document.CustomerInfo.ShipPhone.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipAddress.value=="") {
		document.CustomerInfo.ShipAddress.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipAddress.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipAddress.style.borderColor = "#999999";
		document.CustomerInfo.ShipAddress.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipCity.value=="") {
		document.CustomerInfo.ShipCity.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipCity.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipCity.style.borderColor = "#999999";
		document.CustomerInfo.ShipCity.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipStateSelect.value=="AA") {
		document.CustomerInfo.ShipStateSelect.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipStateSelect.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipStateSelect.style.borderColor = "#999999";
		document.CustomerInfo.ShipStateSelect.style.backgroundColor = "#FFFFFF";
	}
	if (document.CustomerInfo.ShipZip.value==""||!validateZIP(document.CustomerInfo.ShipZip.value)) {
		document.CustomerInfo.ShipZip.style.borderColor = "#FF0000";
		document.CustomerInfo.ShipZip.style.backgroundColor = "#FFCCCC";
		fail = 1;
	} else {
		document.CustomerInfo.ShipZip.style.borderColor = "#999999";
		document.CustomerInfo.ShipZip.style.backgroundColor = "#FFFFFF";
	}

	if (document.CustomerInfo.BillFirstName.value=="") {
		document.CustomerInfo.BillFirstName.value = document.CustomerInfo.ShipFirstName.value;
	}
	if (document.CustomerInfo.BillLastName.value=="") {
		document.CustomerInfo.BillLastName.value = document.CustomerInfo.ShipLastName.value;
	}
	if (document.CustomerInfo.BillEmail.value=="") {
		document.CustomerInfo.BillEmail.value = document.CustomerInfo.ShipEmail.value;
	}
	if (document.CustomerInfo.BillPhone.value=="") {
		document.CustomerInfo.BillPhone.value = document.CustomerInfo.ShipPhone.value;
	}
	if (document.CustomerInfo.BillAddress.value=="") {
		document.CustomerInfo.BillAddress.value = document.CustomerInfo.ShipAddress.value;
	}
	if (document.CustomerInfo.BillCity.value=="") {
		document.CustomerInfo.BillCity.value = document.CustomerInfo.ShipCity.value;
	}
	if (document.CustomerInfo.BillStateSelect.value=="AA") {
		for(i=0;i<document.CustomerInfo.BillStateSelect.length;i++) {
			if (document.CustomerInfo.BillStateSelect[i].value==document.CustomerInfo.ShipStateSelect.value) {
				document.CustomerInfo.BillStateSelect[i].selected = true;
			} else {
				document.CustomerInfo.BillStateSelect[i].selected = false;
			}
		}
	}
	if (document.CustomerInfo.BillZip.value=="") {
		document.CustomerInfo.BillZip.value = document.CustomerInfo.ShipZip.value;
	}
	
	if (fail==1) {
		resizeH('div1',55,3);
	} else {
		document.CustomerInfo.submit();
	}
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){

		   return true
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   return true
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    return true
		}

		 if (str.indexOf(at,(lat+1))!=-1){

		    return true
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    return true
		 }

		 if (str.indexOf(dot,(lat+2))==-1){

		    return true
		 }
		
		 if (str.indexOf(" ")!=-1){

		    return true
		 }

 		 return false					
	}
	
	
	
/**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()-. ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function ValidateNumber(Phone){
	if ((Phone==null)||(Phone=="")){
		return true
	}
	return false
 }
 
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=10) {
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
return false;
   }
}
return true;
}


function startSearch() {
	document.getElementById('Search').style.color = "#000000";
	if(document.getElementById('Search').value=="Enter a word or phrase to find any of our thousands of products") {
		document.getElementById('Search').value="";
	}
}

function clearSearch() {
	if (!document.getElementById('Search')) return;
	if(document.getElementById('Search').value==""||document.getElementById('Search').value=="Enter a word or phrase to find any of our thousands of products") {
		document.getElementById('Search').style.color = "#0080DC";
		document.getElementById('Search').value="Enter a word or phrase to find any of our thousands of products";
	}
}