
function formatPhone_jsfunc(phone_num_in)
 
{
     var theCount = 0; 
	 
     var newString = "";
     var myString = phone_num_in;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )  
     {
 
          return true;
     }else{
		  
		  return false;}		    
}

function checkvalidzip()
{
      
     var theString = document.forms["addressbook"]["Address:Zip"].value;
     
     var myString = theString;
     var theLen = myString.length; 	 
	 var valid = "0123456789-";
     var hyphencount = 0;

     if (theLen!=5 && theLen!=10) {
        alert("Please enter your 5 digit or 5 digit+4 zip code.");
        return false;
}
        for (var i=0; i < theLen; i++) {
           temp = "" + myString.substring(i, i+1);
           if (temp == "-") hyphencount++;
              if (valid.indexOf(temp) == "-1") {
               alert("Invalid characters in your zip code.  Please try again.");
               return false;
}
           if ((hyphencount > 1) || ((theLen==10) && ""+myString.charAt(5)!="-")) {
               alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
               return false;
   }
}
return true;
}

function validzip(form)
{
      
     var theString = document.forms["addressbook"]["Address:Zip"].value;
     
     var myString = theString;
     var theLen = myString.length; 	 
	 var valid = "0123456789-";
     var hyphencount = 0;
	 

     if (theLen!=5 && theLen!=10) {
        alert("Please enter your 5 digit or 5 digit+4 zip code.");
        return false;
}
        for (var i=0; i < theLen; i++) {
           temp = "" + myString.substring(i, i+1);
           if (temp == "-") hyphencount++;
              if (valid.indexOf(temp) == "-1") {
               alert("Invalid characters in your zip code.  Please try again.");
               return false;
}
           if ((hyphencount > 1) || ((theLen==10) && ""+myString.charAt(5)!="-")) {
               alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
               return false;
   }
}
return true;
}

function formatgenPhone(form,field,mandatory)
 
{
     var theCount = 0; 
	 var formName = form.name; 
	 var fieldName =field.name;    
	 var theString = form.elements[fieldName].value;  
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )  
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
              else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
              else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
		  
          form.elements[fieldName].value = newPhone;
          return true;
     }else{
		   if (mandatory == 'Required'){
               alert("The phone number you entered "+newString+" does not contain 10 digits"); 
               form.elements[fieldName].focus();
			   return false;}
		   else if (newString.length ==0)
		   {return true;}
		   else {
			   alert("The optional secondary phone number you entered "+newString+" does not contain the correct number of digits. Leave it blank or include 10 digits.");
			     form.elements[fieldName].focus();
			   return false;}
			    
             
     }
}

     
 function formatregistPhone()
 
{
     var theCount = 0;
     var theString = document.registerform.Phone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.registerform.Phone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	    document.registerform.Phone.value='';
          document.registerform.Phone.focus();
          return false;
     }
}

 function formatPOMShipPhone()
 
{
     var theCount = 0;
     var theString = document.PhoneOrdersMain.ShipPhone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.PhoneOrdersMain.ShipPhone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	     
          document.PhoneOrdersMain.ShipPhone.focus();
          return false;
     }
}
 function formatPOMBillPhone()
 
{
     var theCount = 0;
     var theString = document.PhoneOrdersMain.BillPhone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.PhoneOrdersMain.BillPhone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	     
          document.PhoneOrdersMain.BillPhone.focus();
          return false;
     }
}

function formatdocfrmPhone()
{
     var theCount = 0;
     var theString = document.contact_main.phone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.contact_main.phone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	    document.contact_main.phone.value='';
          document.contact_main.phone.focus();
          return false;
     }
}
function formatACADshipPhone()
{
     var theCount = 0;
     var theString = document.CustomerForm.Customer_ShipPhone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.CustomerForm.Customer_ShipPhone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	    document.CustomerForm.Customer_ShipPhone.value='';
          document.CustomerForm.Customer_ShipPhone.focus();
          return false;
     }
}
function formatACADbillPhone()
{
     var theCount = 0;
     var theString = document.CustomerForm.Customer_BillPhone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.CustomerForm.Customer_BillPhone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	    document.CustomerForm.Customer_BillPhone.value='';
          document.CustomerForm.Customer_BillPhone.focus();
          return false;
     }
}

