function hiddeTopBottomScroll(){
	if ($('scrollTop'))
		$('scrollTop').setStyles({
			display:'none'
		});
	if ($('scrollBottom'))
		$('scrollBottom').setStyles({
			display:'none'
		});
}

function showTopBottomScroll(){
	if ($('scrollTop'))
		$('scrollTop').setStyles({
			display:'block'
		});
	if ($('scrollBottom'))
		$('scrollBottom').setStyles({
			display:'block'
		});
}

function changeFontProgress(progressDiv,active){
	var selectedProgress = $(progressDiv);
	if (selectedProgress){
		var summary = selectedProgress.getElements('p');
		if (summary){
			if (active){
				summary[0].addClass('progressSelected');
			}else{
				summary[0].removeClass('progressSelected');	
			}
		}
	}
}

function addSummaryLink(progressDiv, reportURL, title){
	var selectedProgress = $(progressDiv);
	if (selectedProgress){
		var summary = selectedProgress.getElements('p');
		var summaryLink = selectedProgress.getElements('a');
		if (summary){
			summary[0].addEvent('mouseenter',function(){
				summary[0].addClass("progressSelected");
				summaryLink[0].addClass("progressLinkSelected");
			});
			summary[0].addEvent('mouseleave',function(){
				summary[0].removeClass("progressSelected");
				summaryLink[0].removeClass("progressLinkSelected");
			});
			summary[0].addEvent('click',function(){
				trackingProgress(title);
				window.location.href=reportURL;	
			});
		}
	}
}


function trackingProgress(title){	
	
	var tTrack;
	if (title && title.length >= 25){
		tTrack = (title.substring(0,25)).toUpperCase();
	}
	else{
		tTrack = title.toUpperCase();
	}
	clickTrack({s_linkName:'REINVENT | PROGRESS | REPORT | '+tTrack, s_prop1:'PROGRESS', s_prop2:'REPORT', s_prop3:'PROGRESS | REPORT', s_prop4:'REPORT | '+tTrack, s_prop25:'REINVENT'});
}

function trackingAllProgress(){
	clickTrack({s_linkName:'REINVENT | PROGRESS | REPORTS_ALL', s_prop1:'PROGRESS', s_prop2:'REPORTS_ALL', s_prop3:'PROGRESS | REPORTS_ALL', s_prop25:'REINVENT'});
}

function trackingFeatureStory(){
	clickTrack({s_linkName:'REINVENT | NEWS | FEATURE', s_prop1:'NEWS', s_prop2:'FEATURE', s_prop3:'NEWS | FEATURE', s_prop25:'REINVENT'});	
}

function loadContributors(){
	var impFlash = document.getElementById("flashTrack").value;
	impUri = "http://" + window.location.hostname + ( window.location.port =="8080" ? ":8080/" : "/" );
	var flashVars = "BASE_CONTEXT=" + impUri + "&model=flash/ScrollMenuData.xml&path=flash/&trackPath=" + impFlash;
	if(!$('track0'))
		ScrollLoad ("scrollholder1", "scroll1", false);
			
	if (typeof sIFR == "function" && useFlash) {
		sIFR.replaceElement(named({oNodeRef: document.getElementById("contributorsBox"), sFlashSrc: "flash/ScrollMenu.swf", sFlashVars: flashVars, sWmode: "transparent", sBgColor:"#FFFFFF"}));
	}
	if($('cContent'))
		$('cContent').setStyles({
			height:1190
		});
}

function loadChats(){
	impUri = window.location.href;
	if (impUri.indexOf(":8080") > -1) {
		impUri = "http://" + window.location.hostname + ':' + window.location.port;
	} else {
		impUri = window.location.href;
		if (impUri.indexOf("?") > -1)
			impUri = impUri.substring(0,impUri.indexOf("?"));
		if (impUri.indexOf("index.php") > - 1)
			impUri = impUri.substring(0,impUri.indexOf("index.php"));
		if (impUri.charAt(impUri.length -1) == "/")
			impUri = impUri.substring(0,impUri.length-1);	
	}
	if (typeof sIFR == "function" && useFlash) {
		sIFR.replaceElement(named({oNodeRef: document.getElementById("chatBox"), sFlashSrc: "flash/ScrollMenuChat.swf?v=1", sFlashVars:"pathDomain=" + impUri, sWmode: "transparent", sBgColor:"#FFFFFF"}));
		
	}
}


function closeSurvey() {
	createCookie("gmCustomerXPSurvey",true,30);
	document.getElementById("gmCustomerXPSurvey").style.display = "none";	
}

function openSurvey() {
	if ($('gmCustomerXPSurvey')) {
		var cookiedSurvey = readCookie("gmCustomerXPSurvey");
		if (!cookiedSurvey) {
			var impRandom = Math.random() * 99 + 1;
			if (impRandom < 30) {
				createCookie("gmCustomerXPSurvey",true,30);
				document.getElementById("gmCustomerXPSurvey").style.display = "block";
			}
		}
	}
}

function continueSurvey() {
	popUpWindow('https://www.onlineconsumersurveys.com/R.aspx?a=127','gmCustomerXPSurvey','width=1100,height=650,scrollbars=yes');
	createCookie("gmCustomerXPSurvey",true,30);
	closeSurvey();
}

function showClearCache() {
	$('clearCachePopup').style.display = "block";
}

function hideClearCache() {
	$('clearCachePopup').style.display = "none";
}

function limitNews() {
	$$("#leftNewsContainer div.storyIntro p")[0].innerHTML = $$("#leftNewsContainer div.storyIntro p")[0].innerHTML.substring(0,214);
	$$("#leftNewsContainer h5.storyTitle")[0].innerHTML = $$("#leftNewsContainer h5.storyTitle")[0].innerHTML.substring(0,34);
}