<!--

function openWindow(theURL,winName,features, myWidth, myHeight, isCenter){
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function doUpdateLogin(objT){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(objT.value)){
			document.getElementById('emailCell').innerHTML = objT.value;
	}
	else{
		document.getElementById('emailCell').innerHTML = '';
	}
	return false;
}

function switchVideo(intVideo){
	document.getElementById('video').src='video_'+intVideo+'.html';
}

function showSurvey(intSurvey){
	var objFrame = document.getElementById('mymapFrame');
	if(intSurvey == 1){
		objFrame.src = 'goodcall-survey.php';
	}
	else if(intSurvey == 2){
		objFrame.src = 'vak-survey.php';
	}
	document.getElementById('mymapFrame').style.display = 'block';
	document.getElementById('mymapMenu').style.display = 'none';
	return false;
}

function showAdmin(strFocus){
	if((strFocus == 'export') || (strFocus == 'credits') || (strFocus == 'viewlog')){
		document.location.href='?action='+strFocus;
	}
	else{
		if(strFocus == 'manage_add'){
			document.location.href='manager.php?focus=user&subfocus=user&freeform=1';
		}
		else if(strFocus.indexOf('manage_') >= 0){
			var arrTemp = strFocus.split('_');
			document.location.href='manager.php?focus='+arrTemp[1];
		}
		else{
			document.location.href='?action=update&focus='+strFocus;
		}
	}
}

function showAdminM(strFocus){
	if(strFocus.indexOf('manage_') >= 0){
		var arrTemp = strFocus.split('_');
		document.location.href='manager.php?focus='+arrTemp[1];
	}
	else{
		document.location.href='admin.php?action=update&focus='+strFocus;
	}
}

function showReport(strType1,strType2,intRank,intCompare){
	var strURL = 'results.php?type1='+strType1;
	if(strType2){
		strURL += '&type2='+strType2;
	}
	strURL+='&rank='+intRank;
	strURL+='&compare='+intCompare;
	document.location.href=strURL;
}

function backOne(){
	history.go(-1)
}

