<!--
// -----------------------
// GLOBAL VARIABLES
// -----------------------
var dServerDate = new Date();
var	nHours;
var	nMinutes;
var nDay;
var nDate;
var nMonth;
var nFullYear;
var bHasImages = false;
var nDropDownCount = 0;
var sCurrentDropDown = '';
var bCallHitbox = false; //Decide whether to call hitbox method
// -----------------------
// FUNCTION: fIdentifyBrowserCapabilities
// DESCRIPTION: A function that allows advanced image and javascript.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fIdentifyBrowserCapabilities(){
	if(bHasImages == true){
		if(document.getElementById('wrapper')){
			document.getElementById('wrapper').className = 'visual-form-container';
			return;
		}
		if(document.getElementById('wrapper-slideshow')){
			document.getElementById('wrapper-slideshow').className = 'visual-form-container';
		}
	}
}
// -----------------------
// FUNCTION: fCreateDate
// DESCRIPTION: A function that creates the mast head date.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fCreateDate(){
	var sDate = '';
	nDay = dServerDate.getUTCDay();
	nMonth = dServerDate.getUTCMonth();
	nDate = dServerDate.getUTCDate();
	nFullYear = dServerDate.getUTCFullYear();
	switch(nDay){
		case 0:
			sDate += 'Sunday';
		break;
		case 1:
			sDate += 'Monday';
		break;
		case 2:
			sDate += 'Tuesday';
		break;
		case 3:
			sDate += 'Wednesday';
		break;
		case 4:
			sDate += 'Thursday';
		break;
		case 5:
			sDate += 'Friday';
		break;
		case 6:
			sDate += 'Saturday';
		break;
		default:
	}
	sDate += '&#44&nbsp;';
	switch(nMonth){
		case 0:
			sDate += 'January';
		break;
		case 1:
			sDate += 'February';
		break;
		case 2:
			sDate += 'March';
		break;
		case 3:
			sDate += 'April';
		break;
		case 4:
			sDate += 'May';
		break;
		case 5:
			sDate += 'June';
		break;
		case 6:
			sDate += 'July';
		break;
		case 7:
			sDate += 'August';
		break;
		case 8:
			sDate += 'September';
		break;
		case 9:
			sDate += 'October';
		break;
		case 10:
			sDate += 'November';
		break;
		case 11:
			sDate += 'December';
		break;
		default:
	}
	sDate += '&nbsp;';
	sDate += nDate + '&#44&nbsp;' + nFullYear;
	document.getElementById('masthead-date').innerHTML = sDate;
}
// -----------------------
// FUNCTION: fShowHideElement
// DESCRIPTION: A function shows or hides an element.
// ARGUMENTS: sElemendId
// RETURN: None
// -----------------------
function fShowHideElement(sElemendId) {
	var eElement = document.getElementById(sElemendId);
	var sClassName = eElement.className;
	if (sClassName.match(' access-text') || sClassName.match('access-text')) {
		// Shows element
		eElement.className = eElement.className.replace(/access-text/, '');
	} else {
		// Hides element
		eElement.className = sClassName + ' access-text';
	}
}

// -----------------------
// FUNCTION: fShowHideElement(By Anurag)
// DESCRIPTION: A function shows or hides an element.
// ARGUMENTS: sElemendId
// RETURN: None
// -----------------------
//function fShowHideElement(sElemendId,hrefNo) {
//	var eElement = document.getElementById(sElemendId);
//	var sClassName = eElement.className;
//	if (sClassName.match(' access-text') || sClassName.match('access-text')) {
//		// Shows element
//		eElement.className = eElement.className.replace(/access-text/, '');
//		document.getElementById("carousel-link-href-"+hrefNo).href = "aaa";
//	} else {
//		// Hides element
//		eElement.className = sClassName + ' access-text';
//
//		document.getElementById("carousel-link-href-"+hrefNo).href = carousel_link_href[0];
//	}
//}

// -----------------------
// FUNCTION: fShowHideSIFRElement
// DESCRIPTION: A function shows or hides an element which contains a sIFR text replacement element.
// ARGUMENTS: sElemendId
// RETURN: None
// -----------------------
function fShowHideSIFRElement(sElemendId) {
	var eElement = document.getElementById(sElemendId);
	var sClassName = eElement.className;
	if (sClassName.match(' sifr-access-text') || sClassName.match('sifr-access-text')) {
		// Shows element
		eElement.className = eElement.className.replace(/sifr-access-text/, '');
	} else {
		// Hides element
		eElement.className = sClassName + ' sifr-access-text';
	}
}

