// Copyright (c) 1999-2003 Cyber-dynamics Inc. All Rights Reserved

function showH(iName,iShow) {
 var oDiv,oDiz,sCon="#990000", sCoff="#000088"; 
 if(document.layers){oDiz=document.all[iName+"z"].style;oDiv=document.all[iName].style;}
 else{if(document.all){oDiz=document.all[iName+"z"].style;oDiv=document.all[iName].style;}
 else{if(document.getElementById){oDiz=document.getElementById(iName+"z").style;oDiv=document.getElementById(iName).style;}}}
 oDiz.visibility=iShow?"visible":"hidden";// oDiv.background=iShow?sCon:sCoff;
}
function sw(i,imgn){if(img[i]){if(img[i].src){document[imgn].src=img[i].src;}}}
function clickClear(oMe,sVal) {if (oMe.value==sVal){oMe.value='';}}


function submitSub() {
var f=document.newsletterActions,sErr='';
 if ((badEmail(f.Email.value))||(f.Email.value=='you@yourhost.com')){sErr += ', Email'}
 if(sErr){alert('Please check the following entries and resubmit:\n'+sErr.substr(2));
 }else{
  if (popper) {if (! popper.closed) {popper.close();}}
  popUp('SCUBAdownload.html',100,100,220,350);
  tellWait();
  f.title.value=document.title;
  f.target="popper";
  f.submit();
  }
  return false;
}

function tellWait() {var s="<html><head><title>Downloading - please wait</title></head><body bgcolor='#f5f9fc'><p style='text-align:center;font-family:Arial,Helvetica,sans-serif;font-size:11px;'><br /><br /><b>D O W N L O A D I NG</b><br /><br />Please Wait</p></body></html>";
popper.document.open;popper.document.write(s);popper.document.close;}

function sStatus(sStr) {window.status=sStr;document.returnValue=true;}
var popper; function popUp(url,pLeft,pTop,pWidth,pHeight){var str='left='+pLeft+',top='+pTop+',width='+pWidth+',height='+pHeight+',resizable=no,scrollbars=no';url=url; 
popper=window.open(url,"popper",str);if (!popper.opener){popper.opener = self;}if (popper.focus != null) {popper.focus();}return false;}
var srchr; function srchUp(url){var str='left=0,top=0,width=450,height='+(screen.height-100)+',resizable=yes,scrollbars=yes';url=url; 
srchr=window.open(url,"srchr",str);if (!srchr.opener){srchr.opener = self;}if (srchr.focus != null) {srchr.focus();}return false;}
function mSt(s) {window.status=s;document.returnValue=true;}
function bookM(){if (document.all){var uRL=self.location.href,txt=self.document.title;window.external.AddFavorite(uRL,txt);}else{alert("Please click OK then press CTRL-D");}}
function homeP(){if (document.all){document.all[0].style.behavior='url(#default#homepage)';document.all[0].setHomePage(self.location.href);}else{alert("Please click OK then View/Options or Parameters and set Current Page as Home Page");}}
function printP(){if (parseInt(navigator.appVersion)>=4){window.print();}else{alert("This action is not supported by your browser\nPlease select File/Print");}}
function pDate() {
var monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var dayNames=new Array("Sun","Mon","Tues","Wednes","Thurs","Fri","Satur");
var now=new Date(),yr = now.getYear();if (yr<1900){yr+=1900;}
document.write(dayNames[now.getDay()]+"day, ");document.write(monthNames[now.getMonth()]+" "+now.getDate()+", "+yr);}
function getTime() {
 var time=new Date(); time.setTime(time.getTime());
 var iHr=time.getHours(),iMin=time.getMinutes(),iSec=time.getSeconds(),
 tp =""+((iHr>12)?iHr-12:iHr); 
 tp+=((iMin<10)?":0":":")+iMin; tp+=((iSec<10)?":0":":")+iSec;tp+=(iHr>=12)?" PM":" AM";
 document.fm.WTclock.value = tp; var i=setTimeout("getTime()",1000);
}
window.defaultStatus=document.title;
function mSt(s) {window.status=s;document.returnValue=true;}

