

ns = document.layers
ie = document.all
 
 //FUNCTION TO PRELOAD IMAGES
 
 function preload(imgObj,imgSrc){
	if(document.images){
		eval(imgObj +'= new Image()')
		eval(imgObj+'.src = "'+ imgSrc + '"')
	}
  }
preload("home","/images/homebutton2.gif")
preload("aboutus","/images/aboutusbutton2.gif")
preload("serviceandparts","/images/serviceandpartsbutton2.gif")
preload("finance","/images/financebutton2.gif")
preload("internetspecials","/images/internetspecialsbutton2.gif")
preload("contactus","/images/contactusbutton.gif");

//FUNCTION TO CHANGE THE IMAGE ON MOUSE MOVE

function changeimg(objname,img_src){
	document.images[objname].src = img_src
}

// FUNCTION TO CHANGE THE FONT SIZE IN THE PAGE
	
function init(){
	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false
	if (ns4) block = "document.maindiv"
	if (ie4) block = "maindiv.style"
}
	

// THIS FUNCTION IS USED TO VALIDATE THE FORM IN LOGIN.ASP
function ValidateLoginForm(f) 
{
	if(f.userid.value == "")
	{
		alert("Please enter a UserID");
		return false;
	}
		if(f.password.value == "")
	{
		alert("Please enter a Password");
		return false;
	}
	return true;
}

// THIS FUNCTION IS USED VALIDATE THE FORM IN FIRST_LOGIN.ASP

function ValidateFirstLoginForm(f) 
{

	if (f.userID.value=="") 
	{
	alert("Please enter a UserID");
    return false;
	}
	
	if (f.password.value=="") 
	{
	alert("Please enter a password");
    return false;
	}


    
   // allow ONLY alphanumeric keys, no symbols or punctuation in userid field

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
  var checkStr = f.userID.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and numeric characters in the Userid field.");
    f.userID.focus();
    return false;
  }
   
   
  
   // allow ONLY alphanumeric keys, no symbols or punctuation in password field

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  var checkStr = f.password.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and numeric characters in the password field.");
    f.userID.focus();
    return false;
  } 
 


   // allow ONLY alphanumeric keys, no symbols or punctuation in confirmation password field

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  var checkStr = f.repassword.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and numeric characters in the confirmation password field.");
    f.userID.focus();
    return false;
  } 
 
  
	if (f.repassword.value=="") 
	{
	alert("Please enter Confirmation password also");
    return false;
	}

	if (f.password.value != f.repassword.value) 
	{
	alert("Password and Confirmation password are not same");
    return false;
	}

	if (f.sec_qst.value !="" && f.sec_ans.value == "") 
	{
	alert("You have not entered secret answer");
    return false;
	}

	if (f.sec_ans.value !="" && f.sec_qst.value == "") 
	{
	alert("You have not entered secret question");
    return false;
	}

return true;
}










// THIS FUNCTION IS USED VALIDATE THE FORM IN EDITMYINFO.ASP

function ValidateEditMyInfo(f) 
{

   
  
   // allow ONLY alphanumeric keys, no symbols or punctuation in password field

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  var checkStr = f.password.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and numeric characters in the password field.");
    f.userID.focus();
    return false;
  } 
 


   // allow ONLY alphanumeric keys, no symbols or punctuation in confirmation password field

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  var checkStr = f.repassword.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and numeric characters in the confirmation password field.");
    f.userID.focus();
    return false;
  } 
 
  
	if (f.repassword.value=="") 
	{
	alert("Please enter Confirmation password also");
    return false;
	}

	if (f.password.value != f.repassword.value) 
	{
	alert("Password and Confirmation password are not same");
    return false;
	}

	if (f.sec_qst.value !="" && f.sec_ans.value == "") 
	{
	alert("You have not entered secret answer");
    return false;
	}

	if (f.sec_ans.value !="" && f.sec_qst.value == "") 
	{
	alert("You have not entered secret question");
    return false;
	}

return true;
}

function openSmlWindow(page)
{
	window.open(page,'','width=375,height=300,status=no,toolbar=no,menu=no,scrollbars=no,resizeable=no');
}


