
function fnNavigateQuickLinks(){
	var fm = document.forms['QuickLinks'];
	var val = fm.elements[0][fm.elements[0].selectedIndex].value;
	
	if(val != "")
		window.location = val;
}


function fnValidateNewsletterSignup(){
	if(!fnValidEmail(document.forms['NewsletterSignup'].NewsletterEmail)){
		alert('Please enter a valid email address.');		
		document.forms['NewsletterSignup'].NewsletterEmail.focus();
		return (false);
	}
}

function fnCheckContactForm(){
	var fm = document.forms['ContactForm'];
	
	if(fm.Name.value == "") {alert("Please enter your name.");fm.Name.focus();return;}
	if(fm.Email.value == "") {alert("Please enter your email address.");fm.Email.focus();return;}
	if(fm.Comments.value == "") {alert("Please enter your comments.");fm.Comments.focus();return;}	
	
	fm.submit();
}

function fnCheckAskGuru(){
	var fm = document.forms['fmAskTheGuru'];
	if(fm.Email.value == ""){alert("Please enter your email address.");fm.Email.focus();return false;}
	fm.submit();
}

function fnNewsletterEmailFocus(){
	var fm = document.forms['NewsletterSignup'].NewsletterEmail;
	if(fm.value == "Email Address")
		fm.value = "";	
}

function fnNewsletterEmailBlur(){
	var fm = document.forms['NewsletterSignup'].NewsletterEmail;
	if(fm.value == "")
		fm.value = "Email Address";	
}

function fnUsernameFocus(){
	var fm = document.forms['Login'].UserName;
	if(fm.value == "Username")
		fm.value = "";	
}

function fnUsernameBlur(){
	var fm = document.forms['Login'].UserName;
	if(fm.value == "")
		fm.value = "Username";	
}












function fnValidEmail(tfName) {
	var GoodChars = "@_-.:/ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	var UpperEmail = tfName.value.toUpperCase()
	var ValidChars = true;
	
	for (tfCharNum = 0; tfCharNum > tfName.value.length; tfCharNum++) {
		Char = UpperEmail.charAt(tfCharNum);
		for (gcCharNum = 0;  gcCharNum < GoodChars.length;  gcCharNum++) {
				if (Char == GoodChars.charAt(gcCharNum))
				break;
		}
					
		if (gcCharNum == GoodChars.length)   {
			ValidChars = false;
			break;
   		}
	}
	
	if (!ValidChars || tfName.value.length < 7 || tfName.value.indexOf("@") == "-1" ||
		tfName.value.indexOf(".") == "-1" || tfName.value.indexOf("@") != tfName.value.lastIndexOf("@")) {
			return (false);
	}
	return (true);
}


function showscore(){
		
			var score = 0;

			

			for (var x=0;x < (document.gurucap.elements.length);x++){

					if (document.gurucap.elements[x].checked){
						score = score + parseInt(document.gurucap.elements[x].value);
					}
			}



			var w = window.open("","w","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=250");
			var d = w.document;
			d.open();

			d.write("<html><head><title>CaptiveGuru Says</title></head><body bgcolor='white'>");
			d.write("<font face='Arial, Helvetica, Univers' size='2'><center><h2>Survey Results</h2></center>");

			score = (parseInt(score) * 2.328288);

			//temp code
			 //d.write(score);
			 //d.write("<br>");
			//end temp code

			if(parseInt(score) > 549){
				d.write("<p>Based on this score, there is an excellent probability that a captive insurance company will be a useful tool for this organization. There is some strong indication from the score that the combination of financial structure, risk management philosophy and organizational attitude are such that a captive feasibility study is clearly indicated. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}


			if(parseInt(score) > 449 && score <= 549){
				d.write("<p>Based on this score, there is a reasonable probability that a captive insurance company will be a useful tool for this organization. There is some indication from the score that the combination of financial structure, risk management philosophy and organizational attitude are such that a captive is possible but all indicators are not positive. A feasibility study is indicated if the organization has a strong interest in captives. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}


			if(parseInt(score) > 349 && score <= 449){
				d.write("<p>Based on this score, there is a possibility that a captive insurance company could be a useful tool for this organization. However, there is a less than ideal combination of financial structure, risk management philosophy and organizational attitude at this time. As a result, a captive is possible but may require some internal changes. A feasibility study is indicated if the organization has a further interest. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}


			if(parseInt(score) > 249 && score <= 349){
				d.write("<p>Based on this score, there is a small possibility that a captive insurance company could be a useful tool for this organization. However, there is a combination of financial structure, risk management philosophy and organizational attitude that would not be conducive to a captive at this time. As a result, a captive is possible but unlikely to be of benefit as currently structured. A feasibility study is not likely to reveal a positive result. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}


			if(parseInt(score) > 149 && score <= 249){
				d.write("<p>Based on this score, there is an unlikely possibility that a captive insurance company could be a useful tool for this organization. However, there is a combination of financial structure, risk management philosophy and organizational attitude that would not be conducive to a captive at this time. As a result, a captive is possible but unlikely to be of benefit as currently structured. A feasibility study is not likely to reveal a positive result. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}


			if(parseInt(score) < 150){
				d.write("<p>Based on this score, there are significant impediments to the possible success of a captive insurance company in this organization. The combination of financial structure, risk management philosophy and organizational attitude are such that there is little possibility of success with a captive insurance company structure. This model is designed to a simplistic score of the potential for a captive and is not an absolute indicator.");
			}

			d.write("</body></html>");

			d.close();
		}