// -----------------------
// FUNCTION: fShowHideSIFRElementColumnOff
// DESCRIPTION: A function shows or hides an element which contains a sIFR text replacement element.
// ARGUMENTS: sElemendId
// RETURN: None
// -----------------------
function fShowHideSIFRElementColumnOff(sElemendId) {
	var eElement = document.getElementById(sElemendId);
	var sClassName = eElement.className;
	if (sClassName.match(' sifr-access-text-column-off') || sClassName.match('sifr-access-text-column-off')) {
		// Shows element
		eElement.className = eElement.className.replace(/sifr-access-text-column-off/, '');
	} else {
		// Hides element
		eElement.className = sClassName + ' sifr-access-text-column-off';
	}
}

// -----------------------
// FUNCTION: fHoverImage
// DESCRIPTION: A function that changes the image for the hovered state.
// ARGUMENTS: sElementId
// RETURN: None
// -----------------------
function fHoverImage(sImageCollection,sElementId){
	var sObjName = eval(fGetImageCollection(sImageCollection) + sElementId + 'Hover.src');
	document.getElementById(sElementId).childNodes[0].src = sObjName;
}
// -----------------------
// FUNCTION: fRevertImage
// DESCRIPTION: A function that changes the image for the normal state.
// ARGUMENTS: sElementId
// RETURN: None
// -----------------------
function fRevertImage(sImageCollection,sElementId){
	var sObjName = eval(fGetImageCollection(sImageCollection) + sElementId + '.src');
	document.getElementById(sElementId).childNodes[0].src = sObjName;
}
// -----------------------
// FUNCTION: fGetImageCollection
// DESCRIPTION: A function that determines which collection of images to use.
// ARGUMENTS: sLocation
// RETURN: None
// -----------------------
function fGetImageCollection(sLocation){
	var sImageCollection;
	switch(sLocation){
		case 'TopNav':
			sImageCollection = 'oMastHeadNavImg';
		break;
		case 'LeftNav':
			sImageCollection = 'oLeftNavImg';
		break;
		case 'Footer':
			sImageCollection = 'oFooterNavImg';
		break;
		default:
	}
	return sImageCollection;
}
// ----------------------
// FUNCTION: fGoURL
// DESCRIPTION: A function that redirects the browser to the received url
// ARGUMENTS: sUrl
// RETURN: None
// ----------------------
function fGoURL(sUrl) {
	if(sUrl.match('http://')){
		window.open(sUrl);
	} else {
		window.location = sUrl;
	}
}

// ----------------------
// FUNCTION: fGoURLTopic
// DESCRIPTION: A function that redirects the browser to the received url
// ARGUMENTS: sUrl
// RETURN: None
// ----------------------
function fGoURLTopic(sUrl,pubUrl) {
	checkUrl = sUrl.substr(0,1);

	if(checkUrl=="/"){
		window.location = sUrl;
	}
	
	else if(sUrl.match(pubUrl)){
		window.location = sUrl;
	} 
	else {
		window.open(sUrl);
	}
}

