<!--

var submitcount=0;

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function checkClicks()
{
   if (submitcount == 0)
   {
      submitcount++;
      return true;
   } else {
      return false;
   }
}

function shipToChange()
{
   if (document.checkout.shipto.checked == true)
   {
      document.checkout.s_name.value      = document.checkout.b_name.value;
      document.checkout.s_address_1.value = document.checkout.b_address_1.value;
      document.checkout.s_address_2.value = document.checkout.b_address_2.value;
      document.checkout.s_city.value      = document.checkout.b_city.value;
      document.checkout.s_state.value     = document.checkout.b_state.value;
      document.checkout.s_zip.value       = document.checkout.b_zip.value;
      document.checkout.s_country.value   = document.checkout.b_country.value;
      document.checkout.s_phone.value     = document.checkout.b_phone.value;
   } else {
      document.checkout.s_name.value      = '';
      document.checkout.s_address_1.value = '';
      document.checkout.s_address_2.value = '';
      document.checkout.s_city.value      = '';
      document.checkout.s_state.value     = '';
      document.checkout.s_zip.value       = '';
      document.checkout.s_country.value   = '';
      document.checkout.s_phone.value     = '';
   }
}

function textCounter(field, countfield, maxlimit)
{
   if (field.value.length > maxlimit)
   {
      field.value = field.value.substring(0, maxlimit);
   } else {
      countfield.value = maxlimit - field.value.length;
   }
}


//Nested Side Bar Menu (Mar 20th, 09)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["sidebarmenu1"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

function initsidebarmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle"
  if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
   ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
  else //else if this is a sub level submenu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
  ultags[t].style.visibility="visible"
  ultags[t].style.display="none"
  }
  }
}

