/* -- Adobe GoLive JavaScript Library */

CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSStopExecution=false;
function CSAction(array) {return CSAction2(CSAct, array);}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var aa = fct[array[i]];
		if (aa == null) return false;
		var ta = new Array;
		for(var j=1;j<aa.length;j++) {
			if((aa[j]!=null)&&(typeof(aa[j])=="object")&&(aa[j].length==2)){
				if(aa[j][0]=="VAR"){ta[j]=CSStateArray[aa[j][1]];}
				else{if(aa[j][0]=="ACT"){ta[j]=CSAction(new Array(new String(aa[j][1])));}
				else ta[j]=aa[j];}
			} else ta[j]=aa[j];
		}			
		result=aa[0](ta);
	}
	return result;
}
CSAct = new Object;
function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // dont follow link
	else return false; // dont follow link
}

function CSFixFct() {
	var d = document; var w = window;
	if (d.cs.csFix.w != w.innerWidth || d.cs.csFix.h != w.innerHeight) {
		d.location = d.location; }
}
function CSNSFix(action) { 
	var d = document; var w = window;
	if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
		if (typeof d.cs == 'undefined') { 
			d.cs = new Object;
			d.cs.csFix = new Object; 
		} else if (CSIsFrame (w) == true) CSFixFct();
		d.cs.csFix.w = w.innerWidth;
		d.cs.csFix.h = w.innerHeight; 
		window.onresize = CSFixFct;
	  }
}
function CSIsFrame (window) {
	var rootWindow = window.parent;
	if (rootWindow == 'undefined') return false;
	for (i = 0; i < rootWindow.frames.length; i++)
		if (window == rootWindow.frames[i]) return true;
	return false;
}

function CSPAKkillframe() { 
if (self.parent.frames.length != 0)
self.parent.location = document.location
}

// OpenPopup 2.0 by Nate Baldwin, www.mindpalette.com - copyright 2003 (May 7, 2004)
if (typeof MPStoreOpenWin2 == "undefined") MPStoreOpenWin2 = new Array();
if (typeof MPStoreWinStngs2 == "undefined") {
	MPStoreWinStngs2 = new Object();
	MPStoreWinStngs2.url = "";
	MPStoreWinStngs2.name = "";
	MPStoreWinStngs2.options = "";
	MPStoreWinStngs2.focus = true;
	MPStoreWinStngs2.html = "";
	MPStoreWinStngs2.redirect = "";
	}