function formatADDRPhone()
{
     var theCount = 0;
     var theString = document.CustomerForm.Customer_BillPhone.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 2 ) { newPhone = "(" + newPhone + newString.charAt(i) + ") "; }
else if ( i == 5 )  { newPhone = newPhone + newString.charAt(i) + "-"; }
else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          document.CustomerForm.Customer_BillPhone.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contain the correct number of digits");
	    document.CustomerForm.Customer_BillPhone.value='';
          document.CustomerForm.Customer_BillPhone.focus();
          return false;
     }
}
 
 
function formatDate()
{
     var theCount = 0;
     var theString = document.registerform.Date.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 8 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newDate = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 1 ) { newDate = "" + newDate + newString.charAt(i) + "-"; }
else if ( i == 3 )  { newDate = newDate + newString.charAt(i) + "-"; }
else{
                    newDate = newDate + newString.charAt(i);
               }
          }
          document.registerform.Date.value = newDate;
          return true;
     }else{
          alert("The Date number you entered "+newString+" does not contain the correct number of digits");
	    document.registerform.Date.value='';
          document.registerform.Date.focus();
          return false;
     }
}

function formatregDate()
{
     var theCount = 0;
     var theString = document.newregisterfrm.purchase_datet.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 8 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newDate = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
              if ( i == 1 ) { newDate = "" + newDate + newString.charAt(i) + "-"; }
else if ( i == 3 )  { newDate = newDate + newString.charAt(i) + "-"; }
else{
                    newDate = newDate + newString.charAt(i);
               }
          }
          document.newregisterfrm.purchase_datet.value = newDate;
          return true;
     }else{
          alert("The Date you entered, "+newString+", is invalid");
	    document.newregisterfrm.purchase_datet.value='';
          document.newregisterfrm.purchase_datet.focus();
          return false;
     }
}

function openWindow(page_info)
					{
	
	var url_goto = "http://mail.mailordercentral.com/sterishoe/default.asp?item_url=" + page_info;
	 
    popupWin = window.open(url_goto, '', 'scrollbars,resizable,width=550,height=450');
}

function checkdocfrmform (form){	 
	 	
	 
   if(form.first_name.value == ''){
       alert( " First Name is required , please complete.");  
	   form.first_name.focus();
	   return false;	   
	   }
	   
   else if(form.last_name.value == ''){
       alert( " Last Name is required , please complete.");  
	   form.last_name.focus();
	   return false;	   
	   }
   
   else if(form.address_1.value == ''){
       alert( " Address1 is required , please complete.");  
	   form.address_1.focus();
	   return false;	   
	   }
   else if(form.city.value == ''){
       alert( " City is required , please complete.");  
	   form.city.focus();
	   return false;	   
	   }
   else if(form.state.value == 0){
       alert( " State is required , please complete.");  
	   form.state.focus();
	   return false;	   
	   }
   else if(form.zip.value == ''){
       alert( " ZipCode is required , please complete.");  
	   form.zip.focus();
	   return false;	   
	   }
 else if(form.phone.value == ''){
       alert( " Phone# is required , please complete.");  
	   form.phone.focus();
	   return false;	   
	   }
 else if(form.email.value == ''){
       alert( " email address is required , please complete.");  
	   form.email.focus();
	   return false;	   
	   }
	   
 	   return true;}
	 