if (window.addEventListener)
window.addEventListener("load", initsidebarmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", initsidebarmenu)

function FrontPage_Form1_Validator(theForm)
{
if (theForm.WW_USERID.value == "")
{
   alert("Please enter a value for the \"User Identification\"  field.");
   theForm.WW_USERID.focus();
   return (false);
}
if (theForm.WW_PASSWORD.value == "")
{
  alert("Please enter a value for the \"Password\"  field.");
  theForm.WW_PASSWORD.focus();
  return (false);
}
}

function checkBrowser() {

/*
var is_major = parseInt(navigator.appVersion); var agt=navigator.userAgent.toLowerCase();
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") ==
-1));
*/

var ua = window.navigator.userAgent;
var is_ie55 = ua.indexOf("MSIE 5.5")>=1
var is_ie6 = ua.indexOf("MSIE 6")>=1
var is_ie7 = ua.indexOf("MSIE 7")>=1
var is_ie8 = ua.indexOf("MSIE 8")>=1
/*
***********************************************************
 COMMENT this alert out once you see that it works
************************************************************
*/

if (!is_ie55 && !is_ie6 && !is_ie7 && !is_ie8) {
//
      FrontPage_Form1.reset();
      document.FrontPage_Form1.WW_PASSWORD.focus();
        var version=/MSIE \d+.\d+/;
        alert("Use of this Application requires INTERNET EXPLORER 5.5 OR ABOVE\n \
        You are using "+navigator.appName+"xx"+navigator.appVersion.match(version))

	FrontPage_Form1.reset();
	document.FrontPage_Form1.WW_USERID.focus();
}
else {
		var version=/MSIE \d+.\d+/
//        alert("You are using "+navigator.appName+"xx"+navigator.appVersion.match(version))
}


} // End of Function

function onLoadx() {
document.FrontPage_Form1.WW_USERID.focus();

}

function FrontPage_Form1_Validator(theForm)
{


if (theForm.WW_USERID.value == "")
{
   alert("Please enter a value for the \"User Identification\"  field.");
   theForm.WW_USERID.focus();
   return (false);
}


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

}

function showForm() {

oDiv = document.getElementById('theFormDiv');

oDiv.style.display='block';
document.getElementById('email').value="";
document.getElementById('first').value="";
document.getElementById('last').value="";
document.getElementById('email').focus();
return;
}

function hideForm(valx) {
if (valx == 2) {
  oDiv = document.getElementById('theFormDiv');
  oDiv.style.display='none';
  return false;
}
else
{
  returnMsg();
  return false;
}

} //End of Function

function verifyAddress(f) {
// This function returns the Email address

xreturn = true;

if (f == "") {
	alert ("Invalid Email address -- Please re-enter")
//	document.getElementById('email').focus();
//	hilite('email');
      document.Form2.email.style.backgroundColor="#e5fff3";
      document.Form2.email.focus();
	xreturn = false;
	return;
}


if (f.indexOf ('@',0) == -1 || f.indexOf ('.',0) == -1) {
	alert ("Invalid Email address -- Please re-enter")
//	document.getElementById('email').focus();
//	hilite('email');
      document.Form2.email.style.backgroundColor="#e5fff3";
      document.Form2.email.focus();
	xreturn = false;
	return
}

}

function hilite(field) {
// This highlights the text box to yellow -  You can put in any color!!!!
       if (document.all) {
                document.getElementById(field).style.backgroundColor="yellow";
       }
} // End of Function

function returnMsg() {
// This function runs a auto-submit to popup a Message window and call reqpasswd script

var xx=Math.random();
var seperator = "~";
var parmSeperator = "?"

document.getElementById('email').style.backgroundColor="white";
document.getElementById('first').style.backgroundColor="white";
document.getElementById('last').style.backgroundColor="white";


// oEmail = document.getElementById('email').value;
oEmail = document.Form2.email.value;

var pasItemString=oEmail;
// this will get rid of leading and trailing spaces
while (pasItemString.substring(0,1) == ' ')
  pasItemString = pasItemString.substring(1, pasItemString.length);
// this will get rid of trailing spaces
while (pasItemString.substring(pasItemString.length-1,pasItemString.length) == ' ')
 pasItemString = pasItemString.substring(0, pasItemString.length-1);
oEmail=pasItemString;

verifyAddress(oEmail);

if (xreturn == false)
	return true;

// oFirst = document.getElementById('first').value;
oFirst = document.Form2.first.value;

var pasItemString=oFirst;
// this will get rid of leading and trailing spaces
while (pasItemString.substring(0,1) == ' ')
  pasItemString = pasItemString.substring(1, pasItemString.length);
// this will get rid of trailing spaces
while (pasItemString.substring(pasItemString.length-1,pasItemString.length) == ' ')
 pasItemString = pasItemString.substring(0, pasItemString.length-1);
oFirst=pasItemString

if (oFirst == "") {
	alert("Data is required for this field")
//	document.getElementById('first').focus();
//	hilite('first');
      document.Form2.first.style.backgroundColor="#e5fff3";
      document.Form2.first.focus();
	return false;
}

// oLast = document.getElementById('last').value;
oLast = document.Form2.last.value;

var pasItemString=oLast;
// this will get rid of leading and trailing spaces
while (pasItemString.substring(0,1) == ' ')
  pasItemString = pasItemString.substring(1, pasItemString.length);
// this will get rid of trailing spaces
while (pasItemString.substring(pasItemString.length-1,pasItemString.length) == ' ')
 pasItemString = pasItemString.substring(0, pasItemString.length-1);
oLast=pasItemString;

if (oLast == "") {
	alert("Data is required for this field")
//	document.getElementById('last').focus();
//	hilite('last');
      document.Form2.last.style.backgroundColor="#e5fff3";
      document.Form2.last.focus();
	return false;
}

oDiv = document.getElementById('theFormDiv');
oDiv.style.display='none';
url='http://dealer.cashwells.com/cgi-bin/CGIRPC32.DLL/wb570.acu'
urlData=url + parmSeperator + oEmail + seperator + oFirst + seperator + oLast + seperator + xx;
msgVal=window.showModalDialog(urlData,"",
"dialogHeight:50px; dialogWidth: 500px; dialogTop: 460px; dialogLeft: 375px; ed \
ge: Sunken; center: Yes; help: No; resizable: No; status: No;");


} //End of Function


//-->


      
