﻿//-- WINDOW FUNCTIONS --var win = new Array();var winCount = 0;//-- LAUNCH NEW WINDOW --function win_open(url,name,winArgs,focus,timeout){	if(winArgs == 'full'){winArgs = 'width='+document.body.clientWidth+',height='+document.body.clientHeight;}	if(winArgs == 'half'){winArgs = 'width='+document.body.clientWidth/2+','+document.body.clientHeight;}	eval('win['+winCount+'] = window.open(\''+url+'\',\''+name+'\',\'scrollbars=yes,resizable=yes,status=yes,'+winArgs+'\')');	if(focus == 'self'){ self.focus(); }else{ eval('win['+winCount+'].focus()'); }	if(timeout > 0){ setTimeout('win[winCount-1].close()',(timeout*1000)); }	winCount++;}//-- CLOSE ALL OPEN WINDOWS --function win_close(){	for(x = 0; x < winCount; x++){win[x].close();}}//-- WRITE TO WINDOW --function writeToWin(strText, intWidth, intHeight, intLeft, intTop){	if(strText.length > 0){		if(intWidth == ''){ intWidth = 580; }		if(intHeight == ''){ intHeight = 400; }		var newWin = window.open('', 'newWin', 'width='+ intWidth +',height='+ intHeight +',left='+ intLeft +',top='+ intTop +',resizable=yes,scrollbars=auto');		newWin.document.open();		newWin.document.write(strText);		newWin.document.close();	}else{		return_error('writeToWin', 'Missing strText parameter.');	}}//-- WRITE TO DIV --function writeToDiv(strText, strDIV){	if(strDIV != ''){		var curDiv = getObj(strDIV);		if(curDiv){			curDiv.innerHTML = strText;		}	}else{		return_error('writeToDiv', 'Missing strDIV parameter.');	}}//-- OBJECT FUNCTIONS --function getObj(objName){	var thisObj;	if(document.getElementById){		thisObj = document.getElementById(objName);	}else{		if(document.all){			thisObj = eval("document.all[\"" + objName + "\"]");		}	}	return thisObj;}function positionObj(objName, leftVal, topVal){	if((topVal != '') && (leftVal != '')){		var curObj = getObj(objName);		if(curObj){			curObj.style.position = 'absolute';			curObj.style.top = topVal;			curObj.style.left = leftVal;		}	}}function loadHTML(divName){	var divText = '';	var curObj = getObj(divName);	if(curObj){		divText = curObj.innerHTML;	}	return divText;}function return_error(funcName, errMessage){	alert('Error ('+ funcName +'):\n'+ errMessage);}//-- PRINT CONTAINER --function printData(template, winTitle, containerName){	var PageContents = loadHTML(containerName);	if(PageContents != ''){		PageContents = '<HTML><HEAD><TITLE>'+ unescape(winTitle) +'</TITLE><LINK rel="stylesheet" type="text/css" href="/templates/'+ template +'/styles.css"></HEAD><BODY onLoad="self.print();">'+ unescape(PageContents) +'</BODY></HTML>';		writeToWin(PageContents, 620, 460);	}}//-- FORM FUNCTIONS --var errors = 0;var formName = 'input';//-- CLEAR FORM --function clearForm(curForm){	var fieldType = '';	for(x = 0; x < curForm.length; x++){		fieldType = curForm.elements[x].type;		if((fieldType == 'text')||(fieldType == 'textarea')||(fieldType == 'password')){			curForm.elements[x].value = '';		}		if((fieldType == 'select-one')||(fieldType == 'select-multiple')){			curForm.elements[x].selectedIndex = 0;		}		if((fieldType == 'checkbox')||(fieldType == 'radio')){			curForm.elements[x].checked = false;		}	}}//-- SET SELECT --function set_select(field,value){	for(x = 0; x < eval('document.'+formName+'.'+field+'.length'); x++){		if(eval('document.'+formName+'.'+field+'['+x+'].value == '+ value)){			eval('document.'+formName+'.'+field+'.selectedIndex = '+x)		}	}}function set_field(name,value){eval('document.'+formName+'.'+name+'.value = "'+ value +'"');}//-- FORM VALIDATION ROUTINES --function new_test(){errors = 0;}function send_form(){	if(errors == 0){eval('document.'+formName+'.submit()');}}function raiseError(field,errorTxt,type){	errors++;	if(type == 1){ alert('ERROR: You must enter a valid value for '+ errorTxt +'.'); }	if(type == 2){ alert('ERROR: You must select a '+ errorTxt +' option.'); }	if(type == 3){ alert('ERROR: '+ errorTxt +' is not a valid date.'); }	if(type == 99){ alert('ERROR: '+ errorTxt); }	eval('document.'+formName+'.'+field+'.focus()');}function check_text(field,errorTxt){	if(errors == 0){		if(eval('document.'+formName+'.'+field+'.value == ""')){raiseError(field,errorTxt,1);}	}}function check_select(field,errorTxt){	if(errors == 0){		if(eval('document.'+formName+'.'+field+'.selectedIndex == 0')){raiseError(field,errorTxt,2);}	}}function check_box(field,errorTxt){	if(errors == 0){		if(! eval('document.'+formName+'.'+field+'.checked')){raiseError(field,errorTxt,2);}	}}function check_len(field,errorTxt,operator,length){	if(errors == 0){		var curFieldLength = eval('document.'+ formName +'.'+ field +'.value.length');		errorTxt += ' cannot be '+ operator +' '+ length +' characters; the current field length is '+ curFieldLength +'.';		if(eval(curFieldLength +' '+ operator +' '+ length)){raiseError(field,errorTxt,99);}	}}function check_str(field,errorTxt,target){	if(errors == 0){		var cStr = eval('document.'+formName+'.'+field+'.value');		if(cStr.indexOf(target) == -1){raiseError(field,errorTxt,1);}	}}function check_chr(field,errorTxt,target){	if(errors == 0){		var cStr = eval('document.'+formName+'.'+field+'.value');		if(cStr.indexOf(target) != -1){raiseError(field,errorTxt,1);}	}}function check_value(field,errorTxt,operator,target){	if(errors == 0){		if(eval('document.'+formName+'.'+field+'.value '+ operator +' '+ target)){raiseError(field,errorTxt,1);}	}}function check_email(field){	if(errors == 0){		var eStr = eval('document.'+formName+'.'+field+'.value');		check_str(field,'e-mail (missing "@")','@');		check_str(field,'e-mail (missing ".")','.');	}}function check_num(field,errorTxt){	if(errors == 0){		var cStr = eval('document.'+formName+'.'+field+'.value');		if(cStr - cStr != 0){raiseError(field,errorTxt,1);}	}}function check_date(field,errorTxt){	if(errors == 0){		var strDate = eval('document.'+formName+'.'+field+'.value');		var checkDate = new Date(strDate);		if((checkDate.getMonth() + 1) != strDate.substring(0,strDate.indexOf("/"))){raiseError(field,strDate,3);}	}}function replace_str(field,target,result){	eval('document.'+formName+'.'+field+'.value = document.'+formName+'.'+field+'.value.replace(/'+target+'/g, "'+result+'")');}//-- MENU DISPLAY FUNCTIONS --function windowShade(id){	var curLayer = getObj(id);	if(curLayer){		if(curLayer.style.display == 'none'){			curLayer.style.display = '';		}else{			curLayer.style.display = 'none';		}	}}function positionDialog(id,top,left){	positionObj(id,top,left);}//-- MENU MOUSE OVER --function menuOver(linkID,classID){return false;}//-- MENU MOUSE OUT --function menuOut(linkID,classID){return false;}//-- IMAGE FUNCTIONS --function imgSwap(imgID,newSrc){	if(document.images){document.images[imgID].src = 'menu/'+imgID+newSrc+'.gif';}}function changeOpacity(curImg, opacity){	if(curImg.style){		curImg.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+ opacity +')';	}}//-- UPDATE STYLE --function updateStyle(layerName, styleName, styleVal){	var curLayer = getObj(layerName);	if(curLayer){		eval('curLayer.style.'+ styleName +' = "'+ styleVal +'"');	}}//-- SEARCH SITE --function searchSite(siteID){	var target = prompt('SITE SEARCH:\nEnter your search phrase below.','');	if((target != '')&&(target != null)){		var oSYM = new Array(' ','\'','"');		var nSYM = new Array('%20','%27','%22');		for(i = 0; i < oSYM.length; i++){			for(x = 0; x < target.length; x++){				if(target.substring(x,x+1) == oSYM[i]){					target = target.substring(0,x) + nSYM[i] + target.substring(x+1,target.length);				}			}		}		document.location = '/templates/default.asp?id='+ siteID +'&PG=Search&target='+ target;	}}//-- FORGOT PASSWORD --function forgotPassword(hostName){	var emailAddress = prompt("Please enter your e-mail address.","");	if((emailAddress != "") && (emailAddress != null) && (emailAddress.indexOf(".") != -1) && (emailAddress.indexOf("@") != -1)){		window.open(hostName+"/templates/sendPassword.asp?method=post&emailAddress="+ emailAddress, "password", "width=200, height=200");	}}