// -----------------------
// FUNCTION: fSwitchCheckbox
// DESCRIPTION: A function that checks or unchecks css checkboxes.
// ARGUMENTS: sElemendId
// RETURN: None
// -----------------------
function fSwitchCheckbox(sElemendId){
	var eElement = document.getElementById(sElemendId);
	var eElementCheckbox = document.getElementById(sElemendId + '-checkbox');
	var sClassName = eElement.className;
	if (sClassName.match(' checkbox-empty') || sClassName.match('checkbox-empty')) {
		// Shows checked element
		eElementCheckbox.checked = true;
		eElement.className = eElement.className.replace(/checkbox-empty/, 'checkbox-checked');
	} else {
		// Hides empty element
		eElementCheckbox.checked = false;
		eElement.className = eElement.className.replace(/checkbox-checked/, 'checkbox-empty');
	}
	return;
}
// -----------------------
// FUNCTION: fSwitchRadio
// DESCRIPTION: A function that checks or unchecks css radio inputs.
// ARGUMENTS: sElemendId, sGroupId
// RETURN: None
// -----------------------
function fSwitchRadio(sElemendId,sGroupId){
	var sClassName;
	var sLabelId;
	var aLabelId;
	var eElement;
	var aElements = document.getElementsByName(sGroupId);
	for(i=0;i<aElements.length;i++){
		aLabelId = aElements[i].id.split('-');
		sLabelId = aLabelId[0];
		for(j=1;j<aLabelId.length-1;j++){
			sLabelId += '-' + aLabelId[j];
		}
		if(sElemendId == sLabelId){
			document.getElementById(aElements[i].id).checked = true;
			if(document.getElementById(sLabelId).className.match('-red-')){
				document.getElementById(sElemendId).className = document.getElementById(sElemendId).className.replace(/radio-red-empty/, 'radio-red-checked');
			} else {
				document.getElementById(sElemendId).className = document.getElementById(sElemendId).className.replace(/radio-empty/, 'radio-checked');
			}
		} else {
			document.getElementById(aElements[i].id).checked = false;
			if(document.getElementById(sLabelId).className.match('-red-')){
				document.getElementById(sLabelId).className = document.getElementById(sLabelId).className.replace(/radio-red-checked/, 'radio-red-empty');
			} else {
				document.getElementById(sLabelId).className = document.getElementById(sLabelId).className.replace(/radio-checked/, 'radio-empty');
			}
		}
	}
	return;
}
// -----------------------
// FUNCTION: fGenerateMySunDropdown
// DESCRIPTION: A function that generates the js and css drop down.
// ARGUMENTS: sTargetId,nWidth
// RETURN: None
// -----------------------
function fGenerateMySunDropdown(sTargetId,nWidth){
	var eTargetElement = document.getElementById(sTargetId);
	var eTargetContainer = document.getElementById(sTargetId + '-container');
	var eTargetContainerOpen = document.getElementById(sTargetId + '-open-container');
	var nTargetElementSelected = eTargetElement.selectedIndex;
	var nDropdownLength = eTargetElement.length;
	eTargetContainer.className = eTargetContainer.className + ' bg-my-sun-select-area';
	eTargetContainerOpen.className = eTargetContainerOpen.className.replace(/-area/,'-area-open-all');
	eTargetContainerOpen.className = eTargetContainerOpen.className + ' bg-my-sun-select-area-open access-text';
	var sHTML = '';
	sHTML += '<div id="' + sTargetId + '-choice-container" class="bg-' + nWidth + '-area-open-all-choice">OPTION-CHOICE</div>';
	sHTML += '<div class="bg-' + nWidth + '-area-open-all-inner">';
	for(i=0;i<=nDropdownLength-1;i++){
		sHTML += '<a href="#" onclick="fAssignMySunDropdownSelection(\'' + sTargetId + '\',' + i + ');return false;">' + eTargetElement[i].innerHTML + '</a>';
		if(i == nTargetElementSelected){
			eTargetContainer.innerHTML = '<a href="#" onclick="fOpenDropdownSelection(\'' + sTargetId + '\');return false;">' + eTargetElement[i].innerHTML + '</a>';
			sHTML = sHTML.replace(/OPTION-CHOICE/,eTargetElement[i].innerHTML);
		}
	}
	sHTML += '</div>';
	eTargetContainerOpen.innerHTML = sHTML;
}
// -----------------------
// FUNCTION: fAssignMySunDropdownSelection
// DESCRIPTION: A function that assigns a users choice for the js and css drop down.
// ARGUMENTS: sTargetId, sTargetSelection
// RETURN: None
// -----------------------
function fAssignMySunDropdownSelection(sTargetId,sTargetSelection){
	var eTargetElement = document.getElementById(sTargetId);
	var eTargetContainer = document.getElementById(sTargetId + '-container');
	var eTargetContainerOpen = document.getElementById(sTargetId + '-open-container');
	eTargetElement.selectedIndex = sTargetSelection;
	if(document.getElementById(sTargetId + '-choice-container')){
		document.getElementById(sTargetId + '-choice-container').innerHTML = eTargetElement.options[eTargetElement.selectedIndex].innerHTML;
	}
	eTargetContainer.innerHTML = '<a href="#" onclick="fOpenDropdownSelection(\'' + sTargetId + '\');return false;">' + eTargetElement.options[eTargetElement.selectedIndex].innerHTML + '</a>';
	//eTargetContainerOpen.className = eTargetContainerOpen.className + ' access-text';
}
// -----------------------
// FUNCTION: fGenerateDropdown
// DESCRIPTION: A function that generates the js and css drop down.
// ARGUMENTS: sTargetId, sOnChangeFunction
// RETURN: None
// -----------------------
function fGenerateDropdown(sTargetId, sOnChangeFunction){
	var eTargetElement = document.getElementById(sTargetId);
	var eTargetContainer = document.getElementById(sTargetId + '-container');
	var eTargetContainerOpen = document.getElementById(sTargetId + '-open-container');
	var nTargetElementSelected = eTargetElement.selectedIndex;
	var nDropdownLength = eTargetElement.length;
	var nSizeofDropdown;
	if(nDropdownLength >= 9){
		nSizeofDropdown = 9;
	} else {
		nSizeofDropdown = nDropdownLength;
	}
	eTargetContainer.className = eTargetContainer.className + ' bg-select-area';
	eTargetContainerOpen.className = eTargetContainerOpen.className.replace(/-area/,'-area-open-' + nSizeofDropdown);
	eTargetContainerOpen.className = eTargetContainerOpen.className + ' bg-select-area-open access-text';
	var sHTML = '';
	for(i=0;i<=nDropdownLength-1;i++){
		if(typeof sOnChangeFunction != "undefined") {
			sHTML += '<a href="#" onclick="fAssignDropdownSelection(\'' + sTargetId + '\',' + i + ');'+sOnChangeFunction+'(\''+sTargetId+'\','+i+');return false;">' + eTargetElement[i].innerHTML + '</a>';
		}
		else {
		sHTML += '<a href="#" onclick="fAssignDropdownSelection(\'' + sTargetId + '\',' + i + ');return false;">' + eTargetElement[i].innerHTML + '</a>';
		}
		if(i==nTargetElementSelected){
			if(typeof sOnChangeFunction != "undefined") {
				eTargetContainer.innerHTML = '<a href="#" onclick="fOpenDropdownSelection(\'' + sTargetId + '\');'+sOnChangeFunction+'(\''+sTargetId+'\','+i+'); return false;">' + eTargetElement[i].innerHTML + '</a>';
			}
			else {
			eTargetContainer.innerHTML = '<a href="#" onclick="fOpenDropdownSelection(\'' + sTargetId + '\');return false;">' + eTargetElement[i].innerHTML + '</a>';
		}
	}
	}
	eTargetContainerOpen.innerHTML = sHTML;
}
// -----------------------
// FUNCTION: fAssignDropdownSelection
// DESCRIPTION: A function that assigns a users choice for the js and css drop down.
// ARGUMENTS: sTargetId, sTargetSelection
// RETURN: None
// -----------------------
function fAssignDropdownSelection(sTargetId,sTargetSelection){
	var eTargetElement = document.getElementById(sTargetId);
	var eTargetContainer = document.getElementById(sTargetId + '-container');
	var eTargetContainerOpen = document.getElementById(sTargetId + '-open-container');
	eTargetElement.selectedIndex = sTargetSelection;
	eTargetContainer.innerHTML = '<a href="#" onclick="fOpenDropdownSelection(\'' + sTargetId + '\');return false;">' + eTargetElement.options[eTargetElement.selectedIndex].innerHTML + '</a>';
	//eTargetContainerOpen.className = eTargetContainerOpen.className + ' access-text';
}
// -----------------------
// FUNCTION: fOpenDropdownSelection
// DESCRIPTION: A function that opens the targeted js and css drop down.
// ARGUMENTS: sTargetId
// RETURN: None
// -----------------------
function fOpenDropdownSelection(sTargetId){
	if(nDropDownCount==1){
		return false;
	}
	sCurrentDropDown = sTargetId;
	document.onclick = fCloseDropDownSelection;
	var eTargetContainerOpen = document.getElementById(sTargetId + '-open-container');
	eTargetContainerOpen.className = eTargetContainerOpen.className.replace(/access-text/,'');
}
// -----------------------
// FUNCTION: fCloseDropDownSelection
// DESCRIPTION: A function that closes the targeted js and css drop down when user clicks on the page.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fCloseDropDownSelection(){
	var eTargetContainerOpen = document.getElementById(sCurrentDropDown + '-open-container');
	if(nDropDownCount==1){
		eTargetContainerOpen.className = eTargetContainerOpen.className + ' access-text';
		nDropDownCount--;
		document.onclick = '';
	} else {
		nDropDownCount++;
	}
}
// -----------------------
// FUNCTION: fPopUp
// DESCRIPTION: A function that opens a pop up window.
// ARGUMENTS: Width, Height and URL
// RETURN: True
// -----------------------
function fPopUp(nWidth,nHeight,sUrl) {
	var nScrWidth = nWidth;
	var nScrHeight = nHeight;
	// Tip: This makes the window top right.
	// Tip: 11 pixels is for the vertical scrollbar on the right hand side of the window
	//var nXPos = (screen.availWidth - nScrWidth - 11);
	var nYPos = 0;
	var nXPos = 0;
	var sOptions = 'resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=' + nYPos + ',left=' + nXPos +',width=' + nScrWidth + ',height=' + nScrHeight;
	oNewWindow = window.open(sUrl,'popupWindow',sOptions);
	oNewWindow.focus();
	return true;
}

