function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function newWindow(pURL, height, width, oldURL) {
	myURL = pURL;
	myheight = height;
	prevURL = oldURL;
	myWindow = window.open(myURL+'?prevURL='+prevURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width=' + width + ',height=' + myheight + ',top=100,left=100,x=100,y=100');
}
function newWindow2(pURL, width,  height) {
	myURL = pURL;
	myheight = height;
	myWindow = window.open(myURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width=' + width + ',height=' + myheight + ',top=100,left=100,x=100,y=100');
}
function newWindow3(pURL, width,  height) {
	myURL = pURL;
	myheight = height;
	myWindow = window.open(myURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width=' + width + ',height=' + myheight + ',top=100,left=100,x=100,y=100');
}
function newWindow4(pURL, width,  height) {
	myURL = pURL;
	myheight = height;
	myWindow = window.open(myURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + width + ',height=' + myheight + ',top=100,left=100,x=100,y=100');
}
function comparewin() {
	var myWindow = window.open("/products/compare.htm", "", 'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=745,height=600');
}
function openWindow(pURL)
{
	myURL = pURL;
	myWindow = window.open(myURL, "", 'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=400');
}
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
// Show/Hide functionality for specs in cart
function showHide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	if(obj.visibility=='visible' || obj.visibility=='show') 
		{
		obj.visibility='hidden'
		obj.display='none'
		}
	else 
		{
		obj.visibility='visible'
		obj.display='block'
		}
}
function showDiv(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.visibility='visible'
	obj.display='block'
}
function hideDiv(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
	obj.visibility='hidden'
	obj.display='none'
}
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("headernav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
function startList2() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("headernav");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
function BOXX_mtcDownload_GetURL(sURL, sPageTitle)
{
 MTCrp=MTCpn;
 MTCpt=sPageTitle;
 
 if (sURL.indexOf("http")==0 || sURL.indexOf("ftp")==0)
 {
  MTCpn=sURL;
 }
 else
 {
  MTCpn="http://" + sURL;
 }
 return (mtc4300s() + "&rd=1");
}
 
function LoadBuyersGuide() 
{
    window.open( BOXX_mtcDownload_GetURL("ftp://www.boxxtech.com/pub/WorkstationBuyersGuide_10.pdf", "Workstation Buyers Guide PDF") );
    //location.href="1workstations.asp";
}

/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
//script has been modified
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	var msg
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true
}

function isemail(theEmail){
	var s = theEmail;
	var ok = 1;
	//Check to make sure it is more than 6 characters in length
	if ((s.length < 7)){
		ok = 0;
	}
	//Check to make sure it is has an @ character and there is at least one character before it
	var at = s.indexOf('@');
	if (at < 1){
		ok = 0;
	}
	//Check to make sure it is has only one @ character
	if (at != s.lastIndexOf('@')){
		ok = 0;
	}
	//check to make sure that the @ is not followed by .
	var ck = s.lastIndexOf('.');
	if ((ck - at) == 1){
		ok = 0;
	}
	//Check to make sure there is at least one full stop after the @ character and the number of characters from the full stop to the end is between 2-5 characters in length
	if ((s.lastIndexOf('.') < (at+1)) || (s.lastIndexOf('.') > (s.length-3)) || (s.lastIndexOf('.') < (s.length-6))){
		ok = 0;
	}
	//Check to make suer there is only 1 . after the @
	if (s.charAt(s.lastIndexOf('.')-1) == '.'){
		ok = 0;
	}
	//Check to make sure there are no funny characters
	if ((s.indexOf(',') != -1) || 
		(s.indexOf(' ') != -1) || 
		(s.indexOf(';') != -1) || 
		(s.indexOf(':') != -1) || 
		(s.indexOf('?') != -1) || 
		(s.indexOf('/') != -1) || 
		(s.indexOf('"') != -1) || 
		(s.indexOf('\\') != -1) || 
		(s.indexOf("'") != -1) || 
		(s.indexOf('<') != -1) ||
		(s.indexOf('>') != -1) ||
		(s.indexOf('[') != -1) || 
		(s.indexOf(']') != -1)){
		ok = 0;
	}
	if (ok == 1){
	return true;}
	else
	{
	return false;}
}

function isProper(string) {
	if (!string) return false;
	var iChars = "*|,\":<>[]{}`\';()@&$#%!^";
	for (var i = 0; i < string.length; i++) {
		if (iChars.indexOf(string.charAt(i)) != -1)
		return false;
		}
	return true;
}
