<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}



//-->

function MM_ClickImage() { //v3.0
  var i,j=0,x,a=MM_ClickImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
      document.MM_sr[j++]=x; 
      if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
   }  
   
}

//calc
 function floor(number)
 {
   return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
 }
 
 function dosum()
 {
   var mi = document.temps.IR.value / 1200;
   var base = 1;
   var mbase = 1 + mi;
   for (i=0; i<document.temps.YR.value * 12; i++)
   {
     base = base * mbase
   }
   document.getElementById('PI').innerHTML= floor(document.temps.LA.value * mi / ( 1 - (1/base)));
   document.getElementById('MT').innerHTML = floor(document.temps.AT.value / 12);
   var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) + document.temps.AT.value / 12;
   document.getElementById('MP').innerHTML = floor(dasum);
   document.getElementById('answ').style.visibility = "visible";
   document.getElementById('answ').style.height     = "70px";
 }


             opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
ie = (document.all && !opera)? true : false;
dom = (document.getElementById && !ie && !opera)? true : false;

var expiration = new Date();
expiration.setTime(expiration.getTime() + 3600*3600*3600);

function inputCustomInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('address','city','zip_code');
   var error_array = new Array('Street Address','City','Zip Code');

   if (!(validEmail(frm.elements['get_email'].value))) { 
      alert('Please enter a valid email address in the form of email@host.tag.');
      frm.elements['get_email'].focus();
      return false;
   }

   if (frm.elements['get_password_1'].value.length == 0) {
      alert('Please enter a password 6-10 characters long using only letters or numbers.');
      frm.elements['get_password_1'].focus();
      return false;
   }
   if ((frm.elements['get_password_1'].value.length < 6) || (frm.elements['get_password_1'].value.length > 10)) {
      alert('Please enter a password 6-10 characters long using only letters or numbers.');
      frm.elements['get_password_1'].focus(); 
      return false;
   }

   if (frm.elements['get_password_2'].value.length == 0) {
      alert('Please enter a Re-Password.');
      frm.elements['get_password_2'].focus();
      return false;
   }

   if (frm.elements['get_password_1'].value != frm.elements['get_password_2'].value) {
      alert('Your password confirmation does not match the original password');
      frm.elements['get_password_2'].focus();
      return false;
   }

   if (frm.elements['get_first_name'].value.length == 0) {
      alert('Please enter your First Name');
      frm.elements['get_first_name'].focus();
      return false;
   }

   if (frm.elements['get_last_name'].value.length == 0) {
      alert('Please enter your Last Name');
      frm.elements['get_last_name'].focus();
      return false;
   }

   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert('Please enter '+error_array[i]);
         frm.elements[source].focus();
         return false;
      }
   }

   return true;
}

function inputOrderInfo1(frm) {
   var prefix0 = 'get_';

   if ((frm.elements['get_shipping_ref_country'].value == '223' || frm.elements['get_shipping_ref_country'].value == '38') && (frm.elements['get_billing_ref_country'].value != '223' && frm.elements['get_billing_ref_country'].value != '38')) {

     var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city','shipping_ref_state','shipping_zip_code',
        'billing_firstname','billing_lastname','billing_address','billing_city','billing_email');
     var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City','Shipping State','Shipping Zip Code',
        'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Email');

   } else if ((frm.elements['get_shipping_ref_country'].value == '223' || frm.elements['get_shipping_ref_country'].value == '38') && (frm.elements['get_billing_ref_country'].value == '223' || frm.elements['get_billing_ref_country'].value == '38')) {
       
       var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city','shipping_ref_state','shipping_zip_code',
          'billing_firstname','billing_lastname','billing_address','billing_city','billing_ref_state','billing_zip_code','billing_email');
       var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City','Shipping State','Shipping Zip Code',
          'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing State','Billing Zip Code','Billing Email');

     } else if ((frm.elements['get_shipping_ref_country'].value != '223' && frm.elements['get_shipping_ref_country'].value != '38') && (frm.elements['get_billing_ref_country'].value == '223' || frm.elements['get_billing_ref_country'].value == '38')){ 

         var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
            'billing_firstname','billing_lastname','billing_address','billing_city','billing_ref_state','billing_zip_code','billing_email');
         var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
            'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing State','Billing Zip Code','Billing Email');

       } else { 

           var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
              'billing_firstname','billing_lastname','billing_address','billing_city','billing_email');
           var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
              'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Email');

         }


