//*  
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;

/***************************************************************************
							BROWSER DETECTION
***************************************************************************/
 

// Trick to dynamically get the file name of the displayed page.
// Hence the "file" argument is not needed.
    var homepage = 0; // default to not the home page
	var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
	var filenm = location.href.substring(dir.length,location.href.length+1);

// Have to use a slightly different page when it's the homepage since the index.html file
// is not in the /html directory.
	var homepage = 0;
    if (filenm == "index.html" || filenm == "index2.html"|| filenm == "www.plunketinc.com") homepage = 1
 	if (homepage) {
 	   imagedir = "images";
 	   htmldir = "html/";
 	}   
 	else {   
	   imagedir = "../images";
	   htmldir = "../html/";
	} 

if(document.images){
  	homeon 		= new Image(); homeon.src= imagedir + "/b-homeon.gif";
 	homeoff		= new Image(); homeoff.src= imagedir + "/b-homeoff.gif";
  	abouton 	= new Image(); abouton.src= imagedir + "/b-abouton.gif";
 	aboutoff	= new Image(); aboutoff.src= imagedir + "/b-aboutoff.gif";	
  	perfon 		= new Image(); perfon.src= imagedir + "/b-perfon.gif";
 	perfoff		= new Image(); perfoff.src= imagedir + "/b-perfoff.gif";	  	
  	techon 		= new Image(); techon.src= imagedir + "/b-techon.gif";
 	techoff		= new Image(); techoff.src= imagedir + "/b-techoff.gif"; 	
  	appron 		= new Image(); appron.src= imagedir + "/b-appron.gif";
 	approff		= new Image(); approff.src= imagedir + "/b-approff.gif"; 	
  	contacton 	= new Image(); contacton.src= imagedir + "/b-contacton.gif";
 	contactoff	= new Image(); contactoff.src= imagedir + "/b-contactoff.gif"; 

//* Form buttons 		 	
 	clearon 	= new Image(); clearon.src= imagedir + "/b-clearon.gif";	
  	clearoff	= new Image(); clearoff.src= imagedir + "/b-clearoff.gif";
	sendon	 	= new Image(); sendon.src= imagedir + "/b-sendon.gif";
  	sendoff		= new Image(); sendoff.src= imagedir + "/b-sendoff.gif"; 	
 }
 
function flipImg(imgNam,imgTyp,onoff){
  	if(document.images){ 	
 		document.images[imgNam].src=eval(imgTyp+onoff+'.src');
  	}
}
 
function copyright() {
//*******************************************************************************
//	Display a window with copyright info
//*******************************************************************************
 //   alert("homepage=" + homepage);
 	if (homepage) {
 	   cdir = "html/";
 	}   
 	else {   
	   cdir = "";
	} 
 
	window.open(cdir + "copyright.html", "newwin", "width=300,height=400,scrollbars=yes,status=yes,resizable=yes");
}

function copyright2() {
//*******************************************************************************
//	Display a window with copyright info from Homepage
//*******************************************************************************
	window.open("html/copyright.html", "newwin", "width=300,height=400,scrollbars=yes,status=yes,resizable=yes");
}
function doForm ( form ) {	
//******************************************************************************* 
//  Common rtn for pages with forms.
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var len;

//  Trick to dynamically get the file name of the displayed page.
 	var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
 	var thefile = location.href.substring(dir.length,location.href.length+1);
		
// To remove validation for testing, change one of the numbers to 0.
if (1 == 1) {

 

//*** NAME 
    fieldblank=true;
    minlength = 5;
    for (j=0; j < document.form0.Name.value.length; j++) 
    {
      if (document.form0.Name.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Name.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Name\n"}
 
 
//  Company 
 
	fieldblank=true;
	minlength = 3;
	for (j=0; j < document.form0.Company.value.length; j++) 
		{
	      if (document.form0.Company.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	if (document.form0.Company.value.length < minlength || fieldblank)
		{errormessage=errormessage+"Company\n"}      	
 	

//*** TEL 
	minlength = 10
    fieldblank=true
    for (j=0; j < document.form0.Telephone.value.length; j++) 
    {
      if (document.form0.Telephone.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Telephone.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Telephone\n"}

//*** EMAIL 
    if (document.form0.Email.value.length ==0 || document.form0.Email.value.indexOf('@', 0) == -1 || document.form0.Email.value.indexOf('.', 0) == -1) 
 	{errormessage=errormessage+"Email address\n"}  	
    
}  // end 1 = 1 test 

   if (errormessage!="") { alert (firstmessage + errormessage)}
   else { 
   	document.form0.sendemailto.value = "pci@plunkettinc.com";
   	document.form0.sendemailbcc.value = "paul@atlis.net";
  	document.form0.redirect.value = "http://www.plunkettinc.com/html/confirm.html";
  	document.form0.sendemailsubject.value = "PCI: Contact Us";
   	document.form0.sendemailfrom.value  = document.form0.Email.value;
  	document.form0.action = "http://www.atlis.net/asp/mailer.asp";
  	document.form0.method = "POST";
  	document.form0.submit();
	return(0);  
   }
   
} 	
 
function doClear ( form ) {	
 	document.form0.onReset = " return confirm('Are you sure that you want to clear all the data you have entered on this form?')";
//  	document.form0.method = "";
  	document.form0.reset();	
}	

function setCookie(name, value, expires, path, domain, secure) {
//*******************************************************************************
// Generic rtn to set a cookie.
//*******************************************************************************
       var curCookie = name + "=" + escape(value) +
           ((expires) ? "; expires=" + expires.toGMTString() : "") +
           ((path) ? "; path=" + path : "") +
           ((domain) ? "; domain=" + domain : "") +
           ((secure) ? "; secure" : "");
       document.cookie = curCookie;
}
function getCookie(name) {
//*******************************************************************************
// Generic rtn to get a cookie.
//*******************************************************************************
       var dc = document.cookie;
       var prefix = name + "=";
       var begin = dc.indexOf("; " + prefix);
       if (begin == -1) {
         begin = dc.indexOf(prefix);
         if (begin != 0) return null;
       } else
         begin += 2;
       var end = document.cookie.indexOf(";", begin);
       if (end == -1)
         end = dc.length;
       return unescape(dc.substring(begin + prefix.length, end));
     }  

function delCookie (name) {
//*******************************************************************************
// Delete a cookie.
//*******************************************************************************
	var expireNow = new Date();
	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}
        
function makeArray(){
    this.length = makeArray.arguments.length 
        for (var i = 0; i < this.length; i++)
        this[i + 1] = makeArray.arguments[i]
} 

function randNum (num) {
    var now = new Date();                                  
    var rand = Math.round(num * Math.cos(now.getTime()));  
    if (rand < 0) rand = - rand; if (rand == 0) rand++;        
    return rand;                                           
}

function nada() {
//*******************************************************************************
// Do Squat
//*******************************************************************************
//	return();
}