function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.p) d.p=new Array();
   var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

//-->

/* 
 ****************************************************
 * Grabs month,year and day off client's pc and
  writes it to the page.
 ****************************************************
*/

	function MakeArray(n) {
		this.length = n
		return this 
		}
		monthNames = new MakeArray(12)
		monthNames[1] = "January"
		monthNames[2] = "Febuary"
		monthNames[3] = "March"
		monthNames[4] = "April"
		monthNames[5] = "May"
		monthNames[6] = "June"
		monthNames[7] = "July"
		monthNames[8] = "August"
		monthNames[9] = "September"
		monthNames[10] = "October"
		monthNames[11] = "November"
		monthNames[12] = "December"
		
		function customDateString(oneDate) {
			var theMonth = monthNames[oneDate.getMonth( ) + 1]
			var theFullYear = oneDate.getFullYear( ) 
			return theMonth + " "  /*+ "1,&nbsp;"*/+ theFullYear 
			}

/* 
 ****************************************************
 * CSS branching

 ****************************************************
*/


browser = navigator.appName;
ie = "Microsoft Internet Explorer";
netscape = "Netscape";
os = navigator.platform;
mac = 'MacPPC';
 

 if (document.getElementById) {
  document.write('<link rel="stylesheet" type="text/css" href="css/iepc.css" title="master" media="screen">');
}
else  if (browser == ie && os != mac) {
 document.write('<link rel="stylesheet" type="text/css" href="css/iepc.css" title="master" media="screen">');
  }
  else if (browser == netscape && os != mac) {
 document.write('<link rel="stylesheet" type="text/css" href="css/netmac.css" title="master" media="screen">');
 }
else if (browser == netscape && os == mac) {
 document.write('<link rel="stylesheet" type="text/css" href="css/netmac.css" title="master" media="screen">');
 }
else if (browser == ie && os == mac) {
 document.write('<link rel="stylesheet" type="text/css" href="css/netmac.css" title="master" media="screen">');
 }
else if (navigator.appName.indexOf("WebTV")){
 document.write ('<LINK REL="stylesheet" href="css/webtv.css" type="css/webtv.css" media="screen">');
}
else{
 document.write ('<LINK REL="stylesheet" href="css/unknown.css" type="css/unknown.css" media="screen">');
}

/* 
 ****************************************************
 * isNumeric
 * verifies it's a number
 ****************************************************
*/
  function isNumeric(numIn) {
    for (i=0;i<numIn.length;i++) {
      tempStr = numIn.substr(i,1)
      if (tempStr == "0" || tempStr == "1" || tempStr == "2" || tempStr == "3"
	    || tempStr == "4" || tempStr == "5" || tempStr == "6" || tempStr == "7"
	    || tempStr == "8" || tempStr == "9") {
	    tempStr = tempStr;
	  }else{
	  alert("Please enter only numbers.");
	    return false;
	  }
	}
	return true;
  }

/* 
 ****************************************************
 * valid800
 * Verify phone number for 800 nums w/out 1 and any
 * other chars
 ****************************************************
*/ 
  function valid800(phone){
    var tempStr;
    
    if (phone.length != 10 || phone.substr(0,1) != 8){
      return false
    }
    for (i=0;i<10;i++) {
      tempStr = phone.substr(i,1)
      if (tempStr == "0" || tempStr == "1" || tempStr == "2" || tempStr == "3"
	    || tempStr == "4" || tempStr == "5" || tempStr == "6" || tempStr == "7"
	    || tempStr == "8" || tempStr == "9") {
	    tempStr = tempStr
	  }else{
	    return false
	  }
	}
	return true
  }
  
/* 
 ****************************************************
 * validPhone
 * Verify phone number in xxxxxxxxxx,(xxx)xxx-xxxx,
 * xxx-xxx-xxxx, (xxx) xxx-xxxx
 * other chars
 ****************************************************
*/ 
  function validPhone(phone){
    var tempStr;
    
    if (phone.length != 10 && (phone.length <= 12 && phone.length >= 14)){
      return false;
    }else if (phone.length == 10) {
      //xxxxxxxxxx
      if (! isNumeric(phone)) {
        return false;
      }
    }else if (phone.length == 12) {
      //xxx-xxx-xxxx
      if (! isNumeric(phone.substr(0,3)) || phone.substr(3,1) != "-" ||
        ! isNumeric(phone.substr(4,3)) || phone.substr(7,1) != "-" ||
        ! isNumeric(phone.substr(8,4))) {
          return false;
      }
    }else if (phone.length == 13) {
      //(xxx)xxx-xxxx
      if (phone.substr(0,1) != "(" || ! isNumeric(phone.substr(1,3)) ||
        phone.substr(4,1) != ")" || ! isNumeric(phone.substr(5,3)) ||
        phone.substr(8,1) != "-" || ! isNumeric(phone.substr(9,4))) {
        return false;
      }
    }else if (phone.length == 14) {
      //(xxx) xxx-xxxx
      if (phone.substr(0,1) != "(" || ! isNumeric(phone.substr(1,3)) ||
        phone.substr(4,1) != ")" || phone.substr(5,1) != " " || ! isNumeric(phone.substr(6,3)) ||
        phone.substr(9,1) != "-" || ! isNumeric(phone.substr(10,4))) {
        return false;
      }
	}
	return true;
  }
    