function ajaxPost(intSubStep,strWizard){
	
	resetDivs(intSubStep);
	
	if(document.getElementById('peopleDel') != null){
		var arrDivs = document.getElementById('peopleDel').getElementsByTagName('div');
		var strIDs = '0';
		for(i=0;i<arrDivs.length;i++){
			if(arrDivs[i].id.indexOf('pr_') > -1 && arrDivs[i].style.display == 'block'){
				arrTemp = arrDivs[i].id.split('_');
				strIDs += ','+arrTemp[1];
			}
		}
		if(strIDs == '0'){
			intSubStep++;
			showSteps(intSubStep);
			return false;
		}
		else{
			document.forms['wForm'].people.value = strIDs;
		}
	}
	
	var objForm = document.forms['wForm'];
	var strPostFile = 'ajaxpost.php?w='+strWizard;
	
	var strPostVars = 'ajax=1';
	for(i=0; i<objForm.elements.length; i++){
		if(objForm.elements[i].type == 'radio'){
			if(objForm.elements[i].checked){
				strValue = objForm.elements[i].value;
			}
		}
		else{
			strValue = objForm.elements[i].value;
		}
		if(strValue == '0' && objForm.elements[i].name!='people' && objForm.elements[i].name!='substep' && objForm.elements[i].name!='step'){
			//	return false;
		}
		strPostVars +='&'+objForm.elements[i].name+'='+strValue;
	}
	
	intSubStep++;
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	
	objPostFile.onreadystatechange=function(){
		
		if(objPostFile.readyState==4){
			var arrRes = objPostFile.responseText.split('<HELP/>');
			showSteps(intSubStep);
			document.getElementById('substep_'+intSubStep).innerHTML = arrRes[0];
			document.getElementById('wizardHelp').innerHTML = arrRes[1];
			document.getElementById('substep_'+(intSubStep-1)).style.display = 'none';
			//document.getElementById('wizardStepDiv').scrollTop  = document.getElementById('wizardStepDiv').scrollHeight;
			if (document.body.scrollHeight) {
				window.scrollTo(0, document.body.scrollHeight);
			}
			else if (screen.height) { // IE5
					window.scrollTo(0, screen.height);
			}
		}
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
}

function backStep(intStep){
	document.forms['wForm'].people.value = 0;
	if(document.getElementById('peopleDel') != null){
		var arrDivs = document.getElementById('peopleDel').getElementsByTagName('div');
		for(i=0;i<arrDivs.length;i++){
			if(arrDivs[i].id.indexOf('pr_') > -1 && arrDivs[i].style.display == 'block'){
				arrDivs[i].style.display = 'none';
			}
		}
	}
	
	resetDivs(intStep-1);
	showSteps(intStep)
}

function resetDivs(intDiv){
	var objForm = document.forms['wForm'];
	var arrDivs = document.getElementsByTagName('div');
	var intDivP = intDiv+1;
	
	for(i=0;i<arrDivs.length;i++){
		if(arrDivs[i].id.indexOf('substep_') > -1){
			arrTemp = arrDivs[i].id.split('_');
			intDivC = parseInt(arrTemp[1]);
			if(intDivC == intDivP){
				//alert(intDivC+' == '+intDivP);
				arrDivs[i].style.display = 'block';
				var arrInp = arrDivs[i].getElementsByTagName("select");
				for (var j = 0; j < arrInp.length; j++){
					arrInp[j].value = 0;
				}
			}
			else if(intDivC > intDivP){
				//alert(intDivC+' != '+intDiv);
				arrDivs[i].style.display = 'none';
				var arrInp = arrDivs[i].getElementsByTagName("select");
				for (var j = 0; j < arrInp.length; j++){
					arrInp[j].value = 0;
				}
			}
			else if(intDivC < intDivP){
				arrDivs[i].style.display = 'none';
				
			}
		}
	}
	objForm.substep.value=intDivP;
}

function sanitizePct(objE){
	var intPct = 100;
	if(!objE.value){
		intPct = 100;
	}
	else{
		if(isInteger(objE.value)){
			intPct = parseInt(objE.value);
		}
		else{
			intPct = 0;
		}
		if(intPct > 100){
			intPct = 100;
		}
		else if(intPct < 1){
			intPct = 1;
		}
	}
	objE.value = intPct;
}

function sanitizeSens(objE){
	var intSens = 70;
	if(!objE.value){
		intSens = 70;
	}
	else{
		if(isInteger(objE.value)){
			intSens = parseInt(objE.value);
		}
		else{
			intSens = 70;
		}
		if(intSens > 70){
			intSens = 70;
		}
		else if(intSens < 1){
			intSens = 1;
		}
	}
	objE.value = intSens;
}

function isInteger (s){
	var i;
	
	if (isEmpty(s))
		if (isInteger.arguments.length == 1) return 0;
	else return (isInteger.arguments[1] == true);
	for (i = 0; i < s.length; i++){
		var c = s.charAt(i);
		if (!isDigit(c)) return false;
	}
	
	return true;
}

function isEmpty(s){
	return ((s == null) || (s.length == 0))
}

function isDigit (c){
	return ((c >= "0") && (c <= "9"))
}

function selPerson(intPerson,boolAdd){
	var objDivPL = document.getElementById('pl_'+intPerson);
	var objDivPR = document.getElementById('pr_'+intPerson);
	if(boolAdd){
		objDivPL.style.display = 'none';
		objDivPR.style.display = 'block';
		addPersonID(intPerson);
	}
	else{
		objDivPL.style.display = 'block';
		objDivPR.style.display = 'none';
		delPersonID(intPerson);
	}
	return false;
}

function selPersonAll(boolAdd){
	var arrDivs = document.getElementById('peopleAdd').getElementsByTagName('div');
	for(i=0;i<arrDivs.length;i++){
		if(arrDivs[i].id.indexOf('pl_') > -1){
			arrTemp = arrDivs[i].id.split('_');
			objPR = document.getElementById('pr_'+arrTemp[1]);
			if(boolAdd){
				if(arrDivs[i].style.display != 'none'){
					arrDivs[i].style.display = 'none';
					objPR.style.display = 'block';
					addPersonID(arrTemp[1]);
				}
			}
			else{
				arrDivs[i].style.display = 'block';
				objPR.style.display = 'none';
				delPersonID(arrTemp[1]);
			}
		}
	}
	
	return false;
}

function addPersonID(intID){
	return true;
	var strIDs = document.forms['wForm'].people.value;
	strIDs += ','+intID;
	document.forms['wForm'].people.value = strIDs;
}

function delPersonID(intID){
	return true;
	var strIDs = document.forms['wForm'].people.value;
	var arrIDs = strIDs.split(',');
	var strIDs2 = '0';
	var j = arrIDs.length;
	for(i=0;i<j;i++){
		if(arrIDs[i] != intID && arrIDs[i] > 0){
			strIDs2 += ','+arrIDs[i];
		}
	}
	document.forms['wForm'].people.value = strIDs2;
}

function filterPeople(objE){
	var strSurname = objE.value.toLowerCase();
	var strName ='';
	var arrDivs = document.getElementById('peopleAdd').getElementsByTagName('div');
	for(i=0;i<arrDivs.length;i++){
		if(arrDivs[i].id.indexOf('pl_') > -1){
			arrTemp = arrDivs[i].id.split('_');
			strName = document.getElementById('n_'+arrTemp[1]).innerHTML.toLowerCase();
			objPR = document.getElementById('pr_'+arrTemp[1]);
			if(objPR.style.display == 'none'){
				if(strName.indexOf(strSurname ) == 0){
					arrDivs[i].style.display = 'block';
				}
				else{
					arrDivs[i].style.display = 'none';
				}
			}
		}
	}
	return true;
}

function blockEnter(evt){
	return false;
}

var intT = 0;

function processTemplate(strWizard,intTemplate){
	
	var strPostFile = 'ajaxpost.php?w='+strWizard;
	var strPostVars = 'ajax=1&template='+intTemplate;
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	objPostFile.onreadystatechange=function(){
		if(objPostFile.readyState==4){
			intT++;
			//alert(intT);
			//alert(objPostFile.responseText);
			
			if(objPostFile.responseText.length < 10){
				//document.getElementById('wizardTemplate').innerHTML = '<p>[NEXT STEP TBC]</p>';
				//document.location.href='results.php?report=teammap&template='+objPostFile.responseText;
				document.location.href='results.php?nb=1&report=view&type1='+strWizard+'&list1[]='+objPostFile.responseText;
			}
			else{
				document.getElementById('wizardTemplate').innerHTML = objPostFile.responseText;
				if(intT <= 70){
					processTemplate(strWizard,intTemplate);
				}
			}
		}
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
	
}

function doValidateForm(objF){
	
	
	if(typeof(objF.wSub) == 'undefined'){
		return false;
	}
	return true;
}

function uol(objC){
	updateObjectList(objC);
}

function updateObjectList(objC){
	var objTR = document.getElementById('t_'+objC.value);
	var objF = document.forms['fForm'];
	var intC = 0;
	for(i=0; i<objF.elements.length; i++){
		if(objF.elements[i].type == 'checkbox' && objF.elements[i].checked){
			intC++;
		}
	}
	if(intC > parseInt(objF.max.value)){
		objC.checked = false;
	}
	if(objC.checked){
		objTR.style.backgroundColor='#DEDE7B';
	}
	else{
		objTR.style.backgroundColor='#D2ECF2';
	}
}

function finderPost(){
	var objForm = document.forms['fForm'];
	var strPostFile = 'ajaxpost.php?w=finder';
	var strPostVars = 'ajax=1';
	for(i=0; i<objForm.elements.length; i++){
		if(objForm.elements[i].type == 'checkbox'){
			if(objForm.elements[i].checked){
				strPostVars +='&list[]='+objForm.elements[i].value;
			}
		}
		else{
			strPostVars +='&'+objForm.elements[i].name+'='+objForm.elements[i].value;
		}
	};
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	objPostFile.onreadystatechange=function(){
		if(objPostFile.readyState==4){
			document.getElementById('finderList').innerHTML = objPostFile.responseText;
		}
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
}

function finderPostKey(event){
	var key;
	if(window.event){
		key = window.event.keyCode;
	}
	else{
		key = event.which;
	}
	if (key == 13) {
		finderPost();
		return false;
	}
}

function us(objC){
	updateSurvey(objC);
}

function updateSurvey(objC){
	var objForm = document.forms['fForm'];
	var strPostFile = 'ajaxpost.php?w=usurvey';
	var strPostVars = 'ajax=1&s='+objC.value;
	if(objC.checked == true){
		strPostVars += '&c=1';
	}
	else{
		strPostVars += '&c=0';
	}
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
}

function ua(strFocus,objC){
	updateArchive(strFocus,objC);
}

function updateArchive(strFocus,objC){
	var objForm = document.forms['fForm'];
	var strPostFile = 'ajaxpost.php?w=uarchive';
	var strPostVars = 'ajax=1&f='+strFocus+'&s='+objC.value;
	if(objC.checked == true){
		strPostVars += '&c=1';
	}
	else{
		strPostVars += '&c=0';
	}
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
}

function toggleResource(intC,intS){
	var objDiv = document.getElementById('cat_'+intC+'_'+intS);
	if(objDiv.style.display == 'none'){
		objDiv.style.display = 'block';
	}
	else{
		objDiv.style.display = 'none';
	}
	return false;
}

function toggleStatement(intS){
	var objDiv1 = document.getElementById('summary_'+intS);
	var objDiv2 = document.getElementById('mymap_'+intS);
	var objDiv3 = document.getElementById('toggle_'+intS);
	if(objDiv1.style.display == 'none'){
		objDiv1.style.display = 'block';
		objDiv2.style.display = 'none';
		objDiv3.style.backgroundPosition = '-14px 0px';
	}
	else{
		objDiv1.style.display = 'none';
		objDiv2.style.display = 'block';
		objDiv3.style.backgroundPosition = '0px 0px';
	}
	var strReveal = '9';
	for(i=0;i<4;i++){
		var objDiv = document.getElementById('summary_'+i);
		if(objDiv.style.display == 'block'){
			strReveal += ','+i;
		}
	}
	document.cookie = 'gc_stat='+strReveal+'; expires=Thu, 2 Aug 2101 20:47:11 UTC; path=/';
	return false;
}

function viewAllFinder(){
	var objF = document.forms['fForm'];
	if(typeof(objF.f_surname) != 'undefined'){
		objF.f_surname.value = '';
	}
	finderPost();
	return false;
}

function viewVideo(intVideo){
	var objDiv = document.getElementById('video_div');
	var objDiv2 = document.getElementById('video_frame');
	var objDiv3 = document.getElementById('result_div');
	if(intVideo > 0){
		objDiv.style.display='block';
		objDiv2.src='help.php?video='+intVideo;
		objDiv3.style.display='none';
	}
	else{
		objDiv.style.display='none';
		objDiv2.src='';
		objDiv3.style.display='block';
	}
	return false;
}

var objLastI;

function managePost(objS,intPos,intCutOff){
	if(objLastI != objS){
		objLastI = objS;
	}
	else{
		if(objS.type == 'text'){
			return false;
		}
	}
	
	var objForm = document.forms['mForm'];
	var strPostFile = 'ajaxpost.php?w=manage';
	var strPostVars = 'ajax=1&pos='+intPos+'&cutoff='+intCutOff;
	for(i=0; i<objForm.elements.length; i++){
		strValue = objForm.elements[i].value;
		strPostVars +='&'+objForm.elements[i].name+'='+strValue;
	}
	if (typeof window.ActiveXObject != 'undefined'){
		objPostFile = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		objPostFile = new XMLHttpRequest();
	}
	objPostFile.onreadystatechange=function(){
		if(objPostFile.readyState==4){
			if(objPostFile.responseText == 'showform'){
				showManageForm();
			}
			else{
				if(typeof(objForm.company_country) != 'undefined'){
					if(objForm.company_country.value && objForm.temp_focus.value == 'user'){
						showManageForm();
					}
				}
				for(i=0;i<5;i++){
					var objDiv = document.getElementById('div_'+i);
					if(i>intPos && objDiv){
						objDiv.innerHTML = '';
						objDiv.style.display='none';
					}
				}
				if(intPos<5){
					if(objS.type != 'text'){
						if(objS[objS.selectedIndex].value == -1){
							var objDiv = document.getElementById('div_'+(intPos));
						}
						else{
							var objDiv = document.getElementById('div_'+(intPos+1));
						}
					}
					else{
						var objDiv = document.getElementById('div_'+(intPos+1));
					}
					objDiv.innerHTML = objPostFile.responseText;
					objDiv.style.display='block';
					//alert(objPostFile.responseText)
				}
			}
		}
	}
	objPostFile.open("POST",strPostFile,true);
	objPostFile.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	objPostFile.send(strPostVars);
}

function showManageForm(){
	document.getElementById('mMainForm').style.display = 'block';
}

function makeSurveyURL(){
	var objF = document.forms['uForm'];
	var strURL = 'survey/';
	if(objF.alloc.options[objF.alloc.options.selectedIndex].value > -1){
		var arrTemp = objF.alloc.options[objF.alloc.options.selectedIndex].text.split(" > ");
		for(i=0;i<arrTemp.length;i++){
			strURL += arrTemp[i].replace(/ /g,'-')+'/';
		}
		strURL = strURL.toLowerCase();
		document.getElementById('url_div_2').innerHTML = strURL;
		document.getElementById('url_div_1').style.display = 'block';
		document.getElementById('url_div_4').style.display = 'block';
		if(arrTemp.length > 1){
			document.getElementById('url_div_3').style.display = 'block';
		}
		else{
			document.getElementById('url_div_3').style.display = 'none';
		}
		objF.temp_url.value = strURL;
	}
	else{
		document.getElementById('url_div_2').innerHTML = '';
		document.getElementById('url_div_1').style.display = 'none';
		document.getElementById('url_div_4').style.display = 'none';
		document.getElementById('url_div_3').style.display = 'none';
		objF.temp_url.value = '';
	}
}

function switchAnon(objC){
	if(objC.checked){
		document.getElementById('anon_1').style.display = 'none';
		document.getElementById('anon_2').style.display = 'block';
		document.getElementById('mult_1').style.display = 'block';
	}
	else{
		document.getElementById('anon_1').style.display = 'block';
		document.getElementById('anon_2').style.display = 'none';
		document.getElementById('mult_1').style.display = 'none';
	}
	updateURL();
}

function updateURL(){
	if(document.getElementById('wizard_url') == null){
		return false;
	}
	var objF = document.forms['uform'];
	var strURL = '<?= $this->strURL ?>/survey/';
	if(objF.temp_anon.checked){
		strURL += 'anon/'+objF.temp_hex.value+'/';
	}
	else{
		strURL = '-';
		/*
			if(objF.temp_dept.value){
				arrTemp = objF.temp_dept.options[objF.temp_dept.options.selectedIndex].text.split(" > ")
				for(i=0;i<arrTemp.length;i++){
					if(i>0){
						strURL += arrTemp[i].replace(' ','-')+'/'
				}
			}
			strURL = strURL.toLowerCase();
		}
		else{
			strURL = '-';
		}
		*/
	}
	document.getElementById('wizard_url').innerHTML = strURL;
}


-->