function MPOpenPopupWin2(action) {
	MPStoreWinStngs2.url = "";
	MPStoreWinStngs2.name = "";
	MPStoreWinStngs2.options = "";
	MPStoreWinStngs2.focus = true;
	MPStoreWinStngs2.html = "";
	MPStoreWinStngs2.redirect = "";
	var thisURL = (action[1] != "#" && action[1] != "(EmptyReference!)" && action[1] != "(Empty Reference!)") ? action[1] : "";
	var redirect = (action[31] != "#" && action[31] != "(EmptyReference!)" && action[31] != "(Empty Reference!)") ? action[31] : "";
	if (thisURL != "") {
		var urlType = (action[2] == 1) ? "image" : "page";
		MPStoreWinStngs2.focus = action[3];
		var regExpr = /[\w\S?]/;
		var validName = "";
		action[11] = (action[11] == true) ? "yes" : "no";
		var winName = (action[4] != "") ? action[4] : "PopUpWin";
		for (var n=0; n<winName.length; n++) {
			if (regExpr.test(winName.charAt(n))) validName += winName.charAt(n);
			}
		winName = (validName != "") ? validName : "PopUpWin";
		var width = (action[7] > screen.availWidth) ? screen.availWidth : action[7];
		var height = (action[9] > screen.availHeight) ? screen.availHeight : action[9];
		if (action[6] == true || action[8] == true) {
			width = screen.availWidth;
			posX = 0;
			}
		if (action[6] == true || action[10] == true) {
			height = screen.availHeight;
			posY = 0;
			}
		var posX = (action[13] != "") ? action[13] : 0;
		var posY = (action[15] != "") ? action[15] : 0;
		if (action[12] == true && width > 0 && height > 0) {
			posX = Math.round((screen.availWidth - width) / 2);
			posY = Math.round((screen.availHeight - height) / 2);
			} else {
			if (action[14] == 1 && width > 0) posX = (screen.availWidth - width - posX);
				else if (action[14] == 2) posX = Math.round((screen.availWidth - width) / 2);
			if (action[16] == 1 && height > 0) posY = (screen.availHeight - height - posY);
				else if (action[16] == 2) posY = Math.round((screen.availHeight - height) / 2);
			}
		for (i=17; i<=22; i++) {
			action[i] = (action[i] == true) ? "yes" : "no";
			}
		if (action[5] == true && typeof MPStoreOpenWin2[winName] != "undefined") {
			var oldWindow = MPStoreOpenWin2[winName];
			if (oldWindow && typeof oldWindow == "object") if (!oldWindow.closed) oldWindow.close();
			}
		var windowOptions = "";
		if (width > 0) windowOptions += "width=" + width + ",";
		if (height > 0) windowOptions += "height=" + height + ",";
		windowOptions += "resizable=" + action[11];
		windowOptions += ",scrollbars=" + action[17];
		windowOptions += ",menubar=" + action[18];
		windowOptions += ",toolbar=" + action[21];
		windowOptions += ",directories=" + action[19];
		windowOptions += ",location=" + action[22];
		windowOptions += ",status=" + action[20];
		windowOptions += ",left=" + posX;
		windowOptions += ",top=" + posY;
		if (urlType == "image") {
			var font = "Verdana, Arial, Helvetica, sans-serif";
			if (action[28] == 1) font = "Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif";
				else if (action[28] == 2) font = "Helvetica, Geneva, Arial, SunSans-Regular, sans-serif";
				else if (action[28] == 3) font = "\"Times New Roman\", Times, Georgia, serif";
				else if (action[28] == 4) font = "\"Courier New\", Courier, Monaco, monospace";
			var textColor = (action[27] != "") ? action[27] : "black";
			var linkColor = (action[30] != "") ? action[30] : "#00417d";
			var textSize = (action[29] != "" && action[29] > 5) ? action[29]+"" : "12";
			var backGround = (action[24] != "") ? action[24] : "#ffffff";
			var thisHTML = "";
			thisHTML += '<'+'!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'+"\n\n";
			thisHTML += '<'+'html>'+"\n\n";
			thisHTML += '<'+'head>'+"\n";
			thisHTML += '<'+'meta http-equiv="content-type" content="text/html;charset=iso-8859-1">'+"\n";
			if (action[23] != "") thisHTML += '<'+'title>'+action[23]+'<'+'/title>'+"\n";
			thisHTML += '<'+'style type="text/css" media="screen"><'+'!--'+"\n";
			thisHTML += 'body, div, td  { color: '+textColor+'; font-size: '+textSize+'px; font-family: '+font+'; background-color: '+backGround+'; margin: 0; padding: 0 }'+"\n";
			thisHTML += '.textpad  { margin: 0; padding: 4px 0 }'+"\n";
			if (action[25] == true) {
				thisHTML += 'a { color: '+linkColor+'; font-size: '+textSize+'px; text-decoration: none }'+"\n";
				thisHTML += 'a:link { color: '+linkColor+'; text-decoration: none }'+"\n";
				thisHTML += 'a:visited { color: '+linkColor+'; text-decoration: none }'+"\n";
				thisHTML += 'a:hover { color: '+linkColor+'; text-decoration: underline }'+"\n";
				}
			thisHTML += "--><"+"/style>\n<"+"/head>\n\n";
			thisHTML += '<'+'body bgcolor="'+backGround+'" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">'+"\n";
			if (action[26] != "") thisHTML += '<'+'div class="textpad" align="center">'+action[26]+'<'+'/div>'+"\n";
			thisHTML += '<'+'div align="center"><'+'img src="'+thisURL+'" alt="" border="0"><'+'/div>'+"\n";
			if (action[25] != "") thisHTML += '<'+'div class="textpad" align="center"><'+'a href="#" onclick="self.close();">Close Window<'+'/a><'+'/div>'+"\n";
			thisHTML += "<"+"/body>\n\n<"+"/html>";
			MPStoreWinStngs2.html = thisHTML;
			MPStoreWinStngs2.type = "image";
			thisURL = "";
			}
		MPStoreWinStngs2.name = winName;
		MPStoreWinStngs2.options = windowOptions;
		MPStoreWinStngs2.url = thisURL;
		MPStoreWinStngs2.redirect = redirect;
		var thisPopup = window.open(thisURL, winName, windowOptions);
		MPStoreOpenWin2[MPStoreWinStngs2.name] = thisPopup;
		setTimeout("MPTriggerDelayWin2()", 400);
		}
	}