/* 
 ****************************************************
 * validEmail
 * Verify to some extent email address 
 ****************************************************
*/
 function IsEmailValid(FormName,ElemName)
{
var EmailOk  = true
var Temp     = document.forms[FormName].elements[ElemName]
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   

if ((AtSym < 1) ||                     
    (Period <= AtSym+1) ||           
    (Period == Length ) ||            
    (Space  != -1))                 
   {  
      EmailOk = false
      alert('Please enter a valid e-mail address!')
      Temp.focus()
   }
return EmailOk
}
  
/* 
 ****************************************************
 * validPswd
 * Verify security code, 4 digits
 ****************************************************
*/ 
  function validPswd(password) {
    var tempStr;
	for (i=0; i<4; i++) {
	  tempStr = password.substr(i,1)
	  if (i==0) {
		if (tempStr =="*" || tempStr == "#" || tempStr == "0") {
		  return false
		}
	  }
	  if (tempStr == "0" || tempStr == "1" || tempStr == "2" || tempStr == "3"
	    || tempStr == "4" || tempStr == "5" || tempStr == "6" || tempStr == "7"
	    || tempStr == "8" || tempStr == "9" || tempStr == "*") {
	    tempStr = tempStr
	  }else{
	    return false
	  }
	}
	return true 
  } 

/* 
 ****************************************************
 * openNew
 * Open new window with specified URL and size
 ****************************************************
*/
  function openNew(urlIn,widthIn,heightIn){
    window.open(urlIn,"_blank","resizable=1,scrollbars=yes,width=" + widthIn + 
      ",height=" + heightIn);
  }
/* 
****************************************************
 * validZip
 * Verify zip code
 ****************************************************
*/ 
  function validZip(zip) {
    var tempStr;
    if (zip.length != 5 && zip.length != 10) {
      //if it isn't xxxxx or xxxxx-xxxx format
      return false;
    }else if (zip.length == 5) {
      if (!isNumeric(zip.substr(0,5))) {
        return false; 
      }
    }else if (zip.length == 10) {
      if (zip.substr(5,1) != "-" || ! isNumeric(zip.substr(6,4))) {
	  alert("Invalid Zip Code");
        return false;
      }
    } 
	return true; 
  } 
  
/* 
 ****************************************************
 * isValidDate
 * verifies it's a valid date
 ****************************************************
*/
  function isValidDate (myDate,sep) {
  // checks if date passed is in valid mm/dd/yyyy format
    
    if (myDate.length == 10) {
      if (myDate.substr(2,1) == sep && myDate.substr(5,1) == sep) {
        var month  = myDate.substr(0,2);
        var day = myDate.substr(3,2);
        var year  = myDate.substr(6,4);
        var test = new Date(year,month-1,day);
        if ((year == test.getFullYear()) && (month-1 == test.getMonth()) && (day == test.getDate())) {
          reason = '';
          return true;
        }else{
          reason = 'valid format but an invalid date';
          alert(reason)
          return false;
        }
      }else{
        reason = 'invalid separators';
        alert(reason)
        return false;
      }
    }else{
      reason = 'invalid length';
      alert(reason)
      return false;
    }
 }
  
/* 
 ****************************************************
 * openNew
 * Open new window with specified URL and size
 ****************************************************

  function openNew(urlIn,widthIn,heightIn){
    window.open(urlIn,"_blank","resizable=1,scrollbars=yes,width=" + widthIn + 
      ",height=" + heightIn);
  }
  */
  
  /* 
 ****************************************************
 * entervalue
 * requires a value entered in field
 ****************************************************
*/
  /* function enterValue()
{
if (document.form.this.value==""){
alert ("This is a required field")
}
else 
return true;
}*/


/* random image script
function getImage(dirStr)
	{ 
		imgSrc = new Array()

		imgSrc[0] = dirStr + "front.jpg";
		imgSrc[1] = dirStr + "front3.jpg";
		imgSrc[2] = dirStr + "front2.jpg";
		imgSrc[3] = dirStr + "front4.jpg";

		figureIt = Math.random() * 3;
		endNum = Math.round(figureIt);

		var imgString = "<img src=" + "\"" + imgSrc[endNum] + "\"" + " width=" + "\"" + "583" + "\"" + " height=" + "\"" + "211" + "\"" + ">";	
		return imgString;
	}
*/



function changeto(highlightcolor)
	{
		source=event.srcElement
		if (source.tagName=="TR"||source.tagName=="TABLE")
		return
		while(source.tagName!="TD")
		source=source.parentElement
		if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
		source.style.backgroundColor=highlightcolor
	}

function changeback(originalcolor)
	{
		if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
		return
		if (event.toElement!=source)
		source.style.backgroundColor=originalcolor
	}

function jumpto(x)
		{
			if (document.form1.jumpmenu.value != "null") 
				{
					document.location.href = x
				}
		}