/*   var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
      'billing_firstname','billing_lastname','billing_address','billing_city','billing_zip_code','billing_email');

   var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
     'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Zip Code','Billing Email');
*/
   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty!');
         frm.elements[source].focus();
         return false;
      }
      if  (input_array[i] == 'billing_email') {
         if (!validEmail(frm.elements[source].value)){
            alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' has wrong format ');
            frm.elements[source].focus();
            return false;
         } 
      }    
   }

   if (frm.get_is_create_account.checked && frm.elements['get_pasw_1'].value.length == 0) {
      alert('Please enter a password 6-15 characters long using only letters or numbers.');
      frm.elements['get_pasw_1'].focus();
      return false;
   }

   if (frm.elements['get_pasw_1'].value && ((frm.elements['get_pasw_1'].value.length < 6) || (frm.elements['get_pasw_1'].value.length > 15))) {
      alert('Please enter a password 6-15 characters long using only letters or numbers.');
      frm.elements['get_pasw_1'].focus(); 
      return false;
   }

   if (frm.elements['get_pasw_1'].value && frm.elements['get_pasw_2'].value.length == 0) {
      alert('Please enter a Re-Password.');
      frm.elements['get_pasw_2'].focus();
      return false;
   }

   if (frm.elements['get_pasw_2'].value && (frm.elements['get_pasw_1'].value != frm.elements['get_pasw_2'].value)) {
      alert('Your password confirmation does not match the original password');
      frm.elements['get_pasw_2'].focus();
      return false;
   }

   if (!frm.get_tos.checked) {
      alert("Please read \"Term of Sale\" and click continue.")
      return false;
   }

   return true;
}

function inputOrderInfo1_no_shipping(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('billing_firstname','billing_lastname','billing_address','billing_city','billing_zip_code','billing_email');

   var error_array = new Array('Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Zip Code','Billing Email');

   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty!');
         frm.elements[source].focus();
         return false;
      }
      if  (input_array[i] == 'billing_email') {
         if (!validEmail(frm.elements[source].value)){
            alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' has wrong format ');
            frm.elements[source].focus();
            return false;
         } 
      }    
   }

   if (frm.get_is_create_account.checked && frm.elements['get_pasw_1'].value.length == 0) {
      alert('Please enter a password 6-15 characters long using only letters or numbers.');
      frm.elements['get_pasw_1'].focus();
      return false;
   }

   if (frm.elements['get_pasw_1'].value && ((frm.elements['get_pasw_1'].value.length < 6) || (frm.elements['get_pasw_1'].value.length > 15))) {
      alert('Please enter a password 6-15 characters long using only letters or numbers.');
      frm.elements['get_pasw_1'].focus(); 
      return false;
   }

   if (frm.elements['get_pasw_1'].value && frm.elements['get_pasw_2'].value.length == 0) {
      alert('Please enter a Re-Password.');
      frm.elements['get_pasw_2'].focus();
      return false;
   }

   if (frm.elements['get_pasw_2'].value && (frm.elements['get_pasw_1'].value != frm.elements['get_pasw_2'].value)) {
      alert('Your password confirmation does not match the original password');
      frm.elements['get_pasw_2'].focus();
      return false;
   }

   if (!frm.get_tos.checked) {
      alert("Please read \"Term of Sale\" and click continue.")
      return false;
   }

   return true;
}

function showtranscript(elemId,displayValue) {
  if (dom) {

      if (displayValue) {
         document.getElementById(elemId).style.display = displayValue;
         return 0;
      }

      if (document.getElementById(elemId).style.display == "none") {
         document.getElementById(elemId).style.display = "block";
      } else if (document.getElementById(elemId).style.display == "block") {
         document.getElementById(elemId).style.display = "none";
      } 
      
  } else if (ie) {
    if (displayValue) {
       document.all[elemId].style.display =  displayValue;
       return 0;
    }

    if (document.all[elemId].style.display == "block") {
       document.all[elemId].style.display = "none";
    } else if (document.all[elemId].style.display == "none") {
      document.all[elemId].style.display = "block";
    }

  }
}

function display(cookie_name, id) {
    var template_category_cookie;

    template_category_cookie = GetCookie(cookie_name);

    if (template_category_cookie) {
       SetCookie(cookie_name, "1", expiration, "", "","") 
       showtranscript(id, 'block');
    } else {
       SetCookie(cookie_name, "", expiration, "", "","") 
       showtranscript(id, 'none');
    }

    return true;                            
}


function onCookieChange(cookie_name, id) {
 
  if (dom) {
      if (document.getElementById(id).style.display == "none") {
         SetCookie(cookie_name, "", expiration, "", "","") 
      } else if (document.getElementById(id).style.display == "block") {
         SetCookie(cookie_name, "1", expiration, "", "","") 
      } 
      
  } else if (ie) {

    if (document.all[id].style.display == "block") {
       SetCookie(cookie_name, "1", expiration, "", "","") 
    } else if (document.all[id].style.display == "none") {
       SetCookie(cookie_name, "", expiration, "", "","") 
    }

  }
}


