// ***** INITIALIZE PAGE FOR CURRENT CLIENT BROWSER ****
//Determine browser, set additional stylesheet and perform setup functions (default browser is IE 6.x)
//See _script/sniffer.js and _script/sniffer.htm for browser check documentation 
//MSIE 5.0x
if (is_ie5) {
	document.write('<link rel="stylesheet" type="text/css" href="_css/_browsers/msie50.css" />');
}
//NETSCAPE 6 UP, MOZILLA 1.6, FIREBIRD, FIREFOX
if (is_nav6up || is_moz || is_fx || is_fb) {
	document.write('<link rel="stylesheet" type="text/css" href="_css/_browsers/ns6up-moz-firebird-firefox.css" />');
}
//NETSCAPE 7 UP, MOZILLA 1.6, FIREBIRD, FIREFOX
if (is_nav7up || is_moz || is_fx || is_fb) {
	document.write('<link rel="stylesheet" type="text/css" href="_css/_browsers/ns7up-moz-firebird-firefox.css" />');
}
//OPERA 7
if (is_opera7up) {
	document.write('<link rel="stylesheet" type="text/css" href="_css/_browsers/opera7up.css" />');
}
// ***** /INITIALIZE PAGE FOR CURRENT CLIENT BROWSER ****

// ***** APPEARANCE COOKIE (FONT, CONTRAST) ****
//Set accesibility cookie	
function setAppearanceCookie(sParam) {
	var cookieName = 'p6AppCookie';
	var cookieValue = '';
	//create cookie value for sParam = Font
	if (sParam == 'Font') {
		//set new font value
		cookieValue = 'Font*on|Contrast*' + sContrast;
		if (sFont == 'on') {
			cookieValue = 'Font*off|Contrast*' + sContrast;	
		}
	}
	//create cookie value for sParam = Contrast
	if (sParam == 'Contrast') {
		//set new contrast value
		cookieValue = 'Font*' + sFont + '|Contrast*on';
		if (sContrast == 'on') {
			cookieValue = 'Font*' + sFont + '|Contrast*off';
		}
	}
	//write cookie
  	document.cookie = cookieName + "=" + escape(cookieValue) + "; ";
	location.reload();
}
// ***** /APPEARANCE COOKIE (FONT, CONTRAST) ****

// ***** FOLD AND UNFOLD OBJECTS ****
//Call as foldItem('itemId','imageId'/false)
function foldItem(oFold,oImage) {
	//fold or unfold item
	if (document.getElementById(oFold).style.display == 'block') {
		document.getElementById(oFold).style.display = 'none';
	}
	else {
		document.getElementById(oFold).style.display = 'block';
	}
	//swap image (if oImage is not false)
	if (oImage != false) {
		//get and set image status
		var sNewExtension = '';
		var aImageUrl = document.getElementById(oImage).src.split('/');
		aImageUrl = aImageUrl[aImageUrl.length-1].split('_');
		//set closed
		if (aImageUrl[aImageUrl.length-1].indexOf('open.gif') != '-1') {
			sNewExtension = 'closed.gif'
		}
		//set open
		if (aImageUrl[aImageUrl.length-1].indexOf('closed.gif') != '-1') {
			sNewExtension = 'open.gif'
		}
		//create new src string
		var sNewSrc = '';
		for (var i=0;i<aImageUrl.length-1;i++) {
			sNewSrc += aImageUrl[i] + '_';
		}
		sNewSrc += sNewExtension;
		//swap image
		document.getElementById(oImage).src = '_img/' + sNewSrc;
	}
}
// ***** /FOLD AND UNFOLD OBJECTS ****

// ***** DIALOGS ****
// *** POP MODAL dialog
/* This function opens a modal dialog. The following must be specified inside the onclick and onkeypress events that activates the function:

onclick="popDialog(['dUrl'],[dWidth],[dHeight],['dFunc']); return false;"
onkeypress="popDialog(['dUrl'],[dWidth],[dHeight],['dFunc']); return false;"

dUrl: 		Dialog url. String that specifies the URL of the document to load and display.
dWidth: 	Dialog width. Sets the dialog width in pixels.
dHeight: 	Dialog height. Sets the dialog height in pixels.
dFunc: 		Dialog function. Sets the function that retrieves the dialog arguments. Values: ['function name'],[false]. 
			If dFunc is set to false no values vill be passed from the dialog.

For retrieving values from the dialog copy, rename and modify the templateFunction_returnDialogValues(), templateFunction_getDialogReturnValues() below to fit your needs. */

