function confirm_del() {
  var reply = confirm("This will permanantly delete this record! You can\'t restore it in future.");

  if (reply) {
     return true;
  } else {
     return false;
  }
}


function popUpImg(url, pageWidth, pageHeight, title) {
    var args = "width=" + (pageWidth + 20) + ",height=" + (pageHeight + 10) + "";
    var date = new Date();
    var now = date.getTime();
    var name = (now).toString(10);
    
    _w = window.open('',name,args);
    _w.document.open();
    _w.document.write("<html>\n<head><title>" + title + "</title>\n");
    _w.document.write("<meta http-equiv='imagetoolbar' content='no'>\n");
    _w.document.write("<link href='screen.css' type='text/css' rel='stylesheet'  media='screen' />\n");
    _w.document.write("<script language='javascript'><!--\n");
    _w.document.write("var i=0;\n");
    _w.document.write("function resize() {\n");
    _w.document.write("if (navigator.appName == 'Netscape') i=40;\n");
    _w.document.write("if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+100-i);\n");
    _w.document.write("self.focus();\n");
    _w.document.write("}\n");
    _w.document.write("//--></script></head>\n");
    _w.document.write("<body onload='resize();'>\n");
    _w.document.write("<table width='100%' border='0' cellpadding='0' cellspacing='0' style='height: 100%'>\n");
    _w.document.write("<tr>\n<td align='center' valign='middle'>\n");
    _w.document.write("<a href='javascript:window.close()'><img src='" + url + "' alt='Click to close' border='0' /></a>\n");
    _w.document.write("</td></tr>\n");
    _w.document.write("<tr><td align='center'><a href='javascript:window.close();' class='white'><img src='images/english/buttons/close.gif' border='0' /></a></td></tr></table>\n");
    _w.document.write("</body>\n</html>");
    _w.document.close();
}
                                                



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 doPreview(param1, param2) {

  if (dom) {
    var src = document.getElementById(param1).value; 
  } else if (ie) {
    var src = document.all[param1].value; 
  }

  if (src.charAt(1)==":") src = "file:/" + src;

  if (dom) {
    document.getElementById(param2).src=src; 
  } else if (ie) {
    document.all[param2].src = src; 
  }
 
}



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();
   myexpires.setTime(myexpires.getTime() + 5000);
   mycookie = mycookie + "; myexpires=" + myexpires.toGMTString();
   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 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];
   }
   if ((y=MM_findObj('item_ref1'))!=null){
     y.href='item.php?id='+a[4];
   }
   if ((y=MM_findObj('item_ref2'))!=null){
     y.href='item.php?id='+a[4];
   }
}
function openWin($url) {
  msgWindow= window.open($url,"displayWindow","width=780,height=600,status=no,toolbar=no,menubar=no,scrollbars=yes");
}
function closeIt(){
  window.close();
}

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 viewform(m, w, h) {
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
	      
   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='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
		      
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
function viewformclose(m, w, h) {
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
	      
   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='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
		      
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
   win.alert('!!!!!');
   win.document.write('window.close();');
}
function viewform2(m, w, h) {
//   var w = 300;
//   var h = 380;
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
	      
   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='+scroll;
   settings = settings + ',resizable=no,maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
		      
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
function viewformi(m, w, h,r) {
   var scroll = 'yes';
   var settings;
   var LeftPosition;
   var TopPosition;
   var win;
	      
   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
   if (r='')
      r='no';
   settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
   settings = settings + ',resizable='+ r + ',maximize=no,status=no,toolbar=no,directories=no,menubar=no,location=no';
		      
   win = window.open(m, 'pre', settings);
   win.name = 'name';
   win.focus();
}
function ViewOtherImg(name,main) {

   tmp_src = document.images[main].src;
   document.images[main].src = document.images[name].src;
   document.images[name].src = tmp_src;   
  
}				 

function conf() {
  var reply = confirm("This will permanantly delete this record! You can\'t restore it in future.");

  if(reply) {
     return true;
   } else {
     return false;
   }
}								  

function inputComment(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('name','email','comment');
   var error_array = new Array('Name','Email Address','Comment');


   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;
      }
   }

   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 inputSchedule(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('title','description');
   var error_array = new Array('Title','Description');


   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 inputLink(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('link_name','link_http');
   var error_array = new Array('Link Name','URL');


   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 inputDocument(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('title','filename');
   var error_array = new Array('Document Title','Document');


   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 inputEvent(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('date_from','place','city','address','zip_code');
   var error_array = new Array('Date From','Place','City','Street Address','Zip Code');


   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;
      }
   }
/*
   if (frm.elements['get_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_zip_code'].value);
      if (!res) {
         alert('Please enter a valid zip code');
         frm.elements['get_zip_code'].focus(); 
         return false;
      }
   }
*/  
   return true;
}
  
function inputCustomInfoForBackground(frm) {
   var prefix0 = 'get_';

   

   var input_array = new Array('city','address_1','address_2','zip_code');
   var error_array = new Array('City','Address 1','Address 2','Zip Code');

   if (!frm.elements['get_agreement'].checked) {

      alert('You must agree with our conditions to continue');
      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;
   }
   
   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_user_name'].value.length < 6) {
      alert('Username must be more then 6 character');
      frm.elements['get_user_name'].focus();
      return false;
   }
    
   if (frm.elements['get_passw_1'].value.length < 6) {
      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_passw_2'].value.length < 6) {
      alert('Please enter a Re-Password.');
      frm.elements['get_password_2'].focus();
      return false;
   }
   
   if (frm.elements['get_passw_1'].value != frm.elements['get_passw_2'].value) {
      alert('Your password confirmation does not match the original password');
      frm.elements['get_password_2'].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 inputCustomInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('city','address','zip_code');
   var error_array = new Array('City','Street Address','Zip Code');

   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;
   }

   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_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;
   }

   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;
      }
   }
