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_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_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_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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//------------------

function isBlank(s) {
		for (var i=0; i < s.length; i++) {
			c = s.charAt(i);
			if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
		}
		if (s != "") return false;
		return true;
}

function isEmail(s) {
	if (s != null) {
		var pos1 = s.indexOf('@');
		var pos2 = s.indexOf('.');
		invalid_ch = "\/#?!, ";

			for (var i=0;i<s.length;i++) {  // check for invalid chars
			if(invalid_ch.indexOf(s.charAt(i)) != -1) {
				return false;				
			}
		}
		if ((pos1 == -1) || (pos2 == -1) || (s.indexOf('@', pos1+1) != -1)) {
			return false;
		}
		return true;
	}
}

function Strip(str) {
	str = str.replace("__", "");
	str = str.replace("_NUM", "");
	return str;
}

function validate(f) {
	var msg = "";
	var errors = "";
	var emptyFields = "";
	var error1 = -1;

	for (var i=0; i<f.length; i++) {
		var e = f.elements[i];
		if (((e.type == "text") || (e.type == "textarea") || (e.type == "password") || (e.type == "select-one") || (e.type == "file")) && (e.name.indexOf("__") != -1)) {
			if ((e.value == null) || (e.value == "") || isBlank(e.value)) {
				emptyFields += "\n- "+ Strip(e.name);
				if (error1 == -1) error1 = i;
				continue;
			}
		}
		if ((e.name.indexOf("email") != -1) && (!isBlank(e.value))) {
			var email = e.value;
			if (!isEmail(email)) {
				errors += "- Invalid email address format.\n";
				if (error1 == -1) error1 = i;
			}
		}
		if ((e.name.indexOf("_NUM") != -1) && (!isBlank(e.value)) && (isNaN(e.value))) {
			errors += "- Non-numeric: " + Strip(e.name) + ".\n";
			if (error1 == -1) error1 = i;
		}
		if ((e.name.indexOf("date") != -1) && (!isBlank(e.value))) {
			var fdate = e.value;
			if (!Date.parse(fdate)) {
				errors += "- Please enter a valid "+ Strip(e.name) +"!\n";
				if (error1 == -1) error1 = i;
			}
		}
	}
	if (emptyFields) {
		msg += "The following required field(s) is(are) missing: "+ emptyFields + "\n\n";
	}
	if (errors) {
		msg += "Please correct the followng error(s):\n"+errors;
	}
	if ((errors) || (emptyFields)) {
		alert(msg);
		if ((f.elements[error1].type == "text") || (f.elements[error1].type == "textarea")) {
			f.elements[error1].select();
			f.elements[error1].focus();
		}
		else {
			f.elements[error1].focus();
		}
		return false;
	}
	if ((!emptyFields) && (!errors)) return true;
}

<!-- START toggle
// downloaded from Vic Phillips website - http://www.vicsjavascripts.org.uk
// Initialised by a <BODY> or window onload event call
// e.g.
// <body onload="zxcInitQA('section_0','cls1','cls2');zxcInitQA('section_1','cls1','cls2',true);" >
// where:
// parameter 0 = the unique ID name of the parent <DIV>. (string)
// parameter 1 = the class rule of the inactive question <DIV>. (string)
// parameter 2 = the class rule of the active question <DIV>. (string)
// parameter 3 = (optional) will hide all other answer <DIV>s. (true or omit)
//


function zxcInitQA(zxcid,zxccls1,zxccls2,zxctog){
var zxcobj=document.getElementById(zxcid);
var zxcchlds=zxcobj.childNodes;
zxcobj.ary=[[zxcid,zxccls1,zxccls2,zxctog]];
var zxcary=[]
for (var zxc0=0;zxc0<zxcchlds.length;zxc0++){
if (zxcchlds[zxc0].tagName=='DIV'){
zxcary.push(zxcchlds[zxc0]);
}
}
for (var zxc1=1;zxc1<zxcary.length;zxc1+=2){
if (zxcary[zxc1].tagName=='DIV'){
zxcobj.ary.push([zxcary[zxc1-1],zxcary[zxc1]]);
zxcary[zxc1].style.display='none';
zxcAddEvt(zxcary[zxc1-1],'zxcToggleQA','click');
zxcary[zxc1-1].className=zxccls1;

}
}
}

function zxcToggleQA(){
var zxcary=zxcFndAry(this);
if (!zxcary){ return; }
for (var zxc0=1;zxc0<zxcary.length;zxc0++){
if (zxcary[zxc0][0]==this){
zxcary[zxc0][1].style.display=(zxcary[zxc0][1].style.display=='none')?'':'none';
zxcary[zxc0][0].className=(zxcary[zxc0][0].className==zxcary[0][1])?zxcary[0][2]:zxcary[0][1];
}
}
if (zxcary[0][3]){
for (var zxc1=1;zxc1<zxcary.length;zxc1++){
if (zxcary[zxc1][0]!=this){
zxcary[zxc1][1].style.display='none';
zxcary[zxc1][0].className=zxcary[0][1];
}
}
}
}