function checkregistform (form){	 
	
	first_name_blank=false;
	last_name_blank=false;
	email_blank=false;
	address1_blank=false;
	city_blank=false;
	state_blank=false;
	zipcode_blank=false;
	date_blank=false;
	size_blank=false;
	serial_blank=false;
	location_blank=false;
	 	
	 
   if(form.first_name.value == ''){
       alert( " First Name is required , please complete.");  
	   form.first_name.focus();
	   return false;	   
	   }
	   
   else if(form.last_name.value == ''){
       alert( " Last Name is required , please complete.");  
	   form.last_name.focus();
	   return false;	   
	   }
   else if(form.email.value == ''){
       alert( " email address is required , please complete.");  
	   form.email.focus();
	   return false;	   
	   }
   else if(form.address1.value == ''){
       alert( " Address1 is required , please complete.");  
	   form.address1.focus();
	   return false;	   
	   }
   else if(form.city.value == ''){
       alert( " City is required , please complete.");  
	   form.city.focus();
	   return false;	   
	   }
   else if(form.state.value == 0){
       alert( " State is required , please complete.");  
	   form.state.focus();
	   return false;	   
	   }
   else if(form.zipcode.value == ''){
       alert( " ZipCode is required , please complete.");  
	   form.zipcode.focus();
	   return false;	   
	   }
   else if(form.date.value == ''){
       alert( " Purchase Date is required , please complete.");  
	   form.date.focus();
	   return false;	   
	   }
   else if(form.size.value == 0){
       alert( " Size is required , please complete.");  
	   form.size.focus();
	   return false;	   
	   }
   else if(form.serial.value == ''){
       alert( " Serial# is required , please complete.");  
	   form.serial.focus();
	   return false;	   
	   }
   else if(form.location.value == ''){
       alert( " Location is required , please complete.");  
	   form.location.focus();
	   return false;	   
	   }
	   
 	   return true;}
	   
function checkacctfrm (form){	 
 
   
   var ship_phone = form.Customer_ShipPhone.value;
   var ship_fax = form.Customer_ShipFax.value;  
   var bill_phone = form.Customer_BillPhone.value;  
   var bill_fax = form.Customer_BillFax.value;  
   
//check for valid format of phone numbers

   if(ship_phone != '')
   {
	 if (formatPhone_jsfunc(ship_phone)==false){
		alert( " Ship Phone "+ship_phone+" improperly formatted , please re-enter.");   
		return false
	}}  
	   
    if(ship_fax != '')
   {
	 if (formatPhone_jsfunc(ship_fax)==false){
		alert( " Optional Alternate Ship Phone "+ship_fax+" improperly formatted , please re-enter with 10 digits or leave blank.");   
		return false
	}}
	 if(bill_phone != '')
   {
	 if (formatPhone_jsfunc(bill_phone)==false){
		alert( " Bill Phone "+bill_phone+" improperly formatted , please re-enter.");   
		return false
	}}
	 if(bill_fax != '')
   {
	 if (formatPhone_jsfunc(bill_fax)==false){
		alert( " Optional Alternate Bill Phone "+bill_fax+" improperly formatted , please re-enter with 10 digits or leave blank.");   
		return false
	}}
	
	   
 	   return true;}
	   
	   
function checknewregistform (form){	 
	
	 
	date_blank=false;
	size_blank=false;
	serial_blank=false;
	location_blank=false;
   
   if(form.purchase_datet.value == ''){
       alert( " Purchase Date is required , please complete.");  
	   form.purchase_datet.focus();
	   return false;	   
	   }
   else if(form.size.value == 0){
       alert( " Size is required , please complete.");  
	   form.size.focus();
	   return false;	   
	   }
   else if(form.serial_number.value == ''){
       alert( " Serial# is required , please complete.");  
	   form.serial_number.focus();
	   return false;	   
	   }
   else if(form.purchase_location.value == ''){
       alert( " Location is required , please complete.");  
	   form.purchase_location.focus();
	   return false;	   
	   }
	   
 	   return true;}
	   	 	   
function checknewnotesform (form){	 
	
	note_blank=false;
   
   if(form.customer_note.value == ''){
       alert( " Note text is required , please complete.");  
	   form.customer_note.focus();
	   return false;	   
	   }
	   
 	   return true;}
	   