function SetCookie(name, value, expires, path, domain, secure) { 
   var mycookie = name + "=" + escape(value);
   var myexpires = new Date();
   if (value == '' || value == 0){
      if (GetCookie(name))
         expir = -30;
      else
         return ;
   }else
      expir = myexpires.setTime(myexpires.getTime() + 5000);
   mycookie = mycookie + "; myexpires=" + expir;
   document.cookie = mycookie;
}


function GetCookie(name) { 
   var arg = name + "="; 
   var alen = arg.length; 
   var clen = document.cookie.length; 
   var i = 0; 

   while (i < clen) { 
     var j = i + alen; 
     if (document.cookie.substring(i, j) == arg)  return getCookieVal (j); 
     i = document.cookie.indexOf(" ", i) + 1; 
     if (i == 0) break; 
   }
    
   return null; 
} 


function getCookieVal (offset) { 
  var endstr = document.cookie.indexOf (";", offset); 
  if (endstr == -1) endstr = document.cookie.length; 
   return unescape(document.cookie.substring(offset, endstr)); 
} 

function resize() {

var i=0;

var LeftPosition;

var TopPosition;

var w;

var h;

  if (navigator.appName == 'Netscape') i=40;

  if (document.images[0]) 

  {

    w = document.images[1].width+100;

    h = document.images[1].height+130-i;

    window.resizeTo(w, h);

    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.moveTo(LeftPosition, TopPosition); 

  }

  self.focus();

}
function viewform(m, w, h, scrol) {

   var scrolling = 'no';

   var settings;

   var LeftPosition;

   var TopPosition;

   var win;



   if (!scrol) scrol = 'no';



   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

  

   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol;



   if (scrol == 'no') settings = settings + ',resizable=no,maximize=no';

   if (scrol == 'yes') settings = settings + ',resizable=yes,maximize=yes';



   settings = settings + ',status=no,toolbar=no,directories=no,menubar=no,location=no';

		      

   win = window.open(m, 'pre', settings);

   win.name = 'name';

   win.focus();

}
function conf() {
  var reply = confirm('This record will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}								  

function confirm_delete() {
  var reply = confirm('This record will be permanently deleted. Do you want to continue?');

  if(reply) {
     return true;
   } else {
     return false;
   }
}

function validEmail(email) {

  invalidChars = " /:,;";
  if (email == "") {
    return false;
  }
  for (i=0; i<invalidChars.length;i++) {
    badChar = invalidChars.charAt(i);
    if (email.indexOf(badChar,0) > -1) {
      return false;
    }
  }
  atPos = email.indexOf("@",1);
  if (atPos == -1) {
    return false;
  }
  if (email.indexOf("@",atPos+1) > -1) {
    return false;
  }
  periodPos = email.indexOf(".",atPos);
  if (periodPos == -1) {
    return false;
  }
  if (periodPos+3 > email.length) {
    return false;
  }
  return true;
}
								  
function useCustomInfo2(chck, frm, prefix, prefix2) {
   var prefix0 = 'get_';
   var input_array = new Array('firstname','lastname','company','address','city','zip_code','phone');
   var select_array = new Array('ref_country', 'ref_state');

   if (chck.checked) {
      for (var i=0; i<input_array.length; i++) {
         var source = prefix0+prefix+input_array[i];
         var destin = prefix0+prefix2+input_array[i];
      
         frm.elements[destin].value = frm.elements[source].value;
      }

      for (var i=0; i<select_array.length; i++) {
         var source = prefix0+prefix+select_array[i]; 
         var destin = prefix0+prefix2+select_array[i];
         
         frm.elements[destin].options.length = 0;

         for (var j=0; j < frm.elements[source].options.length; j++) {
            frm.elements[destin].options.length = j+1;
            frm.elements[destin].options[j].value = frm.elements[source].options[j].value;
            frm.elements[destin].options[j].text  = frm.elements[source].options[j].text;
         }
         
         frm.elements[destin].selectedIndex = frm.elements[source].selectedIndex;
      }
   }
   return true;
}

function inputOrderInfo(frm) {
   var prefix0 = 'get_';

   if ((frm.elements['get_shipping_ref_country'].value == '223' || frm.elements['get_shipping_ref_country'].value == '38') && (frm.elements['get_billing_ref_country'].value != '223' && frm.elements['get_billing_ref_country'].value != '38')) {

     var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city','shipping_ref_state','shipping_zip_code',
        'billing_firstname','billing_lastname','billing_address','billing_city','billing_email');
     var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City','Shipping State','Shipping Zip Code',
        'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Email');

   } else if ((frm.elements['get_shipping_ref_country'].value == '223' || frm.elements['get_shipping_ref_country'].value == '38') && (frm.elements['get_billing_ref_country'].value == '223' || frm.elements['get_billing_ref_country'].value == '38')) {

       var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city','shipping_ref_state','shipping_zip_code',
          'billing_firstname','billing_lastname','billing_address','billing_city','billing_ref_state','billing_zip_code','billing_email');
       var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City','Shipping State','Shipping Zip Code',
          'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing State','Billing Zip Code','Billing Email');

     } else if ((frm.elements['get_shipping_ref_country'].value != '223' && frm.elements['get_shipping_ref_country'].value != '38') && (frm.elements['get_billing_ref_country'].value == '223' || frm.elements['get_billing_ref_country'].value == '38')){

         var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
            'billing_firstname','billing_lastname','billing_address','billing_city','billing_ref_state','billing_zip_code','billing_email');
         var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
            'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing State','Billing Zip Code','Billing Email');

       } else {

           var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
              'billing_firstname','billing_lastname','billing_address','billing_city','billing_email');
           var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
              'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Email');

         }