// -----------------------
// FUNCTION: fPopUpNewWin
// DESCRIPTION: A function that opens a pop up window from a popup window in a new window.
// ARGUMENTS: Width, Height and URL
// RETURN: True
// -----------------------
//function fPopUpNewWin(nWidth,nHeight,sUrl) {
//	var nScrWidth = nWidth;
//	var nScrHeight = nHeight;
	// Tip: This makes the window top right.
	// Tip: 11 pixels is for the vertical scrollbar on the right hand side of the window
	//var nXPos = (screen.availWidth - nScrWidth - 11);
//	var nYPos = 0;
//	var nXPos = 0;
//	var sOptions = 'resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,top=' + nYPos + ',left=' + nXPos +',width=' + nScrWidth + ',height=' + nScrHeight;
//	oNewWindow = window.open(sUrl,'popupWindow',sOptions);
//	oNewWindow.focus();
//	return true;
//}

/*** TO DO - Check this script ***/
// -----------------------
// FUNCTION: fDetectExternalURL
// DESCRIPTION: A function that detects If the URL is External.
// ARGUMENTS: sUrl
// RETURN: None
// -----------------------
function fDetectExternalURL(sUrl){
	var sLocation=window.location+'';
	sUrl=sUrl+'';
	sLocation=sLocation.replace('http://','');
	if(sUrl.search('http://')== -1) { //If the link is relative
		return false;
	}
	else{
		sUrl=sUrl.replace('http://','');
	}
	var nLastIndex=sUrl.indexOf('/');
	if(nLastIndex == -1) //Checks if the Given Url contains the / characters
		nLastIndex=sUrl.length;
	if(sLocation.substring(0,sLocation.indexOf('/')) == (sUrl.substring(0,nLastIndex)))
		return false;
	else
		return true;
}
// -----------------------
// FUNCTION: fDetect
// DESCRIPTION: A function that detects which OS and browser the user has.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fDetect() {
	var sAgent = navigator.userAgent.toLowerCase();
	// Detect platform
	this.isMac = (sAgent.indexOf('mac') != -1);
	this.isWin = (sAgent.indexOf('win') != -1);
	this.isWin2k = (this.isWin && (sAgent.indexOf('nt 5') != -1));
	this.isWinSP2 = (this.isWin && (sAgent.indexOf('xp') != -1 || sAgent.indexOf('sv1') != -1));
	this.isUnix = (
			sAgent.indexOf('unix') != -1 || 
			sAgent.indexOf('sunos') != -1 || 
			sAgent.indexOf('bsd') != -1 ||
			sAgent.indexOf('x11') != -1 || 
			sAgent.indexOf('linux') != -1);	
	// Detect browser
	this.isSafari = (sAgent.indexOf('safari') != -1);
	this.isSafari2 = (this.isSafari && (parseFloat(sAgent.substring(sAgent.indexOf("applewebkit/")+"applewebkit/".length,sAgent.length).substring(0,sAgent.substring(sAgent.indexOf("applewebkit/")+"applewebkit/".length,sAgent.length).indexOf(' '))) >=  300));
	this.isOpera = (sAgent.indexOf('opera') != -1);
	this.isNN = (sAgent.indexOf('netscape') != -1);
	this.isIE = (sAgent.indexOf('msie') != -1);
}
fDetect(); // calls function to determine which browser is in use
// -->