function popDialog(dUrl,dWidth,dHeight,dFunc) {
	//pop dialog
	dialogReturns = window.showModalDialog(dUrl,"","dialogHeight: " + dHeight + "px; dialogWidth: " + dWidth + "px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll: 0;");
	//end pop dialog function if dialog returns false
	if (!dialogReturns) {
		return false;
	}
	//run dialog function if dFunc is not set to false and if dialog returns values
	if (dialogReturns != null && dFunc != false) {
		var run = eval(dFunc + '()');
		run;
	}
	//else return dialog value
	else {
		return dialogReturns;
	}
}
//*** /POP MODAL dialog

//*** POP MODELESS dialog
/* This function opens a modeless dialog. The following must be specified inside the onclick and onkeypress events that activates the function:

onclick="popModelessDialog(['dUrl'],[dArguments],[dWidth],[dHeight]); return false;"
onkeypress="popModelessDialog(['dUrl'],[dArguments],[dWidth],[dHeight],['dFunc']); return false;"

dUrl: 		Dialog url. String that specifies the URL of the document to load and display.
dArguments:	Dialog arguments.
dWidth: 	Dialog width. Sets the dialog width in pixels.
dHeight: 	Dialog height. Sets the dialog height in pixels.
dFunc: 		Dialog function. Sets the function that retrieves the dialog arguments. Values: ['function name'],[false]. 
			If dFunc is set to false no values vill be passed from the dialog.
*/
function popModelessDialog(dUrl,dArguments,dWidth,dHeight) {
	//pop dialog
	window.showModelessDialog(dUrl,dArguments,"dialogHeight: " + dHeight + "px; dialogWidth: " + dWidth + "px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll: 0;");
}
// *** /POP MODELESS dialog
// ***** /DIALOGS ****

// ***** MAIL ****
//Send mail
function doSend(suff,name,domain) {
	location.href = 'mailto:' + name + '@' + domain + '.' + suff;
}
// ***** /MAIL ****

// ***** INITIALIZE PAGE ****
//Initialize page
function initPage() {
	//Replace heading classes
	replaceHeadingClasses();
	//Replace sIFR 2.0 classes
	sIFRreplacementCalls();
}

//Set heading and container classes and colors
//arrays containing classes and colors
var aProductHeadings = new Array('content','survey','helpdesk');
var aProductColors = new Array('C1174E','639441','D9A04E');
function replaceHeadingClasses() {
	//replace classes for main column headings
	var cMainColHeadings = document.getElementById('maincolumn').getElementsByTagName('H1');
	for (var i=0;i<cMainColHeadings.length;i++) {
		if (i==0) {
			cMainColHeadings[i].className = 'mainfirst';
		}
		else {
			cMainColHeadings[i].className = 'mainother';
		}
	}
	//replace classes for right column headings
	if (document.getElementById('rightcolumn')) {
		var cRgtColHeadings = document.getElementById('rightcolumn').getElementsByTagName('H1');
		for (var i=0;i<cRgtColHeadings.length;i++) {
			cRgtColHeadings[i].className = 'rightcolumn';
		}
	}
	//replace classes for product headings
	if (document.getElementById('productcolumns')) {
		//headings
		var cProductHeadings = document.getElementById('productcolumns').getElementsByTagName('H1');
		for (var i=0;i<cProductHeadings.length;i++) {
			cProductHeadings[i].className = aProductHeadings[i];
		}
		//borders
		var cProductContainers = document.getElementById('productcolumns').getElementsByTagName('DIV');
		var u = 0;
		for (var i=0;i<cProductContainers.length;i++) {
			if (cProductContainers[i].className == 'odd' || cProductContainers[i].className == 'even') {
				cProductContainers[i].style.borderTopColor = '#' + aProductColors[u];
				u++;
			}
		}
	}

}
//Set sIFR replacements
function sIFRreplacementCalls() {
	if (typeof sIFR == "function") {
		//main column
		sIFR.replaceElement(named({sSelector:"body h1.mainfirst", sFlashSrc:"_css/_sifr/memphis-bold.swf", sColor:"#363636", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"body h1.mainother", sFlashSrc:"_css/_sifr/memphis-bold.swf", sColor:"#A8A283", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
		//right column
		sIFR.replaceElement(named({sSelector:"body h1.rightcolumn", sFlashSrc:"_css/_sifr/memphis-bold.swf", sColor:"#25561E", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
		//product columns
		sIFR.replaceElement(named({sSelector:"body h1.content", sFlashSrc:"_css/_sifr/myriad-pro.swf", sColor:"#C1174E", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"body h1.survey", sFlashSrc:"_css/_sifr/myriad-pro.swf", sColor:"#639441", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"body h1.helpdesk", sFlashSrc:"_css/_sifr/myriad-pro.swf", sColor:"#D9A04E", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0"}));
	}
}
// ***** INITIALIZE PAGE ****