function checktrademarkform (form){	 
	 
	name_blank=false;
	email_blank=false;
	phone_blank=false; 	
	 
   if(form.name.value == ''){
       alert( " Name is required , please complete.");  
	   form.name.focus();
	   return false;	   
	   }
	   
   else if(form.email.value == ''){
       alert( " email address is required , please complete.");  
	   form.email.focus();
	   return false;	   
	   }
  else if(!form.agree.checked){
       alert( " Agree must be checked , please complete.");  
	   form.agree.focus();
	   return false;	   
	   }
   else if(form.phone.value == ''){
       alert( " Phone is required , please complete.");  
	   form.phone.focus();
	   return false;	   
	   }
	   
 	   return true;}
// Copyright 2001 Idocs.com      
// Distribute this script freely, but keep this notice in place

// backlink object initializer
function backlink() {
	this.text = '<- Return to Phone Order Main';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function badaddr_backlink() {
	this.text = '<- Return to Fix Address';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}

// backlink object initializer
function pws_backlink() {
	this.text = '<- Return to change Shipping option ';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}

// backlink object initializer
function orderhist_backlink() {
	this.text = '<- Return to Order History List ';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function basket_backlink() {
	this.text = '<- Return to Shopping Cart ';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function osel_backlink() {
	this.text = '<- Return to Shipping and Payment Screen';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function ocst_backlink() {
	this.text = '<- Return to Checkout Screen';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function prod_backlink() {
	this.text = '<- Return to Product Screen';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function regist_srch_backlink() {
	this.text = '<- Return to Search';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// backlink object initializer
function enter_note_backlink() {
	this.text = '<- Return to Phone Order Main Screen';
	this.type = 'link';
	this.write = backlink_write2;
	this.form = true;
}


// write method
function backlink_write() {
	if (! window.history) return;
	if (window.history.length == 0)return;

	this.type = this.type.toLowerCase();
	if (this.type == 'button') {
		if (this.form)
			document.write('<FORM>');
		document.write('<INPUT TYPE=BUTTON onClick="history.back(-1)" VALUE="', this.text, '"');
		if (this.otheratts) document.write(' ', this.otheratts);
		document.write('>');
		if (this.form)document.write('<\/FORM>');
	} else {
		document.write('<A HREF="javascript:history.back(-1)"');
		if (this.otheratts)
			document.write(' ', this.otheratts);
		document.write('>');
		if (this.type == 'image' || this.type == 'img') {
			document.write('<img SRC="', this.src, '" ALT="', this.text, '"');
			if (this.width) document.write(' WIDTH=', this.width);
			if (this.height) document.write(' HEIGHT=', this.height);
			if (this.otherimgatts) document.write(' ', this.otherimgatts);
			document.write(' BORDER=0 />');
		}
		else
			document.write(this.text);
		document.write('<\/A>');
	}
}
// write method for going back 2 pages
function backlink_write2() {
	if (! window.history) return;
	if (window.history.length == 0)return;

	this.type = this.type.toLowerCase();
	if (this.type == 'button') {
		if (this.form)
			document.write('<FORM>');
		document.write('<INPUT TYPE=BUTTON onClick="history.go(-2)" VALUE="', this.text, '"');
		if (this.otheratts) document.write(' ', this.otheratts);
		document.write('>');
		if (this.form)document.write('<\/FORM>');
	} else {
		document.write('<A HREF="javascript:history.go(-2)"');
		if (this.otheratts)
			document.write(' ', this.otheratts);
		document.write('>');
		if (this.type == 'image' || this.type == 'img') {
			document.write('<img SRC="', this.src, '" ALT="', this.text, '"');
			if (this.width) document.write(' WIDTH=', this.width);
			if (this.height) document.write(' HEIGHT=', this.height);
			if (this.otherimgatts) document.write(' ', this.otherimgatts);
			document.write(' BORDER=0 />');
		}
		else
			document.write(this.text);
		document.write('<\/A>');
	}
}

function ReloadForm( form_field )
{
	document.location.reload();
	document.getElementsByName("OrderDetails_Format").value = form_field;
}
//-->
function AutoSubmit(){location.href=document.loginform.submit()};

function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}

 
/**
 * 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){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

function validatedocfrmemail(){
	var emailID=document.contact_main.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