// -----------------------
// FUNCTION: function sethomepg(obj)
// DESCRIPTION: A function that sets the google as the home page.
// ARGUMENTS: Page
// RETURN: None
// -----------------------
function sethomepg(obj)
{
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage('http://www.google.com');
}



// -----------------------
// FUNCTION: fLoadDynamicCSS
// DESCRIPTION: A function that loads dynamic css files
// ARGUMENTS: sFileName
// RETURN: None
// -----------------------
function fLoadDynamicCSS(sFileName){
	var eLinkElement=document.createElement("link");
	eLinkElement.setAttribute("rel", "stylesheet");
	eLinkElement.setAttribute("type", "text/css");
	eLinkElement.setAttribute("href", sFileName);
	
	if(typeof eLinkElement!="undefined"){
		document.getElementsByTagName("head")[0].appendChild(eLinkElement);
		
	}	
}



// -----------------------
// FUNCTION: fRightClick
// DESCRIPTION: A function that perfoms process associated with right click
// ARGUMENTS: e
// RETURN: None
// -----------------------
function fRightClick(e) {
	if (navigator.appName == 'Netscape' && e.which == 3) {
		alert(sCopyRightMessage);
		return false;
	}
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
		alert(sCopyRightMessage);
		return false;
	}
	else
		return true;
}
// -----------------------
// FUNCTION: fDetectRightClick
// DESCRIPTION: A function thatdetects right click on images
// ARGUMENTS: none
// RETURN: None
// -----------------------
function fDetectRightClick() 
{
	try
	{
		if(bDisableRightClick&&document.images) 
		{
			for(i=0;i<document.images.length;i++) {
				document.images[i].onmousedown = fRightClick;
				document.images[i].onmouseup = fRightClick;
			}
		}
	}catch(ex){}
}

