
function dummyAccess(chk){
	var split1=location.href.split("//");
                var baseurl = split1[1].split("/");
                 if(baseurl[0].indexOf( "alpha" ) > -1){
					 if(chk == 1){
                location.href = "http://"+baseurl[0]+"/advnavigatorapp/SurveyLanding.do?action=I%20Agree";
					 }else{
                 location.href = "http://"+baseurl[0]+"/advnavigatorapp/AdvSurveyLanding.do?action=I%20Agree";
					 }
                }else{
					 if(chk == 1){
                location.href = "https://"+baseurl[0]+"/advnavigatorapp/SurveyLanding.do?action=I%20Agree";
					 }else{
                 location.href = "https://"+baseurl[0]+"/advnavigatorapp/AdvSurveyLanding.do?action=I%20Agree";
					 }

                }
}
function popdisclaimer() {
	var sx = (screen.width-610)/2;
	var sy = (screen.height-630)/2;
	var split1=location.href.split("//");
	var baseurl = split1[1].split("/");
	if(baseurl[0].indexOf( "alpha" ) > -1){
        var redirurl = "http://"+baseurl[0]+"/advnavigatorapp/jsp/agreements.jsp";
        }else{
        var redirurl = "https://"+baseurl[0]+"/advnavigatorapp/jsp/agreements.jsp";
        }
	//var redirurl = mySplitResult1[0]+"//"+baseurl[0]+"/advnavigatorapp/jsp/agreements.jsp";
	window.open(redirurl,'_blank','width=610,height=630,screenX='+sx+',left='+sx+',screenY='+sy+',top='+sy+',scrollbars=1,resizable=1');
}

function checkagreement() {
	if (document.getElementById('terms').checked == false) {
		alert("Please read and agree to the terms and conditions.");
	} else {
		var split1=location.href.split("//");
	        var baseurl = split1[1].split("/");
		 if(baseurl[0].indexOf( "alpha" ) > -1){
		opener.parent.location.href = "http://"+baseurl[0]+"/advnavigatorapp/SurveyLanding.do?action=I%20Agree";
		}else{
		opener.parent.location.href = "https://"+baseurl[0]+"/advnavigatorapp/SurveyLanding.do?action=I%20Agree";
		}
		window.close();
	}
}

function writeyear() {
	var now = new Date();
	document.write (now.getFullYear());
}
function calTotal(ansId){
	var tot= 0.0;
	  for (var x = 1; x <10; x++)
   	  {
   	    var Z = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1040_'+x+').answerText'].value);
		if( !isNaN(Z)){
	   	tot = tot+Z;
		if(tot<=100){
		document.forms["AdvSurveyForm"].elements['answer(1040_10).answerText'].value = tot.toFixed(2);
		}else{
			var Y = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1040_'+ansId+').answerText'].value);
			if( !isNaN(Y)){
			tot=tot-Y;
			}
			document.forms["AdvSurveyForm"].elements['answer(1040_10).answerText'].value = tot.toFixed(2);
   			//window.alert("Total Exceeds 100%. Please make sure the Total is within 100");
			document.forms["AdvSurveyForm"].elements['answer(1040_'+ansId+').answerText'].value=0.00;
			window.alert("Total Exceeds 100%. Please make sure the Total is within 100");	
   		}
	   	}
	   	
   	  }	
		
}
function initOprGoals(){
	var idealHours = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1340_7).answerText'].value);
	if (!isNaN(idealHours)){
		for (var x = 1; x <=6; x++)
          {
				calPctNTot(x);
		  }

	}else{
		for (var x = 1; x <=6; x++)
          {
		document.forms["AdvSurveyForm"].elements['answer(hrs_'+x+').answerText'].value="";
		document.forms["AdvSurveyForm"].elements['answer(1340_'+x+').answerText'].value="";
		  }
  	document.forms["AdvSurveyForm"].elements['answer(hrs_8).answerText'].value="";
	document.forms["AdvSurveyForm"].elements['answer(1340_8).answerText'].value="";


	}
	}
	
	function calPctNTot(ansId){
	var idealHours = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1340_7).answerText'].value);
	var totHrs =0.0;
	var totPct =0.0;
	if (isNaN(idealHours)){
	//window.alert("Ideal Hours is Not a Number. Please re-enter");
	document.forms["AdvSurveyForm"].elements['answer(1340_7).answerText'].value = "";
	}else{
	//window.alert("valid");
	//	window.alert(document.forms["AdvSurveyForm"].elements['answer(1340_7).answerText'].value);
	document.forms["AdvSurveyForm"].elements['answer(hrs_8).answerText'].value="";
	document.forms["AdvSurveyForm"].elements['answer(1340_8).answerText'].value="";
		for (var x = 1; x <=6; x++)
          {
		//				          window.alert(document.forms["AdvSurveyForm"].elements['answer(hrs_'+x+').answerText'].value);
			var Z = parseFloat(document.forms["AdvSurveyForm"].elements['answer(hrs_'+x+').answerText'].value);
			     //     window.alert("aSK"+x+"=="+Z);
			if( !isNaN(Z)){
                totHrs = totHrs+Z;
                var pct = (Z/idealHours)*100;
               
                totPct =totPct+pct;
                var pctTot = totPct.toFixed(2);
                var checkPct=pct.toFixed(2);
               if((totHrs <=idealHours) && (totPct<=100)){
                document.forms["AdvSurveyForm"].elements['answer(1340_'+x+').answerText'].value=checkPct;
                document.forms["AdvSurveyForm"].elements['answer(hrs_8).answerText'].value=totHrs;
                document.forms["AdvSurveyForm"].elements['answer(1340_8).answerText'].value=pctTot;
			   }else{
				   var Y = parseFloat(document.forms["AdvSurveyForm"].elements['answer(hrs_'+ansId+').answerText'].value);
				   if(!isNaN(Y)){
					totHrs = totHrs-Y;
					totPct = totPct-((Y/idealHours)*100).toFixed(2);
					document.forms["AdvSurveyForm"].elements['answer(1340_'+ansId+').answerText'].value="";
					document.forms["AdvSurveyForm"].elements['answer(hrs_'+ansId+').answerText'].value="";
					document.forms["AdvSurveyForm"].elements['answer(1340_'+x+').answerText'].value=checkPct;
                document.forms["AdvSurveyForm"].elements['answer(hrs_8).answerText'].value=totHrs;
                document.forms["AdvSurveyForm"].elements['answer(1340_8).answerText'].value=pctTot;
				   }
			   }
			 }else{
               document.forms["AdvSurveyForm"].elements['answer(1340_'+x+').answerText'].value= "";
             }
                
                
		  }
	}
	}