/*
   if (frm.elements['get_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_zip_code'].value);
      if (!res) {
         alert('Please enter a valid zip code');
         frm.elements['get_zip_code'].focus(); 
         return false;
      }
   }
*/  
   return true;
}

function inputCustomInfo2(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('city','address','zip_code');
   var error_array = new Array('City','Street Address','Zip Code');

   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;
      }
   }
/*
   if (frm.elements['get_zip_code'].value) {
      myreg = new RegExp("^\\d+$");
      res = myreg.test(frm.elements['get_zip_code'].value);
      if (frm.elements['get_zip_code'].value == '0') res = 0;
      if (!res) {
         alert('Please enter a valid zip code');
         frm.elements['get_zip_code'].focus(); 
         return false;
      }
   }
*/ 
  
   return true;
}

function inputAdminCustomInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('first_name','last_name','email','address','city','zip_code');
   var error_array = new Array('First Name','Last Name','Email Address','Street Address','City','Zip Code');

   if (frm.elements['get_username'].value.length == 0) {
      alert('Please enter Username');
      frm.elements['get_username'].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;
   }

   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;
      }
   }

   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_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_zip_code'].value);
      if (!res) {
         alert('Please enter a valid zip code');
         frm.elements['get_zip_code'].focus(); 
         return false;
      }
   }
*/  
   return true;
}

function inputAdminCustomInfo2(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('username','password','first_name','last_name','email','address','city','zip_code');
   var error_array = new Array('@ALERT_USERNAME@','Password','First Name','Last Name','Email Address','Street Address','City','Zip Code');

   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;
      }
   }

   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_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_zip_code'].value);
      if (!res) {
         alert('Please enter a valid zip code');
         frm.elements['get_zip_code'].focus(); 
         return false;
      }
   }
*/  
   return true;
}

function changePswd(frm) {
   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;
   }

   return true;
}

function inputEmail(frm) {
   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 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 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[0].width+100;
    h = document.images[0].height+115-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 useCustomInfo2(chck, frm, prefix, prefix2) {
   var prefix0 = 'get_';
   var input_array = new Array('firstname','lastname','email','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;
      }

      TermChange(frm.get_shipping_ref_state, frm.get_ref_shipping_term);
   }
   return true;
}

