
var downStrokeField;
function autojump(fieldName,nextFieldName,fakeMaxLength)
{
var myForm=document.forms[document.forms.length - 1];
var myField=myForm.elements[fieldName];
myField.nextField=myForm.elements[nextFieldName];

if (myField.maxLength == null)
   myField.maxLength=fakeMaxLength;

myField.onkeydown=autojump_keyDown;
myField.onkeyup=autojump_keyUp;
}

function autojump_keyDown()
{
this.beforeLength=this.value.length;
downStrokeField=this;
}

function autojump_keyUp()
{
if (
   (this == downStrokeField) && 
   (this.value.length > this.beforeLength) && 
   (this.value.length >= this.maxLength)
   )
   this.nextField.focus();
downStrokeField=null;
}



function checkrequired(which) {
var pw1 = which.password.value;


if(pw1 == '') {
pw1 = 'aaaaaa';
pw2  = 'aaaaaa';
}else {
	var pw2 = which.confirm_password.value;
}
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
//alert("Please make sure the "+shortFieldName+" field was properly completed.");
document.getElementById("POPWarning").innerHTML = "<p><strong>Please make sure the "+shortFieldName+" field was properly completed.</strong></p>";


	popup_show('popup2', 'popup_drag2', 'popup_exit2', 'element-right', 200,  0,   0, tempobj.name);
return false;
}
	else {
		if (pw1 != pw2) {
		alert ("You did not enter the same password twice. Please re-enter your password.")
		return false;
		} else if (pw1.substring(5,7) == '') {
		alert ("Password must be a minimum of 6 characters. Please re-enter your password.")
		return false;
		}
		else  {
			
		popup_show('popup_process', 'popup_drag_process', 'popup_drag__exit', 'element', 250,  0,   0, 'CARDTYPE');
		return true;
		}
	}
}





function goHist(a) 
{

   history.go(a);      // Go back one.

}




function printpage() {
window.print();  
}



var ray={
ajax:function(st)
	{
		this.show('load');
	},
show:function(el)
	{
		this.getID(el).style.display='';
	},
getID:function(el)
	{
		return document.getElementById(el);
	}
}





var xmlHttp

function showHint(str)
{
if (str.length==0)
  { 
  document.getElementById("requiredBilling_City").value=="";
  document.getElementById("requiredBilling_State_Province").value=="";

  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="Ajax_citystate_lookup.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateCityChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateCityChanged() 
{ 
if (xmlHttp.readyState==4)
{ 


var myArray = eval( xmlHttp.responseText );
document.getElementById("requiredBilling_City").value=myArray[0];
document.getElementById("requiredBilling_State_Province").value=myArray[1];
}
}

var xmlHttp

function showHint2(str)
{
if (str.length==0)
  { 
  document.getElementById("requiredShipping_City").value=="";
  document.getElementById("requiredShipping_State_Province").value=="";

  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="Ajax_citystate_lookup.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateCityChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateCityChanged2() 
{ 
if (xmlHttp.readyState==4)
{ 


var myArray = eval( xmlHttp.responseText );
document.getElementById("requiredShipping_City").value=myArray[0];
document.getElementById("requiredShipping_State_Province").value=myArray[1];
}
}




var xmlHttp

function login(user, pass)
{

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="Ajax_user_login.php";
url=url+"?user="+user;
url=url+"&pass="+pass;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=loginChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function loginChanged() 
{ 
if (xmlHttp.readyState==4)
{ 


var myArray = xmlHttp.responseText;
	document.getElementById("LogIn").innerHTML = myArray;
}
}





var xmlHttp

function get_ups_shipping(zip, weight, baseboard)
{

if (zip.length==0)
  { 

document.getElementById("shippingr").innerHTML="<span id='process_bar'><span class='warning'>Sorry you must enter a zip code to get a shipping estimate</span></span>";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="ajax_shipping_estimate.php";
url=url+"?zip="+zip;
url=url+"&pounds="+weight;
url=url+"&baseboard="+baseboard;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=ShippingChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function ShippingChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
  document.getElementById("shippingr").innerHTML=xmlHttp.responseText;
}
}




function show_process()
{ 
document.getElementById("process_bar").innerHTML="<img src='/support/web_images/progress_ani.gif' alt='Loading...' />";
}



function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
  {// code for all new browsers
  xmlHttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE5 and IE6
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

return xmlHttp;
}




/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="local" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("navigation").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
		
		
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}



function OpenMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	
		if(el.style.display != "block"){ //DynamicDrive.com change
			
		
		
			el.style.display = "block";
		}
	}
}


function CloseMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	
		if(el.style.display == "block"){ //DynamicDrive.com change
			
		
		el.style.display = "none";
			
		}
	}
}




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 onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

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

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
