﻿// JScript File
function Calculate(checkboxname)
    {
       CheckMutuallyExclusive(checkboxname);
       
       var txtTotal;       
       txtTotal = document.getElementById("ctl00_cphContent_txtTotal");
       txtTotal.value = 0;

       for(var i = 0;i<document.forms[0].length;i++)       
          {
                 
             if(document.forms[0].elements[i].type == "checkbox" )
             {
           
				var chkbox = document.forms[0].elements[i];
				if (chkbox.checked)
				{
				   
				    txtTotal.value = TryParseInt(txtTotal.value,0) + TryParseInt(chkbox.value,0);
				   		 
				}				
			 }  			 			    			 
          }
          var validator = document.getElementById("ctl00_cphContent_rfvtxtTotal");	
          ValidatorValidate(validator);	
        
    }
    function TryParseInt(str,defaultValue){
    var retValue = defaultValue;
    if(str!=null){
        if(str.length>0){
            if (!isNaN(str)){
                retValue = parseInt(str);
            }
        }
    }
    return retValue;
}
function CheckMutuallyExclusive(checkboxname)
{
         document.forms[0].elements["ctl00_cphContent_chkService3"].checked = true;
         var spanCFPrice = document.getElementById("CompanyFormationPrice");
         
         if (checkboxname.id == "ctl00_cphContent_Checkbox1")
		 {
		     document.forms[0].elements["ctl00_cphContent_Checkbox2"].checked = false;
		     document.forms[0].elements["ctl00_cphContent_Checkbox1"].checked = true;
		     spanCFPrice.innerHTML = "3250 USD";    
		 }
		
		 if (checkboxname.id == "ctl00_cphContent_Checkbox2")
		 {
		      document.forms[0].elements["ctl00_cphContent_Checkbox1"].checked = false;
		      document.forms[0].elements["ctl00_cphContent_Checkbox2"].checked = true;
		      spanCFPrice.innerHTML = "4250 USD";    
		 }
		
		 
		 
}