function MPTriggerDelayWin2() {
	if (typeof MPStoreOpenWin2[MPStoreWinStngs2.name] == "object") {
		var thisPopup = MPStoreOpenWin2[MPStoreWinStngs2.name];
		if (thisPopup.closed) thisPopup = window.open(MPStoreWinStngs2.url, MPStoreWinStngs2.name, MPStoreWinStngs2.options);
		if (thisPopup && typeof thisPopup == "object") {
			if (MPStoreWinStngs2.type == "image" && MPStoreWinStngs2.html != "") {
				if (!thisPopup.closed) {
					thisPopup.document.open();
					thisPopup.document.write(MPStoreWinStngs2.html);
					thisPopup.document.close();
					}
				}
			}
		if (MPStoreWinStngs2.redirect != "") window.location = MPStoreWinStngs2.redirect;
		MPStoreOpenWin2[MPStoreWinStngs2.name] = thisPopup;
		if (thisPopup && typeof thisPopup == "object") if (!thisPopup.closed && MPStoreWinStngs2.focus) thisPopup.focus();
		MPStoreWinStngs2.url = "";
		MPStoreWinStngs2.name = "";
		MPStoreWinStngs2.options = "";
		MPStoreWinStngs2.focus = true;
		MPStoreWinStngs2.html = "";
		MPStoreWinStngs2.redirect = "";
		}
	}
//-->

// START FORM CALCULATOR 1.0.1 FUNCTIONS (www.mindpalette.com)
if (typeof MPFormCalcStoredVars == "undefined") var MPFormCalcStoredVars = new Array();
MPFormCalcStoredVars['val1var'] = 2000;
MPFormCalcStoredVars['val2var'] = 6000;
function MPFormCalcMain(action) {
	var formName = action[1];
	var field1 = MPFormCalcTrim(action[2]);
	var static1 = action[3];
	var var1 = action[4];
	var operation = action[5];
	var field2 = MPFormCalcTrim(action[6]);
	var static2 = action[7];
	var var2 = action[8];
	var roundOff = action[9];
	var forceDec = action[10];
	var absVal = action[11];
	var result_field = action[12];
	var result_id = action[13];
	var result_var = action[14];
	var round_type = action[15];
	var commas = action[16];
	var minSet = action[17];
	var minVal = parseFloat(action[18]);
	var maxSet = action[19];
	var maxVal = parseFloat(action[20]);
	var go = true;
	var numVal1 = 0;
	var numVal2 = 0;
	if (typeof document.forms[formName] == 'undefined') formName = 0;
	if (typeof document.forms[formName] == 'undefined') go = false;
	if (go) {
		var thisForm = document.forms[formName];
		numVal1 += MPFormCalcBuildNum(thisForm, field1, static1, var1);
		if (action[6] != '' || static2 != '' || var2 != '') {
			numVal2 += MPFormCalcBuildNum(thisForm, field2, static2, var2);
			numVal1 = MPFormCalcDoOp(numVal1, operation, numVal2);
			}
		if (minSet && numVal1 < minVal) numVal1 = minVal;
		if (maxSet && numVal1 > maxVal) numVal1 = maxVal;
		if (roundOff != '') numVal1 = MPFormCalcRound(numVal1, roundOff, round_type);
		if (absVal == true) numVal1 = Math.abs(numVal1);
		if (commas == true || forceDec > 0) numVal1 = MPFormCalcFormatString(numVal1, forceDec, commas);
		if (result_id != '') MPFormCalcDivText(result_id, numVal1);
		if (result_var != '') MPFormCalcStoredVars[result_var] = numVal1;
		if (result_field != '') thisForm.elements[result_field].value = numVal1;
		}
	}