//Begin: Associate fDetectRight function on windows load
if (window.addEventListener) //DOM method for binding an event
	window.addEventListener("load", fDetectRightClick, false);
else if (window.attachEvent) //IE exclusive method for binding an event
	window.attachEvent("onload", fDetectRightClick);
else if (document.getElementById) //support older modern browsers
	window.onload=fDetectRightClick;
//end: Associate fDetectRight function on windows load	




// -----------------------
// FUNCTION: fChangeClassName
// DESCRIPTION: A function to change the className of an ID
// ARGUMENTS: changeID, classname
// ARGUMENT VALUES: changeID = the ID of the element to change, classname = the class name to change element to
// RETURN: None
// -----------------------
function fChangeClassName(changeID, classname) {
	document.getElementById(changeID).className = classname;
}


// -----------------------
// FUNCTION: fGoToPage
// DESCRIPTION: A function to send a user to a URL via javascript
// ARGUMENTS: URL
// RETURN: None
// -----------------------
function fGoToPage(URL) {
var target;
if(fDetectExternalURL(URL)){
	target="_blank";
}
else{
	target="_self";
}
	window.open(URL, target);
}
// -----------------------
// FUNCTION: fPopUpCustomPosition
// DESCRIPTION: A function that opens a pop up window with custom position.
// ARGUMENTS: nWidth, nHeight, sPopUpName, sURL, nLeft, nTop
// RETURN: True
// -----------------------
function fPopUpCustomPosition(nWidth, nHeight, sPopUpName, sURL, bShowScrollBar, bShowLocationBar, bShowResizeBar, bShowMenubar, bShowStatusbar, bShowToolbar, nLeft, nTop){
	var nCenterWidth= (window.screen.width - nWidth) / 2;
	var nCenterHeight = (window.screen.height - nHeight) / 2;
	
	if(typeof nLeft != 'undefined'){	
		nCenterWidth= nLeft;
	}
	if(typeof nTop != 'undefined'){
		nCenterHeight= nTop;
	}
	
	if(typeof bShowScrollBar == 'undefined'){
		bShowScrollBar= 'no';
	}
	if(typeof bShowLocationBar == 'undefined'){
		bShowLocationBar= 'no';
	}
	if(typeof bShowResizeBar == 'undefined'){
		bShowResizeBar= 'no';
	}
	if(typeof bShowMenubar == 'undefined'){
		bShowMenubar= 'no';
	}
	if(typeof bShowStatusbar == 'undefined'){
		bShowStatusbar= 'no';
	}
	if(typeof bShowToolbar == 'undefined'){
		bShowToolbar= 'no';
	}
	
	var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	if(isIE6 && (bShowMenubar == "1" || bShowMenubar == "yes")) {
		nHeight = parseInt(nHeight)-19;
	}

	var oPopup=window.open(sURL, sPopUpName, 'scrollbars='+bShowScrollBar+',location='+bShowLocationBar+',resizable='+bShowResizeBar+',menubar='+bShowMenubar+',status='+bShowStatusbar+',toolbar='+bShowToolbar+', width=' + nWidth + ',height=' + nHeight + ',left=' + nCenterWidth + ',top=' + nCenterHeight);
	oPopup.focus();
}