function zxcQAAllNone(zxcid,zxcan){
var zxcobj=document.getElementById(zxcid);
if (!zxcobj){ return; }
var zxcary=zxcobj.ary;
if (!zxcary){ return; }
for (var zxc0=1;zxc0<zxcary.length;zxc0++){
zxcary[zxc0][1].style.display=zxcan||'';
zxcary[zxc0][0].className=(zxcary[zxc0][1].style.display=='')?zxcary[0][2]:zxcary[0][1];
}
}

function zxcFndAry(zxcobj){
while (zxcobj.parentNode){
if (zxcobj.ary){ return zxcobj.ary; }
zxcobj=zxcobj.parentNode;
}
return false;
}

function zxcEventAdd(zxco,zxct,zxcf) {
if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
else {
var zxcPrev=zxco["on" + zxct];
if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
else { zxco['on'+zxct]=zxco[zxcf]; }
}
}


var zxcEvt=0;

function zxcAddEvt(zxco,zxcfun,zxcevt){
if (zxco['zxc'+zxcfun+zxcevt]){ return; }
zxco['zxcaddEvt'+zxcEvt]=window[zxcfun];
zxco['zxc'+zxcfun+zxcevt]=true;
zxcEventAdd(zxco,zxcevt,'zxcaddEvt'+zxcEvt);
zxcEvt++;
}


//END Toggle -->

function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
 	alert("Invalid email format")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
alert("Invalid email format.")
    return false
}


var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
  
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Please enter valid email address")
		return false
	    }
    }
    return true
}


var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Please enter valid email address")
    return false
}


var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
  
   alert("Invalid email format")
   return false
}


if (len<2) {
   var errStr="Invalid email format"
   alert(errStr)
   return false
}
return true;
}

/* DVD */
function isBlank(s) {
		for (var i=0; i < s.length; i++) {
			c = s.charAt(i);
			if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
		}
		if (s != "") return false;
		return true;
}

function isEmail(s) {
	if (s != null) {
		var pos1 = s.indexOf('@');
		var pos2 = s.indexOf('.');
		invalid_ch = "\/#?!, ";

			for (var i=0;i<s.length;i++) {  // check for invalid chars
			if(invalid_ch.indexOf(s.charAt(i)) != -1) {
				return false;				
			}
		}
		if ((pos1 == -1) || (pos2 == -1) || (s.indexOf('@', pos1+1) != -1)) {
			return false;
		}
		return true;
	}
}

function Strip(str) {
	str = str.replace("__", "");
	str = str.replace("_NUM", "");
	return str;
}

function validate(f) {
	var msg = "";
	var errors = "";
	var emptyFields = "";
	var error1 = -1;

	var list = f.name;
	if (list.length == 0) {
		emptyFields += "\n- requests";
		if (error1 == -1) error1 = 0;
	}
	for (var i=0; i<f.length; i++) {
		var e = f.elements[i];
		if (((e.type == "text") || (e.type == "textarea") || (e.type == "password") || (e.type == "select-one") || (e.type == "select-multiple") || (e.type == "file")) && (e.name.indexOf("__") != -1)) {
			if ((e.value == null) || (e.value == "") || isBlank(e.value)) {
				emptyFields += "\n- "+ Strip(e.name);
				if (error1 == -1) error1 = i;
				continue;
			}
		}
		if ((e.name.indexOf("email") != -1) && (!isBlank(e.value))) {
			var email = e.value;
			if (!isEmail(email)) {
				errors += "- Invalid email address format.\n";
				if (error1 == -1) error1 = i;
			}
		}
		if ((e.name.indexOf("_NUM") != -1) && (!isBlank(e.value)) && (isNaN(e.value))) {
			errors += "- Non-numeric: " + Strip(e.name) + ".\n";
			if (error1 == -1) error1 = i;
		}
		if ((e.name.indexOf("date") != -1) && (!isBlank(e.value))) {
			var fdate = e.value;
			if (!Date.parse(fdate)) {
				errors += "- Please enter a valid "+ Strip(e.name) +"!\n";
				if (error1 == -1) error1 = i;
			}
		}
	}
	if (emptyFields) {
		msg += "The following required field(s) is(are) missing: "+ emptyFields + "\n\n";
	}
	if (errors) {
		msg += "Please correct the followng error(s):\n"+errors;
	}
	if ((errors) || (emptyFields)) {
		alert(msg);
		if ((f.elements[error1].type == "text") || (f.elements[error1].type == "textarea")) {
			f.elements[error1].select();
			f.elements[error1].focus();
		}
		else {
			f.elements[error1].focus();
		}
		return false;
	}
	if ((!emptyFields) && (!errors)) {
		for (var j=0; j < list.options.length; j++) {
			list.options[j].selected = true;
		}
		return true;
	}
}

function Remove() {
	var list = document.form1.requests;
	for (var i=0; i < list.options.length; i++) {
		if (list.options[i].selected) {
			if (confirm("Are you sure you want to delete selected item(s)?")) {
				document.form1.action = "order.asp?mode=delete";
				document.form1.submit();
				return;
			}
			else return;
		}
	}
	alert("Please select item to delete.");
}