/*
   var input_array = new Array('shipping_firstname','shipping_lastname','shipping_address','shipping_city',
      'billing_firstname','billing_lastname','billing_address','billing_city','billing_zip_code','billing_email');

   var error_array = new Array('Shipping Firstname','Shipping Lastname','Shipping Address','Shipping City',
     'Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Zip Code','Billing Email');
*/
   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty!');
         frm.elements[source].focus();
         return false;
      }
      if  (input_array[i] == 'billing_email') {
         if (!validEmail(frm.elements[source].value)){
            alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' has wrong format ');
            frm.elements[source].focus();
            return false;
         } 
      }    
   }

   if (!frm.get_tos.checked) {
      alert("Please read \"Term of Sale\" and click continue.")
      return false;
   }

   return true;
}


function inputOrderInfo_no_shipping(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('billing_firstname','billing_lastname','billing_address','billing_city','billing_zip_code','billing_email');

   var error_array = new Array('Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Zip Code','Billing Email');

   for (var i=0; i<input_array.length; i++) {
      var source = prefix0+input_array[i];          
      if (frm.elements[source].value.length == 0) {
         alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' can not be empty!');
         frm.elements[source].focus();
         return false;
      }
      if  (input_array[i] == 'billing_email') {
         if (!validEmail(frm.elements[source].value)){
            alert(error_array[i].substr(0,1).toUpperCase()+error_array[i].substr(1)+' has wrong format ');
            frm.elements[source].focus();
            return false;
         } 
      }    
   }

   if (!frm.get_tos.checked) {
      alert("Please read \"Term of Sale\" and click continue.")
      return false;
   }

   return true;
}

function ValidJoin(frm){
   if (frm.elements['get_name'].value.length == 0 || frm.elements['get_name'].value == 'Your name'){
      alert('Please enter a name.');
      frm.elements['get_name'].focus();
      return false;
  
   }

   if (!(validEmail(frm.elements['get_email'].value))) { 
      alert('Please enter a valid email address in the form of email@host.tag.');
      frm.elements['get_email'].focus();
      return false;
   }
   return true;
}

function ValidContact(frm){
   if (frm.elements['get_name'].value.length == 0){
      alert('Please enter a Name.');
      frm.elements['get_name'].focus();
      return false;  
   }

   if (!(validEmail(frm.elements['get_email'].value))) { 
      alert('Please enter a valid email address in the form of email@host.tag.');
      frm.elements['get_email'].focus();
      return false;
   }

   if (frm.elements['get_comments'].value.length == 0){
      alert('Please enter your comments.');
      frm.elements['get_comments'].focus();
      return false;  
   }

   if (frm.elements['get_sign_crypt'].value.length == 0){
      alert('Please enter Access Code.');
      frm.elements['get_sign_crypt'].focus();
      return false;
  
   }

   return true;
}

function check_form(){
    if (!document.loginform.username.value) {
      alert ("Please enter your username");
      document.loginform.username.focus();
      return false;
    }
    if (!document.loginform.password.value) {
      alert ("Please enter your password");
      document.loginform.password.focus();
      return false;
    }
    return true;
}

function numbersonly(e) {
	var key;
	var keychar;

	if (window.event)
	key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
		return true;

	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();

	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		return true;

	else if ((("0123456789").indexOf(keychar) > -1))
		return true;
	else
		return false;
}


