﻿/* -- Adobe GoLive JavaScript Library */

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 newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
mustInitImg = true;
function initImgID() {var di = document.images; if (mustInitImg && di) { for (var i=0; i<di.length; i++) { if (!di[i].id) di[i].id=di[i].name; } mustInitImg = false;}}

function findElement(n,ly) {
	var d = document;
	if (browserVers < 4)		return d[n];
	if ((browserVers >= 6) && (d.getElementById)) {initImgID; return(d.getElementById(n))}; 
	var cd = ly ? ly.document : d;
	var elem = cd[n];
	if (!elem) {
		for (var i=0;i<cd.layers.length;i++) {
			elem = findElement(n,cd.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImagesArray(array) {
	if (preloadFlag == true) {
		var d = document; var img;
		for (i=0;i<array.length;i+=2) {
			img = null; var n = array[i];
			if (d.images) {
				if (d.layers) {img = findElement(n,0);}
				else {img = d.images[n];}
			}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (!img && d.getElementsByName) {
				var elms = d.getElementsByName(n);
				if (elms) {
					for (j=0;j<elms.length;j++) {
						if (elms[j].src) {img = elms[j]; break;}
					}
				}
			}
			if (img) {img.src = array[i+1];}
		}
	}
}

function changeImages() {
	changeImagesArray(changeImages.arguments);
}

function toggleImages() {
	for (var i=0; i<toggleImages.arguments.length; i+=2) {
		if (selected == toggleImages.arguments[i])
			changeImagesArray(toggleImages.arguments[i+1]);
	}
}

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 */
}

// DropDownPopUp 1.2.5 by Nate Baldwin, www.mindpalette.comm, copyright 2002
function MPDropPop(action) {
	for (i=7; i<14; i++) {
		if (action[i] == false) action[i] = "no"; else action[i] = "yes";
		}
	var posX = 0;
	var posY = 0;
	if (action[6] == true) {
		posX = ((screen.availWidth/2)-(action[4]/2));
		posY = ((screen.availHeight/2)-(action[5]/2));
		} else {
		posX = action[14];
		posY = action[15];
		}
	if (action[4] > (screen.availWidth - 10)) action[4] = (screen.availWidth - 10);
	if (action[5] > (screen.availHeight - 10)) action[5] = (screen.availHeight - 10);
	var thisForm = action[1];
	var thisMenu = action[2];	
	var thisURL = document.forms[thisForm].elements[thisMenu].options[document.forms[thisForm].elements[thisMenu].selectedIndex].value;
	if (thisURL) {
		if (thisURL != "" && thisURL != " " && thisURL != "#" && thisURL != "(EmptyReference!)" && thisURL != "(Empty Reference!)") {
			var windowOptions = "";
			windowOptions += "width=" + action[4];
			windowOptions += ",height=" + action[5];
			windowOptions += ",resizable=" + action[13];
			windowOptions += ",scrollbars=" + action[7];
			windowOptions += ",menubar=" + action[8];
			windowOptions += ",toolbar=" + action[11];
			windowOptions += ",directories=" + action[9];
			windowOptions += ",location=" + action[12];
			windowOptions += ",status=" + action[10];
			windowOptions += ",left=" + posX;
			windowOptions += ",top=" + posY;
			window.open(thisURL, action[3], windowOptions);
			}
		}
	}


function CSOpenWindow(action) {
	var wf = "";	
	wf = wf + "width=" + action[3];
	wf = wf + ",height=" + action[4];
	wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
	wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
	wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
	wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
	wf = wf + ",directories=" + (action[9] ? "yes" : "no");
	wf = wf + ",location=" + (action[10] ? "yes" : "no");
	wf = wf + ",status=" + (action[11] ? "yes" : "no");		
	window.open(action[1],action[2],wf);
}
function CSCloseWindow() { 
if (self.parent.frames.length != 0) {
	self.parent.close()	
	} else {
	window.close()
	}
}

var submitcount=0;
//checkRequiredFields - Added 08/06/2006 Joe Ravgiala
//This function validates the required fields to make sure they aren't blank and if they are in the correct format
function checkRequiredFields(formName) {
 var obj = eval(formName);
   
 if (!(submitcount == 0)) {
  return false;
 }
 else {
  submitcount++;
   if (obj.yourName != null) {
   if (obj.yourName.value == "") {
    showBlank("name", obj.yourName);
    obj.yourName.select();
    submitcount=0;
    obj.yourName.focus();
    return false;
   }
  }
  if (obj.Email.value == "") {
   showBlank("e-mail", obj.Email);
   return false;
  }
  if(!checkEmail(obj.Email)) {
   obj.Email.select();
   submitcount=0;
   obj.Email.focus();
   return false;
  }
  if (obj.questionSubject != null) {
   if (obj.questionSubject.value == "") {
    showBlank("subject", obj.questionSubject);
    obj.questionSubject.select();
    submitcount=0;
    obj.questionSubject.focus();
    return false;
   }
  }
  if (obj.questionArea != null) {
   if (obj.questionArea.value == "") {
    showBlank("question", obj.questionArea);
    obj.questionArea.select();
    submitcount=0;
    obj.questionArea.focus();
    return false;
   }
  }
// subjectline set here
  setSubjectLine();
  return true;
 }
}
// for the poll subject line
function setPollSubjectLine() {
 var hiddenPageType;
 var answer;
 hiddenPageType = document.submitPoll.hiddenPageType.value;
 for (i = 0; i < document.submitPoll.radiogroup.length; i++) {
  if(document.submitPoll.radiogroup[i].checked) {
   answer = document.submitPoll.radiogroup[i].value;
   //alert(answer);
  }
 }
 document.submitPoll.subject.value = hiddenPageType + " " + answer;
 alert(document.submitPoll.subject.value);
}
// for the ask experts subject line
function setSubjectLine() {
 var subjectLine;
 subjectLine = document.submitQuestion.questionSubject.value;
 document.submitQuestion.subject.value = subjectLine;
 //alert(document.submitQuestion.subject.value);
}

// Display message
function showBlank(field, formName) {
 var msg = "You have missed one of the required fields.\n Please enter your " + field + " in the textbox.\n";
 alert(msg);
 submitcount=0;
 formName.focus();
}
//checkEmail for validating e-mail format - Added 08/06/2006 Joe Ravgiala
function checkEmail(formName) {
 var objValue = formName.value;
 if (objValue.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
        return true;
    } else {
        alert("The e-mail address you entered is invalid.\nPlease enter a valid e-mail address.");
  return false;
 }
}
var maxlimit = 500;
function update(formName) {
 var fieldName = formName;
 var fieldDisplayName = formName.name;
 var fieldValue = fieldName.value;
 if (fieldName.value.length > maxlimit) {
     alert("Please limit your " + fieldDisplayName + " to " + maxlimit + " characters or less");
   fieldName.value = fieldName.value.substring(0, maxlimit);
   fieldName.focus();
   } 
 }
 function agreeBeforeEntry(formName) {
 var obj = eval(formName);
 if(obj.checked) {
  return true;
 } else {
  var msg = "You have not accepted the Terms and Conditions of Use.\nPlease check the checkbox before submitting.\n";
  alert(msg);
  return false;
 }
}


// FUNCTION FOR POP-UP WINDOWS
function openPopup(url,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
	if(url.indexOf('/iwrite') != -1) {
		popupwin=window.open(url, 'Popup', 'width='+w+',height='+h+',scrollbars=yes,toolbar=no,menubar=no,location=no,titlebar=no,left='+winl+',top='+wint+',screenX='+winl+',screenY='+wint+',resizable=yes,alwaysRaised=yes');
  	} 
  	else 
  	{
		popupwin=window.open(url, 'Popup', 'width='+w+',height='+h+',scrollbars=yes,toolbar=yes,menubar=yes,location=yes,titlebar=yes,left='+winl+',top='+wint+',screenX='+winl+',screenY='+wint+',resizable=yes,alwaysRaised=yes');
  	}
  popupwin.focus();
}