function MPFormCalcVarType(thisField) {
	var fieldType = false;
	if (typeof thisField.type != 'undefined') fieldType = thisField.type;
	if (!fieldType) if (thisField[0].type != 'undefined') fieldType = 'group';
	if (!fieldType) fieldType = 'undefined';
	return fieldType;
	}
function MPFormCalcInArray(needle, haystack) {
	results = false;
	for (var n=0; n<haystack.length; n++) {
		if (haystack[n] == needle) {
			results = true;
			break;
			}
		}
	return results;
	}
function MPFormCalcTrim(inString) {
	var frontIndex = 0;
	var backIndex = inString.length - 1;
	var trimList = new Array(" ", "\t", "\n", "\r");
	while (MPFormCalcInArray(inString.charAt(frontIndex), trimList)) frontIndex++;
	while (MPFormCalcInArray(inString.charAt(backIndex), trimList)) backIndex--;
	return inString.substring(frontIndex, (backIndex + 1));
	}
function MPFormCalcTrimArray(thisArray) {
	var results = new Array();
	var count = 0;
	for (var n=0; n<thisArray.length; n++) {
		var thisVal = MPFormCalcTrim(thisArray[n]);
		if (thisVal != '') {
			results[count] = MPFormCalcTrim(thisArray[n]);
			count++;
			}
		}
	return results;
	}
function MPFormCalcDoOp(num1, operation, num2) {
	results = 0;
	if (operation == 1) results = num1 - num2;
		else if (operation == 2) results = num1 * num2;
		else if (operation == 3) results = num1 / num2;
		else if (operation == 4) results = num1 + ((num2 / 100) * num1);
		else if (operation == 5) results = num1 - ((num2 / 100) * num1);
		else results = num1 + num2;
	return results;
	}
function MPFormCalcGetNum(thisString) {
	thisString = thisString+"";
	var result = "";
	var regEx =  /^[0-9.]/;
	for (var n=0; n<thisString.length; n++) {
		var thisChar = thisString.charAt(n);
		if (regEx.test(thisChar)) result += thisChar;
		}
	if (result == '.' || result == 'NaN') result = 0;
	result = (result == '') ? 0 : parseFloat(result);
	if (result == "NaN") result = 0;
	return result;
	}
function MPFormCalcBuildNum(thisForm, fields, staticVal, varVal) {
	var numVal = 0;
	numVal += MPFormCalcGetNum(staticVal);
	if (varVal != '') {
		if (typeof MPFormCalcStoredVars[varVal] != "undefined") numVal += MPFormCalcGetNum(MPFormCalcStoredVars[varVal]);
		}
	if (fields != '') {
		fieldList = MPFormCalcTrimArray(fields.split(','));
		for (var n=0; n<fieldList.length; n++) {
			thisField = fieldList[n];
			if (thisField != '' && typeof thisForm.elements[thisField] != 'undefined') thisField = thisForm.elements[thisField];
			numVal += MPFormCalcFlatten(thisField);
			}
		}
	return numVal;
	}