//FUNCTION: bkmk
//DESCRIPTION: A sets homepage or bookmark
//ARGUMENTS: Bookmark text
//RETURN: bkmk object
//-----------------------
function Bkmk(sText)
{
  var ua=navigator.userAgent.toLowerCase(),
	  a,
	  img;
	var o=
	{
		title:document.title,
		url:document.location.href,
		is_ff:(ua.indexOf("firefox")>-1),
		is_ie:(ua.indexOf("msie")>-1),
		is_op:(ua.indexOf("opera")>-1),
		cont:document.getElementById('bkmark'),
		root:'/img/buttons/',
		sup:0
	};
	if (o.cont)
	{
		a=document.createElement('a');
		if(sText == null)
		{
		img=document.createElement('img');
		img.src=o.root+"bookmark.gif";
		}
		//firefox
		if (o.is_ff)
		{
			o.sup=1;
			a.href="javascript:bookmark.func();";
			if(sText == null)
			{
			o.cont.style.position="relative";
			o.cont.style.top="3px";
			}
			o.func=function()
			{
				if (window.sidebar) // firefox
					window.sidebar.addPanel(o.title, o.url, "");
			};
		}
		//ie
		else if (o.is_ie)
		{
			o.sup=1;
			if(sText == null)
			{
				img.src=o.root+"home.gif";
				o.cont.style.position="relative";
				o.cont.style.top="2px";
			}
			//a.href="javascript:history.go(0);";
			a.href="javascript:function(){return 0;}";
			a.onclick=makeHome;

		}
		//opera
		else if (o.is_op)
		{
			 o.sup=1;
			 a.href=o.url;
			 a.rel='sidebar'; // this makes it work in Opera 7+
		}
		if (o.sup)
		{
			if(sText == null)
			{
				a.appendChild(img);
			}
			else
				a.innerHTML=sText;
			o.cont.appendChild(a);
		}
	}
	function makeHome()
	{
		var a=o.cont.childNodes[0];
		a.style.behavior="url(#default#homepage)";
		a.setHomePage(o.url);
	};
	return o;
}

//Masthead Promotional links
var newsitems,curritem=0,iPause=0;
$("#tick-nav").ready(function(){
    var tics = "#tick-box a";
    newsitems=$(tics).hide().filter(":eq(0)").show().add(tics).size();
	$("#tick-box a,#tick-nav a").hover(function(){iPause=1;},function(){iPause=0;});
	$("a#tick-bk").click(function (){
		$("#tick-box a:eq("+curritem+")").hide();
		curritem=(curritem!=0)?--curritem:newsitems-1;
		$("#tick-box a:eq("+curritem+")").show();
	});
	$("a#tick-nx").click(tic);
    setInterval(function(){if(iPause==0){tic();}},7000);
});
function tic(){
	$("#tick-box a:eq("+curritem+")").hide();
    curritem=++curritem%newsitems;
    $("#tick-box a:eq("+curritem+")").show();
}

function fChangeSearchImage(optionValue, elementID) {	
	if(optionValue == "external") {
		document.getElementById(elementID).style.display="inline";
	}
	else {
		document.getElementById(elementID).style.display="none";
	}
}

//-----------------------
//FUNCTION: set_cookie
//DESCRIPTION: Sets cookie in browser.
//ARGUMENTS: name - Cookie name , value - cookie value, seconds - TTL cookie, path - cookie path
//RETURN: None
//-----------------------

function set_cookie ( name, value, seconds, path )
{
var cookie_string = name + "=" + escape ( value );

if ( seconds )
{
var expires = new Date();
expires.setTime(expires.getTime() + (seconds*1000));
cookie_string += "; expires=" + expires.toGMTString();
}

if ( path )
   cookie_string += "; path=" + escape ( path );
else
		cookie_string += "; path=/";

document.cookie = cookie_string;
}


//-----------------------
//FUNCTION: get_cookie
//DESCRIPTION: gets cookie with supplied name.
//ARGUMENTS: cookie_name - name of cookie to be retrived 
//RETURN: cookie value
//
function get_cookie ( cookie_name )
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

if ( results )
return ( unescape ( results[2] ) );
else
return null;
}

//-----------------------
//FUNCTION: delete_cookie
//DESCRIPTION: deletes cookie with supplied name.
//ARGUMENTS: cookie_name - name of cookie to be deleted 
//RETURN: none
//
function delete_cookie ( cookie_name )
{
var cookie_date = new Date ( );  // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
//-----------------------
//FUNCTION: GetQueryString
//DESCRIPTION: returns the value for a specified name value pair
//ARGUMENTS: returns the value for a specified name value pair 
//RETURN: none
//
function GetQueryString(str) {
	var hu = window.location.search.substring(1);
	var gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == str) {
			return ft[1];
		}
	}
}