function initPrGoals(){
		for(var i=1;i<=6;i++){
		var Z = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1390_'+i+').answerText'].value);
	//	window.alert(Z);
		if(isNaN(Z) || Z == 0){
		document.forms["AdvSurveyForm"].elements['answer(1390_'+i+').answerText'].disabled=true;
		document.forms["AdvSurveyForm"].elements['answer(1390_'+i+').answerText'].value="";
		document.forms["AdvSurveyForm"].elements['answer(xx_'+i+').answerId'].checked=false;
//		window.alert("disabled 1390_"+i);
		}else{
		}
		}
	}
	function chkNenable(num){
	//window.alert("Entered Number"+num);
	if(document.forms["AdvSurveyForm"].elements['answer(xx_'+num+').answerId'].checked == true){
		document.forms["AdvSurveyForm"].elements['answer(1390_'+num+').answerText'].disabled=false;
	//window.alert("true");
	}else{
	document.forms["AdvSurveyForm"].elements['answer(1390_'+num+').answerText'].disabled=true;
	var Z = parseFloat(document.forms["AdvSurveyForm"].elements['answer(1390_'+num+').answerText'].value);
	if(isNaN(Z) || Z == 0){
	document.forms["AdvSurveyForm"].elements['answer(1390_'+num+').answerText'].value="";
	}
	}
		
	
	}
	function currTotal(){
	var tot= 0.0;
	for (var x = 1; x <=8; x++)
   	  {
		var input = document.forms["AdvSurveyForm"].elements['answer(1370_'+x+').answerText'].value;
		input =input.replace(/,/,"");
		
		var Z = parseFloat(input);
		
		if( !isNaN(Z)){
			
	   	tot = tot+Z;
		document.forms["AdvSurveyForm"].elements['answer(1370_9).answerText'].value = tot.toFixed(2);
   		}else{
			
			document.forms["AdvSurveyForm"].elements['answer(1370_'+x+').answerText'].value ="0.0";
		}
	  }
	}
	 
function checkGR(){
	var input =document.forms["SurveyForm"].elements['answer(1041_h).answerText'].value;
	var Z = parseFloat(input);
	if(input <100){
		var answer = confirm("You indicate that you want to retain some portion of commision-based business which means you will not be able to operate as an RIA only.");
		if(answer){
		}
		else{
			document.forms["SurveyForm"].elements['answer(1041_h).answerText'].value="100";
		}
		}
	
	
}

function redirectTo()
{
	var map = new Object();
	map['a']="http://www.google.com";
	map['sutro']="http://www.thesutrogroup.com/";
	map['stark']="http://www.stark-stark.com/";
	map['counsel']="http://www.marketcounsel.com/";
	map['edger']="http://www.edgertonweaver.com/";
	map['compliance']="http://www.regulatorycompliance.com/";
	map['ppcloan']="http://www.ppcloan.com/";
	map['jcpublic']="http://www.jcpublicrelations.com/";
	map['collaborative']="http://www.the-collaborative.com/";
	map['impact']="http://www.advisorimpact.com/intro.html";
	map['diamond']="http://www.diamondrecruiter.com/";
	map['pjburns']="http://www.pjblawoffice.com/";
	map['edgertonweaver']="http://www.edgertonweaver.com/";
	var search=window.location.search.substring(1);
	window.location.replace(map[search]);
}

function includeAnalytics()
{
	 var split_ait=location.href.split(".com/");
	if (split_ait[0].indexOf("inautix") == -1 )
	{
	
		//<![CDATA[
			var _tag=new WebTrends();
			_tag.dcsGetId();
		//]]>>
		//<![CDATA[
			// Add custom parameters here.
			//_tag.DCSext.param_name=param_value;
			_tag.dcsCollect();
		//]]>>
		/* END OF SmartSource Data Collector TAG */
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
		try {
			var pageTracker = _gat._getTracker("UA-4634990-4");
			pageTracker._trackPageview();
		} catch(err) {}
	}
}