var menu=function(){
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
{var t=15,z=50,s=1,a;}
else
{var t=15,z=50,s=5,a;}
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();


function autotab(fn, fl) {
        var i;
        var idx;
        var next;        
        var docele;
        
        idx = -1;        
        for (i = 0; i < document.myForm.length; i ++) {
                if (document.myForm.elements[i].name == fn.name)
                        idx = i;
        }                
        if (idx != -1) {
                // Find the next 'field'
                next = idx + 1;
                if (next >= document.myForm.length)
                        next = 0 

                // Figure out the length of the given element.                        
                docele = document.myForm.elements[idx].value;
                if (docele.length == fl) {
                        document.myForm.elements[next].focus();
                }
        }        
}
function checkfields() 
{

if (document.myForm.elements['customerpass1'].value != document.myForm.elements['customerpass2'].value) 
   {
      alert ("\nYour password fields do not match try again\t\n");
      document.myForm.elements['customerpass1'].focus();
      return false;      
   }

}
function checkfields1() 
{

if (document.myForm.elements['customerID'].value == "") 
   {
      alert ("\n Enter a Customer ID\t\n");
      document.myForm.elements['customerID'].focus();
      return false;      
   }

if (document.myForm.elements['customerpass'].value == "") 
   {
      alert ("\n Enter a password. First time users enter your zip code or email address.\t\n");
      document.myForm.elements['customerpass'].focus();
      return false;      
   }

}
function checkfields2() 
{

if (document.myForm1.elements['customerID'].value == "") 
   {
      alert ("\n Enter a Customer ID\t\n");
      document.myForm1.elements['customerID'].focus();
      return false;      
   }

if (document.myForm1.elements['customerpass'].value == "") 
   {
      alert ("\n Enter a password. First time users enter your zip code or email address.\t\n");
      document.myForm1.elements['customerpass'].focus();
      return false;      
   }

}

function popup()

   {
 window.open('idcode.htm','remote','width=450,height=460,scrollbars=yes');
if (window != window.top)
  top.location.href = location.href;
}


function popup2()

   {

window.open('ebayfriendly.cfm','remote','width=320,height=280,scrollbars=no,toolbar=no');
      

}

function checkwrap() 
{

if (document.addform.giftwrap.checked == true)
	{

		if (document.addform.wraptype.options[0].selected)
   			{
      			alert ("\nPlease select a Gift Wrap Option\t\n"); 
			return false;       
   			}
	}

if (document.addform.elements['wraptype'].value != "0")

	{
		if (document.addform.elements.giftwrap.checked == false)

   			{
      			alert ("\nPlease confirm your gift wrap option by checking the gift wrap check box\t\n"); 
			return false;       
   			}
	}

}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
 
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
 
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		moredetails_over = newImage("images/moredetails-over.gif");
		preloadFlag = true;
	}
}
function checkfieldsprofile() 
	{




		if (document.myForm.elements['firstname'].value == "")
			{
			 alert ("\nPlease enter your first name\t\n");
     			 document.myForm.elements['firstname'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['lastname'].value == "")
			{
			 alert ("\nPlease enter your last name\t\n");
     			 document.myForm.elements['lastname'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['address1'].value == "")
			{
			 alert ("\nPlease enter your address\t\n");
     			 document.myForm.elements['address1'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['city'].value == "")
			{
			 alert ("\nPlease enter your city\t\n");
     			 document.myForm.elements['city'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['state'].value == "" && document.myForm.elements['country'].value == "US")
			{
			 alert ("\nPlease enter your state\t\n");
     			 document.myForm.elements['state'].focus();
    			 return false;      
   			}

		if (document.myForm.country.options[0].selected)
   			{
      			alert ("\nPlease select a country\t\n"); 
			return false;       
   			}

		if (document.myForm.elements['zip'].value == "")
			{
			 alert ("\nPlease enter your zip code\t\n");
     			 document.myForm.elements['zip'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['customerpass1'].value == "")
			{
			 alert ("\nPlease enter a password\t\n");
     			 document.myForm.elements['customerpass1'].focus();
    			 return false;      
   			}

		if (document.myForm.elements['phone1'].value == "")
			{
			 alert ("\nPlease enter your phone number\t\n");
     			 document.myForm.elements['phone1'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['phone2'].value == "")
			{
			 alert ("\nPlease enter your phone number\t\n");
     			 document.myForm.elements['phone2'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['phone3'].value == "")
			{
			 alert ("\nPlease enter your phone number\t\n");
     			 document.myForm.elements['phone3'].focus();
    			 return false;      
   			}


		if (document.myForm.elements['customerpass1'].value != document.myForm.elements['customerpass2'].value) 
   			{
    			  alert ("\nYour password fields do not match try again\t\n");
    			  document.myForm.elements['customerpass1'].focus();
    			  return false;      
  			 }


  
	


		if (myForm.email.value == "")
 			 {
 			   alert("Please enter a value for the \"email\" field.");
 			   myForm.email.focus();
 			   return (false);
 			 }

     
  			if (myForm.email.value.length < 3)
 			 {
   			 alert("Please enter at least 3 characters in the \"email\" field.");
  			  myForm.email.focus();
  			  return (false);
  			 }


			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value))
			return (true)
  			else
			{
			alert("Invalid E-mail Address! Please re-enter.")
			return (false)
			}


		}

function checkfieldsform1() 
{

if (document.myForm.elements['shiptoaddress'].value != "")
	{
		if (document.myForm.elements['shiptocity'].value == "")
			{
			 alert ("\nPlease enter the ship to city\t\n");
     			 document.myForm.elements['shiptocity'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['shiptoState'].value == "" && document.myForm.elements['shiptocountry'].value == "US")
			{
			 alert ("\nPlease enter the ship to state\t\n");
     			 document.myForm.elements['shiptoState'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['shiptoZip'].value == "")
			{
			 alert ("\nPlease enter the ship to zip code\t\n");
     			 document.myForm.elements['shiptoZip'].focus();
    			 return false;      
   			}
		if (document.myForm.elements['shiptocountry'].value == "")
			{
			 alert ("\nPlease enter the ship to country\t\n");
     			 document.myForm.elements['shiptocountry'].focus();
    			 return false;      
   			}

		if (document.myForm.elements['shiptocountry'].value != "US")
			{
			if (document.myForm.elements['shiptophone1'].value == "")
				{
			 	alert ("\nPlease enter a valid ship to phone number\t\n");
     			 	document.myForm.elements['shiptophone1'].focus();
    			 	return false;      
   				}

			if (document.myForm.elements['shiptophone2'].value == "")
				{
			 	alert ("\nPlease enter a valid ship to phone number\t\n");
     			 	document.myForm.elements['shiptophone2'].focus();
    			 	return false;      
   				}

			if (document.myForm.elements['shiptophone3'].value == "")
				{
			 	alert ("\nPlease enter a valid ship to phone number\t\n");
     			 	document.myForm.elements['shiptophone3'].focus();
    			 	return false;      
   				}
			}
	}



}

function checkzip() 
{
	if (document.calcForm.elements['shiptocountry'].value == "PR" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "US" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "AS" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "GU" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "FM" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "VI" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
	if (document.calcForm.elements['shiptocountry'].value == "MP" && document.calcForm.elements['shiptozip'].value == "")
		{
		 alert ("\nPlease enter a zip code\t\n");
     		 document.calcForm.elements['shiptozip'].focus();
    		 return false;      
   		}
}

function checkfieldsform2() 
{

if (document.myForm2.paymenttype.options[0].selected)
   	{
      alert ("\nPlease enter a payment type\t\n"); 
	return false;       
   	}

if (document.myForm2.elements['paymenttype'].value == "Visa")
   	{
      		if (document.myForm2.elements['cardnumber'].value == "")
		{
	 	alert ("\nPlease enter your card number\t\n");
      		document.myForm2.elements['cardnumber'].focus();
      		return false;      
   		}
		if (document.myForm2.elements['idcode'].value == "")
		{
	 	alert ("\nPlease enter your signature panel code\t\n");
      		document.myForm2.elements['idcode'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['nameoncard'].value == "")
		{
	 	alert ("\nPlease enter the name on your credit card\t\n");
      		document.myForm2.elements['nameoncard'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpiremonth'].value == "")
		{
	 	alert ("\nPlease enter your card expiration month\t\n");
      		document.myForm2.elements['cardexpiremonth'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpireyear'].value == "")
		{
	 	alert ("\nPlease enter your card expiration year\t\n");
      		document.myForm2.elements['cardexpireyear'].focus();
      		return false;      
   		}
   	}

if (document.myForm2.elements['paymenttype'].value == "Master Card")
   	{
      		if (document.myForm2.elements['cardnumber'].value == "")
		{
	 	alert ("\nPlease enter your card number\t\n");
      		document.myForm2.elements['cardnumber'].focus();
      		return false;      
   		}
		if (document.myForm2.elements['idcode'].value == "")
		{
	 	alert ("\nPlease enter your signature panel code\t\n");
      		document.myForm2.elements['idcode'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['nameoncard'].value == "")
		{
	 	alert ("\nPlease enter the name on your credit card\t\n");
      		document.myForm2.elements['nameoncard'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpiremonth'].value == "")
		{
	 	alert ("\nPlease enter your card expiration month\t\n");
      		document.myForm2.elements['cardexpiremonth'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpireyear'].value == "")
		{
	 	alert ("\nPlease enter your card expiration year\t\n");
      		document.myForm2.elements['cardexpireyear'].focus();
      		return false;      
   		}
   	}
if (document.myForm2.elements['paymenttype'].value == "Discover")
   	{
      		if (document.myForm2.elements['cardnumber'].value == "")
		{
	 	alert ("\nPlease enter your card number\t\n");
      		document.myForm2.elements['cardnumber'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['nameoncard'].value == "")
		{
	 	alert ("\nPlease enter the name on your credit card\t\n");
      		document.myForm2.elements['nameoncard'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpiremonth'].value == "")
		{
	 	alert ("\nPlease enter your card expiration month\t\n");
      		document.myForm2.elements['cardexpiremonth'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpireyear'].value == "")
		{
	 	alert ("\nPlease enter your card expiration year\t\n");
      		document.myForm2.elements['cardexpireyear'].focus();
      		return false;      
   		}
   	}

if (document.myForm2.elements['paymenttype'].value == "American Express")
   	{
      		if (document.myForm2.elements['cardnumber'].value == "")
		{
	 	alert ("\nPlease enter your card number\t\n");
      		document.myForm2.elements['cardnumber'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['nameoncard'].value == "")
		{
	 	alert ("\nPlease enter the name on your credit card\t\n");
      		document.myForm2.elements['nameoncard'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpiremonth'].value == "")
		{
	 	alert ("\nPlease enter your card expiration month\t\n");
      		document.myForm2.elements['cardexpiremonth'].focus();
      		return false;      
   		}
      		if (document.myForm2.elements['cardexpireyear'].value == "")
		{
	 	alert ("\nPlease enter your card expiration year\t\n");
      		document.myForm2.elements['cardexpireyear'].focus();
      		return false;      
   		}
   	}
}
function checkfieldsrma() 

{

if (document.myForm.elements['email'].value == "")
				{
				 alert ("\nPlease enter an email address\t\n");
     			 	document.myForm.elements['email'].focus();
      				return false;      
   				}


if (document.myForm.elements['phone'].value == "")
		{
		 alert ("\nPlease enter your phone number\t\n");
     		document.myForm.elements['phone'].focus();
      		return false;      
   		}


if (document.myForm.req[0].checked != true && document.myForm.req[1].checked != true)

		{
		 alert ("\nPlease select an action for us to take \t\n");
     		return false;  
		}
}

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

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

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined")
revivecontent()
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

