////////////////////////////
////                    ////
////   FORM FUNCTIONS   ////
////                    ////
////////////////////////////

function SendForm(){
document.forms.ClientAccess.submit();
}

function ResetForm(){
document.forms.ClientAccess.reset();
}

/////////////////////////////////
////                         ////
////   INTERFACE FUNCTIONS   ////
////                         ////
/////////////////////////////////

//// Loads Images into the Cache
function NewImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

//// Preloads all images listed in the PreloadMeImages Array (in HTML doc)
var preloadFlag = false;
function PreloadImages() {
var PreloadLoopValue = 0;
	if (document.images && PreloadMeImages) {
		for(var PreloadLoopValue; PreloadLoopValue < PreloadMeImages.length;){
		var NewImagePath = './imagery/' + PreloadMeImages[PreloadLoopValue] + '.gif';
		NewImage(NewImagePath);
		PreloadLoopValue++;
		}
	}
}

//// Preloads all images listed in the MoreInfo Array (in HTML doc)
var preloadMoreInfoFlag = false;
function PreloadMoreInfoImages() {
var PreloadMoreInfoLoopValue = 0;
	if (document.images && MoreInfo) {
		for(var PreloadMoreInfoLoopValue; PreloadMoreInfoLoopValue < MoreInfo.length;){
		var RightImageName = (MoreInfo[PreloadMoreInfoLoopValue].split('$$'))[1];
		var NewImageTitlePath = './imagery/answers/' + RightImageName + 'AnswerTitle.gif';
		NewImage(NewImageTitlePath);
		var NewImageBodyPath = './imagery/answers/' + RightImageName + 'AnswerBody.gif';
		NewImage(NewImageBodyPath);
		PreloadMoreInfoLoopValue++;
		}
	}
}

var lastframewidth = '0';

//// keeps all DIVs correctly positioned, runs as a loop
function CenterAllSiteParts(){
loop = true;
	if (self.innerWidth){
	frameWidth = self.innerWidth;
	}else if (document.documentElement && document.documentElement.clientWidth){
	frameWidth = document.documentElement.clientWidth;
	}else if (document.body){
	frameWidth = document.body.clientWidth;
	}
	if(navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf('Macintosh') != -1 && lastframewidth != '0' && lastframewidth != frameWidth){
	document.location.href = document.location.href;
	//alert('frameWidth = ' + frameWidth + ', lastframewidth = ' + lastframewidth );
	} else {
	eval("MoveLayer('TheMainContentLayer', " + ((frameWidth - 724) / 2) + ", 21)");
		if(MoreInfoEnabled == 'yes'){
		eval("MoveLayer('MoreInfoMenuDiv', " + (((frameWidth - 724) / 2) + 150) + ", 292)");
		eval("MoveLayer('MoreInfoAnswerDiv', " + (((frameWidth - 724) / 2) + 150) + ", 292)");
		}
	}
lastframewidth = frameWidth;
CenterAllSitePartsTimer = setTimeout("CenterAllSiteParts()", 10);
}


function ToggleAnswers(){
	if(MoreInfoState == 'closed'){
	ToggleVisibility('MoreInfoAnswerDiv','hidden');
	ToggleVisibility('MoreInfoMenuDiv','visible');
	ReplaceImage('TheMainContentLayer','BodyMidRightQA','imagery/BodyMidRightQA_a.gif');
	MoreInfoState = 'open';
	}else{
	ToggleVisibility('MoreInfoAnswerDiv','hidden');
	ToggleVisibility('MoreInfoMenuDiv','hidden');
	ReplaceImage('TheMainContentLayer','BodyMidRightQA','imagery/BodyMidRightQA.gif');
	MoreInfoState = 'closed';
	}
}

function ShowAnswer(RightAnswer){
var RightHeaderImg = './imagery/answers/' + RightAnswer + 'AnswerTitle.gif';
var RightAnswerImg = './imagery/answers/' + RightAnswer + 'AnswerBody.gif';
ReplaceImage('MoreInfoAnswerDiv','QuestionAnswerHeadImg', RightHeaderImg);
ReplaceImage('MoreInfoAnswerDiv','QuestionAnswerImg', RightAnswerImg);
ToggleVisibility('MoreInfoAnswerDiv','visible');
ToggleVisibility('MoreInfoMenuDiv','hidden');
}


///////////////////////////////////////////////
////                                       ////
////   GLOBAL SUPPORTING DHTML FUNCTIONS   ////
////                                       ////
///////////////////////////////////////////////

	
//// replace an image in a DIV
function ReplaceImage(RightDiv, RightImage, ImagePath){
	if (document.getElementById) {
	document.getElementById(RightImage).src= ImagePath;
	} else if (document.all) {
	document.images[RightImage].src = ImagePath;
	} else if (document.layers) {
	document.layers[RightDiv].document.images[RightImage].src= ImagePath;
	}
}

//// move a layer
function MoveLayer(RightDiv, ypos, xpos) {
	if (document.getElementById) {
	document.getElementById(RightDiv).style.left= ypos + 'px';
	document.getElementById(RightDiv).style.top= xpos + 'px';
	} else if (document.all) {
	eval(RightDiv + '.style.left=' + ypos);
	eval(RightDiv + '.style.top=' + xpos);
	} else if (document.layers) {
	eval('document.' + RightDiv + '.left=' + ypos);
	eval('document.' + RightDiv + '.top=' + xpos);
	}
}

//// toggle layer visibility
function ToggleVisibility(RightDiv, VisibilityChangesTo) {
	if (document.getElementById) {
	document.getElementById(RightDiv).style.visibility= VisibilityChangesTo;
	} else if (document.all) {
	eval(RightDiv + '.style.visibility="' + VisibilityChangesTo +'"');
	} else if (document.layers) {
	document[RightDiv].visibility = VisibilityChangesTo;
	}
}