//-----------------------
//FUNCTION: setYahooCookie
//DESCRIPTION: Sets the yahoo cookie
//ARGUMENTS: none 
//RETURN: none
//
function setYahooCookie() 
{
	if (get_cookie('YH') == "yes" || IsYahoo == "yes") {
		set_cookie ("YH", "open", "30", "" );
	} else {
		set_cookie ("YH", "no", "", "" );
	}
	return true;
}


//-----------------------
//FUNCTION: sswap
//DESCRIPTION: behaviour for main search  box
//
function sswap(n)
{ 
 var pn=n.parentNode,
  mk="search-bx",
  mk2="search-dis",
  mk3="search-lst",
  mk4="-search",
  img,
  fm;
 //show drop down
 if (pn&&(pn.innerHTML).indexOf('-hide')>-1)
  pn.innerHTML=(pn.innerHTML).replace('-hide','');
 //hide drop down, show selected value, update view, display image if required
 else 
 {
  while (pn.parentNode&&pn.className!=mk)
   pn=pn.parentNode;
  for (var i=0;i<pn.childNodes.length;i++)
  {
   if (pn.childNodes[i].className&&pn.childNodes[i].className==mk2)
   {
    //update selected value
    pn.childNodes[i].innerHTML=n.innerHTML;
    i=pn.childNodes.length;
   }
  }
  //hide drop down
  pn.innerHTML=(pn.innerHTML).replace(mk3,mk3+'-hide'); 

  //update view
  mk4=pn.getAttribute("pid")+mk4;
  fm=document.getElementById(mk4);
  if (fm)
   fm.view.value=n.getAttribute("prop");
   fm.searchType.value=n.getAttribute("prop");

  //show/hide image
  img=document.getElementById(mk4+'-img');
  if (img&&n.getAttribute("sim")=="1")
   img.className=img.className.replace('-hide','');
  else if (img&&img.className.indexOf('-hide')<0)
   img.className=img.className+'-hide';
 }
}

function showResults(n)
{
  var qry=trimString(n.query.value); //this would be ur text box value
 if(qry.length>1)
 {
  qry=checkString(qry);
  if(qry==0)
   return true;
 }
 alert('Please Enter A Valid Search Term');
 return false;
}

//------------------------------------------------------------------------------
//yahoo cookie setup in the head

var yahoo = "no";
var IsYahoo="no";
if (GetQueryString("yahoo")=="yes" || get_cookie('YH') == "yes") 
    IsYahoo="yes";
if (IsYahoo == "yes" || get_cookie('YH') == 'open') 
{
    set_cookie ("YH", "yes", "", "" );
    yahoo = "yes";
} 
else 
{
    set_cookie ("YH", "no", "", "" );
    yahoo = "no";
}
window.onunload = setYahooCookie;


//Variables required for DART. MUST BE IN THE HEAD.
var time = new Date();
randnum = (time.getTime());

var categoryValues = '';

if (document.referrer != null) 
{ 

	if (document.referrer.match(".google.") != null || 
		document.referrer.match(".yahoo.") != null ||
		document.referrer.match(".lycos.") != null ||
		document.referrer.match(".ask.") != null ||
		document.referrer.match(".msn.") != null) {

	 categoryValues = '!category=sunoverlays;';
	}
}

try {document.execCommand("BackgroundImageCache", false, true);} catch(err) {}
	
	
	// Start: Including Revenue Sciences client script 
		var rsi_segs = [];
		var segs_beg=document.cookie.indexOf('rsi_segs=');
		if(segs_beg>=0){
		segs_beg=document.cookie.indexOf('=',segs_beg)+1;
		if(segs_beg>0){
		var segs_end=document.cookie.indexOf(';',segs_beg);
		if(segs_end==-1)segs_end=document.cookie.length;
		rsi_segs=document.cookie.substring(segs_beg,segs_end).split('&');
		}}
		var segQS = rsi_segs.length> 0 ? "rsi=" + rsi_segs[0] +";" : "";
		for (var i = 1; i <rsi_segs.length && i <20; i++)
		segQS += ("rsi" + "=" + rsi_segs[i] + ";");
	// End: Including Revenue Sciences client script


//------------------------------------------------------------------------------