var supp;
function zoom(url,w,h,n,s) {
url= '/KL286mediaZoom.shtml?ID='+url+'&w='+w+'&h='+h+'&name='+n+'&sub='+s;
supp=window.open(url,"popper","left=50,top=5,width=550,height=460,resizable=no");
if (!supp.opener){supp.opener = self;}
if (supp.focus != null) {supp.focus();}
return false;}


// FORMS

function checkForm(oForm){var err = "",f;if (oForm) {f=oForm} else {if (document.inquiry){f=document.inquiry;}else{if(document.admanager){f=document.admanager;}}}
var i,s,fE=f.elements,iFound=0;
	for(i=0;i<fE.length;i++){ 
		if  (!((fE[i].name.substr(0,1) == '_') || (fE[i].name.substr(1,1) == '_'))) {
			if  ( ((fE[i].value.indexOf('>') > -1) || (fE[i].value.indexOf('<') > -1)) || (fE[i].value.indexOf('|') > -1) ) {
				alert('Please do not use special characters such as  < > or |\nNote to spammers: you cannot use this form for spamming');iFound = 1;fE[i].focus();break;
		}	}
		if (iFound == 0) {
			var aEmails = new Array(); aEmails = fE[i].value.split("@");if (aEmails.length > 4) {
				alert('Too many @ signs. Please use a + instead if necessary.\nNote to spammers: you cannot use this form for spamming');
				iFound = 1;fE[i].focus();break;	
		}	} 
		if (iFound == 0) {
			var aHTTP = new Array(); aHTTP = fE[i].value.split(/http\:\/\//);if (aHTTP.length > 4) {
				alert('Too many URLs. Please amend.\nNote to spammers: you cannot use this form for spamming or posting links.');
				iFound = 1;fE[i].focus();break;	
	}	}	} 
if(iFound==0){
	iFields = new Array;if(f._required){iFields = f._required.value.split(",");}
	else if(f.i_required){iFields = f.i_required.value.split(",");}
	for (var i=0;i<iFields.length;i++){if(iFields[i].length>1){
if(iFields[i].indexOf("Email")>-1){if(badEmail(f[iFields[i]].value)) {err+=", "+iFields[i];}}else{if (badField(f[iFields[i]].value,2)){err+=", "+iFields[i];}}}}
if(err){alert("Please check the following entries and then submit this form:\n"+err.substr(2));return false;}else{
	if ((f.i_antiSpamDevice) && (cdAntiSpamCheck(f) == 0)) {
		alert('Please confirm the security code.');
		f.i_antiSpamCheck.focus();
	} else {	
		f.title.value=document.title;
		f.submit();
	}}}
	return false;
}

function cdSwapAntiSpam(sImage,sSRC1,sSRC2) {
	if (document.getElementById){
		var img = document.getElementById(sImage);
		if(img.src.indexOf(sSRC1)>-1) {
				document.getElementById(sImage).src=sSRC2;				
			}else {
				document.getElementById(sImage).src=sSRC1;
}	}	}	

function cdAntiSpamCheck(sFormID){
	var i=0,j=0,k=4,s = sFormID.i_antiSpamCheck.value;
	if (s.length==5) {
		for (j=0;j<4;j++){i = i + (k * s.charAt(j));k--;}
		if ((i%11) == s.charAt(4)) {
			return(1);
	}	}
		return(0);
}

function clickClear(oMe,sVal) {if (oMe.value==sVal){oMe.value='';}}
function badEmail(str){if (isBlank(str)||(str.indexOf("@")==-1)||(str.indexOf(".")==-1)||(str.length<6)){return true}else{return false}}	 
function badField(str,minlength){if(isBlank(str)||(str.length<minlength)){return true}else{return false}}	 
function isBlank(str){if(str.length==0){return true};for(i=0;i<=str.length-1;i++){if(str.charAt(i)!=" "){return false}}return true;}