function useBillingInfo(chck, frm, prefix, prefix2) {
   var prefix0 = 'get_';
   var input_array = new Array('firstname','lastname','email','address','city','zip_code','ph01','ph02','ph03','ph04');
   var select_array = new Array('ref_country');

   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 OrderCheckout(frm) {
 for (var i=0; i<frm.elements.length; i++)
   if(frm.elements[i].name  ==  'ref_order'){
      if(frm.elements[i].value > 0 )
         frm.submit();
         exit;
   }    
   alert('Please calculate order');
   return false;
}
*/
function inputOrderInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('billing_firstname','billing_lastname','billing_email','billing_address','billing_city','billing_zip_code',
      'shipping_firstname','shipping_lastname','shipping_email','shipping_address','shipping_city','shipping_zip_code'
   );

   var error_array = new Array('Billing First Name','Billing Last Name','Billing Email Address',
      'Billing Street Address','Billing City','Billing Zip Code',
      'Shipping First Name','Shipping Last Name','Shipping Email Address',
      'Shipping Street Address','Shipping City','Shipping Zip Code'
   );

      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;
         }
      }
/*
   if (frm.elements['get_billing_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_billing_zip_code'].value);
      if (!res) {
         alert('Please enter a valid Billing Zip code');
         frm.elements['get_billing_zip_code'].focus(); 
         return false;
      }
   }

   if (frm.elements['get_shipping_zip_code'].value) {
      myreg = new RegExp("^\\d{5}$");
      res = myreg.test(frm.elements['get_shipping_zip_code'].value);
      if (!res) {
         alert('Please enter a valid Shipping Zip code');
         frm.elements['get_shipping_zip_code'].focus(); 
         return false;
      }
   }
*/
   return true;
}

/*
function inputOrderInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('billing_firstname','billing_lastname','billing_address','billing_city','billing_zip_code',
      'shipping_firstname','shipping_lastname','shipping_email','shipping_address','shipping_city','shipping_zip_code'
   );

   var error_array = new Array('Billing Firstname','Billing Lastname','Billing Address','Billing City','Billing Zip Code',
      'Shipping Firstname','Shipping Lastname','Shipping Email','Shipping Address','Shipping City','Shipping Zip Code'
   );

      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 (frm.elements['get_billing_zip_code'].value) {
         myreg = new RegExp("^\\d+$");
         res = myreg.test(frm.elements['get_billing_zip_code'].value);
         if (frm.elements['get_billing_zip_code'].value == '0') res = 0;
         if (!res) {
            alert('Please enter a valid billing zip code');
            frm.elements['get_billing_zip_code'].focus(); 
            return false;
         }
      }

      if (frm.elements['get_shipping_zip_code'].value) {
         myreg = new RegExp("^\\d+$");
         res = myreg.test(frm.elements['get_shipping_zip_code'].value);
         if (frm.elements['get_shipping_zip_code'].value == '0') res = 0;
         if (!res) {
            alert('Please enter a valid shipping zip code');
            frm.elements['get_shipping_zip_code'].focus(); 
            return false;
         }
      }

   return true;
}
*/
function validAddBasket(frm) {
   if ((frm.elements['qty'].value.length == 0) || (frm.elements['qty'].value == 0)) {
      alert('Quantity should be greater than 0');
      frm.elements['qty'].focus(); 
      return false;  
   } 
   myreg = new RegExp("^\\d+$");
   res = myreg.test(frm.elements['qty'].value);
   if (!res) {
      alert('Quantity should be digit');
      frm.elements['qty'].focus(); 
      return false;
   }

   return true;
}

function validAddBasketList(frm) {         
   var qty = frm.elements['qty_var'].value; 
   if ((frm.elements[qty].value.length == 0) || (frm.elements[qty].value == 0)) {
      alert('Quantity should be greater than 0');
      frm.elements[qty].focus(); 
      return false;  
   } 
   myreg = new RegExp("^\\d+$");
   res = myreg.test(frm.elements[qty].value);
   if (!res) {
      alert('Quantity should be digit');
      frm.elements[qty].focus(); 
      return false;
   }
   frm.submit(); return false; 
}