function MPFormCalcFlatten(passedField) {
	var numVal = 0;
	fieldArray = (MPFormCalcVarType(passedField) != "group") ? new Array(passedField) : passedField;
	for (var n=0; n<fieldArray.length; n++) {
		var thisField = fieldArray[n];
		var fieldType = MPFormCalcVarType(thisField);
		if (fieldType == "text" || fieldType == "textarea" || fieldType == "hidden" || fieldType == "password") {
			numVal = MPFormCalcDoOp(numVal, 0, MPFormCalcGetNum(thisField.value));
			} else if (fieldType == "select-one")
			numVal = MPFormCalcDoOp(numVal, 0, MPFormCalcGetNum(thisField.options[thisField.options.selectedIndex].value));
			else if (fieldType == "select-multiple") {
			var thisSum = 0;
			for (var i=0; i<thisField.length; i++) {
				if (thisField.options[i].selected) {
					var selection = MPFormCalcGetNum(thisField.options[i].value);
					thisSum += selection;
					}
				}
			numVal = MPFormCalcDoOp(numVal, 0, thisSum);
			}
			else if (fieldType == "checkbox" || fieldType == "radio") {
			if (typeof thisField.length != "undefined") {
				var thisSum = 0;
				for (var i=0; i<thisField.length; i++) {
					if (thisField[i].checked) thisSum += MPFormCalcGetNum(thisField[i].value);
					}
				numVal = MPFormCalcDoOp(numVal, 0, thisSum);
				} else if (thisField.checked) {
				numVal = MPFormCalcDoOp(numVal, 0, MPFormCalcGetNum(thisField.value));
				}
			}
		}
	return numVal;
	}
function MPFormCalcRound(number, places, type) {
	var precision = (places != 0) ? Math.pow(10, Math.abs(places)) : 0;
	if (places > 0) number = number * precision;
		else if (places < 0) number = number / precision;
	if (type == 2) number = Math.ceil(number);
		else if (type == 1) number = Math.floor(number);
		else number = Math.round(number);
	if (places > 0) number = number / precision;
		else if (places < 0) number = number * precision;
	return number;
	}
function MPFormCalcSplitIntDec(number) {
	string = number+'';
	if (string.indexOf('.') > -1) var results = string.split('.');
		else results = new Array(string, '');
	return results;
	}
function MPFormCalcFormatString(number, force, commas) {
	var string = number+"";
	if (force > 0) {
		var temp = MPFormCalcSplitIntDec(string);
		var integer = temp[0];
		var decimal = temp[1];
		while (decimal.length < force) { decimal+="0" };
		string = integer+'.'+decimal;
		}
	if (commas) {
		var temp = MPFormCalcSplitIntDec(string);
		var integer = temp[0];
		var decimal = '.'+temp[1];
		var last = (integer.length - 1);
		if (last > 2) {
			var results = "";
			var n = last;
			while (n>-1) {
				x = 1;
				while (x<4 && n>-1) {
					results = string.charAt(n) + results;
					n--;
					x++;
					}
				if (n>-1) results = ','+results;
				}
			string = results+decimal;
			}
		}
	return string;
	}
function MPFormCalcDivText(div, text) {
	if (document.layers) {
		if (typeof eval("document."+div+".document") != "undefined") {
			with (eval("document."+div+".document")) {
				open();
				write("<"+"HTML"+"><"+"HEAD"+"><"+"/HEAD"+"><"+"BODY"+">"+text+"<"+"/BODY"+"><"+"/HTML"+">");
				close();
				}
			}
		} else if (document.all && typeof document.all[div] != "undefined") {
		document.all[div].innerHTML = text;
		} else if (document.getElementById && !document.all && typeof document.getElementById(div) != "undefined") {
		document.getElementById(div).innerHTML = text;
		}
	}
// END FORM CALCULATOR 1.0 FUNCTIONS
//-->