function check_basket_quantity(frm) {
   var i;
   var sum;
   
   for (i=0; i < frm.elements.length; i++) {
      if (frm.elements[i].type == "text") {
         if ((frm.elements[i].value.length == 0) || (frm.elements[i].value == 0)) {
            alert('Quantity should be greater than 0');
            frm.elements[i].focus(); 
            return false;  
         } 
         myreg = new RegExp("^\\d+$");
         res = myreg.test(frm.elements[i].value);
         if (!res) {
            alert('Quantity should be digit');
            frm.elements[i].focus(); 
            return false;
         }
       
      }
   }
   return true
}

function inputCategoryInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('name');
   var error_array = new Array('Category Name');

   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 inputItemInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('name');
   var error_array = new Array('Item Name');

   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 inputItemModifInfo(frm) {
   if (frm.price.value.length == 0) {
      alert('Please enter Price');
      frm.price.focus();
      return false;
   }
 
   return true;
}
*/
function inputItemModifInfo(frm) {
   if (frm.get_description.value.length == 0) {
      alert('Please enter Description');
      frm.get_description.focus();
      return false;
   }

   if (frm.get_price.value.length == 0) {
      alert('Please enter Price');
      frm.get_price.focus();
      return false;
   }
 
   return true;
}
/*
function inputPropertyInfo(frm) {
   if (frm.get_display_name.value.length == 0) {
      alert('Please enter Display Name');
      frm.get_display_name.focus();
      return false;
   }
 
   return true;
}

function inputPropertyValueInfo(frm) {
   if (frm.get_value.value.length == 0) {
      alert('Please enter Property Value');
      frm.get_value.focus();
      return false;
   }
 
   return true;
}
*/
function inputEmailInfo(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('name', 'subject', 'sender', 'body');
   var error_array = new Array('Email Name', 'Email Subject', 'Email Sender', 'Email Body');

   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 inputShipping(frm) {
   if (frm.get_name.value.length == 0) {
      alert('Please enter Shipping Type');
      frm.get_name.focus();
      return false;
   }
 
   return true;
}
*/
function CheckOrderForm(frm) {
                
   var input_array = new Array('cardnum', 'cvc');
   var error_array = new Array('Credit Card Number', 'CVC');

   for (var i=0; i<input_array.length; i++) {
      var source = input_array[i];
      if (frm.elements[source].value.length == 0) {
         alert('Please enter '+error_array[i]);
         frm.elements[source].focus();
         return false;
      }
   }

   if (frm.elements['cardnum'].value) {
      myreg = new RegExp("^[ ,\/,\\d]{8,19}$");
      res = myreg.test(frm.elements['cardnum'].value);
      if (!res) {
         alert('Please enter a valid Credit Card Number');
         frm.elements['cardnum'].focus(); 
         return false;
      }
   }
 
   return true;
}

function ChangeGroup(frm) {
   if (frm.get_ref_group.value) {
      frm.get_price.disabled=true;
   } else {
      frm.get_price.disabled=false;
   }
   return true;
}

function inputContactInfo(frm) {

   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_message'].value.length == 0) {
      alert('Please enter Your Message');
      frm.elements['get_message'].focus();
      return false;
   }
  
   return true;
}

function inputEnrollment(frm) {
   var prefix0 = 'get_';
   var input_array = new Array('company_name','address','phone','fax','email','contact1');
   var error_array = new Array('Company Name','Address','Phone', 'Fax','E-mail','Authorized Contacts');


   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;
      }
   }

   if (!frm.elements['get_type_industry_government'].checked && !frm.elements['get_type_industry_private'].checked) {
      alert('Type of Industry?');
      frm.elements['get_type_industry_government'].focus();
      return false;
   }

   if (!frm.drug_testing_policy[0].checked && !frm.drug_testing_policy[1].checked) {
      alert('If private industry, do you have a drug testing policy?');
      frm.drug_testing_policy[0].focus();
      return false;
   }


   var input_array = new Array('results_mail','billing_address', 'billing_contact','billing_phone','billing_fax','billing_email');
   var error_array = new Array('Mail', 'Address','Contact Person','Telephone','Fax','E-mail');
/*
   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;
}

