﻿

var wc_master='ctl00_cph1_wucfrm_';

 function findObj(obj)
   {
   return document.getElementById(obj)
   }
   
function progress(fl)
{
for(i=0;i<10;i++)
{
var n=eval(i)+eval(1);
document.getElementById('pdt'+n).style.background='';
}

for(var i =0;i<fl;i++)
{
var n=eval(i)+eval(1);
document.getElementById('pdt'+n).style.background='#225163'; //old 2b9b3e
x=eval(n)*10;
document.getElementById('dtdone').innerHTML=x+"% <br/>";
}
//alert(fl);
}


  function callIframe(steps,uid)
   {   
   findObj('ifrm').src='insert_streps.aspx?str='+steps+'&uid='+uid;
   }
function checkdetails(fl)
{
//alert('ssss');
if(fl=="f")
{
findObj('divcategory').style.display='none';
$get('divuserdetails').style.display='block';
progress(9);
//findObj('div_msg').innerHTML='<span style=font-weight:bold;color:red;>Invalid Phone.</span><br/><br/><input type=button id=ok value=OK width=60px onclick=closeui_1() />'; 
//$.blockUI({ message: $('#divalert_msg') }); 
alert('A valid phone number is required for information requests. We never share your information without consent.');
}
else{
findObj('divcategory').style.display='none';
findObj('divuserdetails').style.display='none';
findObj('divuserdetails1').style.display='block';
progress(10);
findObj('divback').style.display='block';
}
}


function click_interest()
{
findObj('divcategory').style.display='none';
findObj('diveducation').style.display='block';
findObj('divback').style.display='block';
//progress();
//document.getElementById('pdt1').style.background='#225163';
progress(1);
callIframe('Interest$Step1?',findObj(wc_master+'hdnuserid').value);
}

function Click_edu1()
{
//animatedcollapse.hide('diveducation');
//animatedcollapse.show('divgrad');

findObj('diveducation').style.display='none';
findObj('divgrad').style.display='block';

findObj('divback').style.display='block';

//progress();
//document.getElementById('pdt1').style.background='#225163';
progress(2);
callIframe('LOE(No HS)$Step2?',findObj(wc_master+'hdnuserid').value);
}

function Click_edu(m)
{
//animatedcollapse.hide('diveducation');
//animatedcollapse.show('divgpa');

//findObj('diveducation').style.display='none';
////findObj('divgpa').style.display='block';
//findObj('divdob').style.display='block';
////document.getElementById('pdt1').style.background='#225163';
//findObj('divback').style.display='block';
//progress(2);
callIframe('LOE$Step2?',findObj(wc_master+'hdnuserid').value);
window.location='thanks18.aspx?f=n&master='+m;
return false;
}

function Click_grad()
{
//animatedcollapse.hide('divgrad');
//animatedcollapse.show('divgpa');

findObj('divgrad').style.display='none';
//findObj('divgpa').style.display='block';
findObj('divdob').style.display='block';

//document.getElementById('pdt2').style.background='#225163';
progress(3);
callIframe('Grad$Step3?',findObj(wc_master+'hdnuserid').value);
}

function Click_dob()
{
if(getAge())
{
//animatedcollapse.hide('divdob');
//animatedcollapse.show('divcredit');

findObj('divdob').style.display='none';
findObj('divcredit').style.display='block';

//document.getElementById('pdt4').style.background='#225163';
progress(4);
callIframe('BirthYear$Step4?',findObj(wc_master+'hdnuserid').value);
}
}



function Click_credit()
{
//animatedcollapse.hide('divcredit');
//animatedcollapse.show('divmilitary');

findObj('divcredit').style.display='none';
findObj('divmilitary').style.display='block';

//document.getElementById('pdt5').style.background='#225163';
progress(5);
callIframe('Credits$Step5?',findObj(wc_master+'hdnuserid').value);
}

function Click_credit_yes_no(fl)
{
if(fl=='yes')
{
findObj('divcrd1').style.display='block';
}
else
{
findObj('divcrd1').style.display='none';
//animatedcollapse.hide('divcredit');
//animatedcollapse.show('divmilitary');

findObj('divcredit').style.display='none';
findObj('divmilitary').style.display='block';

progress(5);
callIframe('Credits$Step5?',findObj(wc_master+'hdnuserid').value);
}

}

//function Click_military()
//{
////animatedcollapse.hide('divmilitary');
////animatedcollapse.show('divplan');

//findObj('divmilitary').style.display='none';
//findObj('divplan').style.display='block';

////document.getElementById('pdt6').style.background='#225163';
//progress(6);
//callIframe('Military$Step6?',findObj(wc_master+'hdnuserid').value);
//}

function Click_military(val1)
{

if(val1=='yes')
{
findObj('divmilit1').style.display='block';
}
else if(val1=='opt')
{
if(findObj('divmilit1').selectedIndex==0)
{
alert('Please select military option.');
return false;
}
else
{
findObj('divmilitary').style.display='none';
findObj('divplan').style.display='block';
}
}
else
{
findObj('divmilitary').style.display='none';
findObj('divplan').style.display='block';
}
progress(8);
callIframe('Military$Step6?',findObj(wc_master+'hdnuserid').value);
}


function Click_plan()
{
//animatedcollapse.hide('divplan');
//animatedcollapse.show('divteachcerti');

findObj('divplan').style.display='none';
findObj('divuscitizen').style.display='block';

progress(7);
callIframe('Plan To Start Career$Step7?',findObj(wc_master+'hdnuserid').value);
}



function Click_citizen()
{
findObj('divuscitizen').style.display='none';
findObj('divonlinecampus').style.display='block';
progress(8);
callIframe('Citizen$Step8?',findObj(wc_master+'hdnuserid').value);
}

function Click_onlinecampus()
{
findObj('divonlinecampus').style.display='none';
findObj('divuserdetails').style.display='block';
progress(9);
callIframe('Online-Campus$Step9?',findObj(wc_master+'hdnuserid').value);
}

function Click_userdetail()
{
findObj('divback').style.display='none';
var act=false;
if(FrmValid1()==true)
{
//animatedcollapse.hide('divuserdetails');
//animatedcollapse.show('divuserdetails1');
//document.getElementById('pdt9').style.background='#225163';
act=true;
}
if(act==true)
{
//findObj('divbtn1').style.display = 'none';
//findObj('divload1').style.display = 'block';
//findObj('div_msg').innerHTML='Please wait verifying your phone...<span><img src="scripts/activity.gif" /></span>'; 
//$.blockUI({ message: $('#divalert_msg') });
}

return act;
}

 function FrmValid1()
   {
   var act=true;
 
if(findObj(wc_master+'ddlsalu').selectedIndex==0)
{
alert('Please select Salutation.');
findObj(wc_master+'ddlsalu').focus();
act= false;
}
else if(findObj(wc_master+'txtfname').value=='')
{
alert('Please enter first name.');
findObj(wc_master+'txtfname').focus();
act= false;
}
else if(findObj(wc_master+'txtlname').value=='')
{
alert('Please enter last name.');
findObj(wc_master+'txtlname').focus();
act= false;
}
else if(findObj(wc_master+'txtemail').value=='')
{
alert('Please enter email id.');
findObj(wc_master+'txtemail').focus();
act= false;
}
else if(findObj(wc_master+'txtph1').value=='' || findObj(wc_master+'txtph2').value=='' || findObj(wc_master+'txtph3').value=='')
{
alert('Please enter phone1.');
findObj(wc_master+'txtph1').focus();
act= false;
}
else if(findObj(wc_master+'txtph1').value.length <3 || findObj(wc_master+'txtph2').value.length <3 || findObj(wc_master+'txtph3').value.length <4)
{
alert('Phone1 format should be xxx-xxx-xxxxx');
findObj(wc_master+'txtph1').focus();
act= false;
}
if(act==true)
{
if(!isValidEmail(findObj(wc_master+'txtemail').value))
{
alert("Please fill the proper Email address e.g. abcd@abcd.com!");
findObj(wc_master+'txtemail').focus();
act= false;
}
if(IsNumeric(findObj(wc_master+'txtph1').value)==false || IsNumeric(findObj(wc_master+'txtph2').value)==false || IsNumeric(findObj(wc_master+'txtph3').value)==false)
{
findObj(wc_master+'txtph1').focus();
alert('Please enter valid phone.');
act= false;
}
}
if(act==true)
{callIframe('Name$Step10?',findObj(wc_master+'hdnuserid').value);}
return act;

}

 function FrmValid2()
   {
   findObj('divcategory').style.display='none';
   findObj('divback').style.display='none';
    var act=true;
 
if(findObj(wc_master+'txtzip').value=='')
{


alert('Please enter zip code.');
findObj(wc_master+'txtzip').focus();
act= false;
}
else if(findObj(wc_master+'txtadd').value=='')
{
alert('Please enter address.');
findObj(wc_master+'txtadd').focus();

act= false;
}
else if(findObj(wc_master+'txtcity').value=='')
{
alert('Please enter city.');
findObj(wc_master+'txtcity').focus();
act= false;
}
else if(findObj(wc_master+'ddlstate').selectedIndex==0)
{
alert('Please state.');
findObj(wc_master+'ddlstate').focus();
act= false;
}
else if(findObj(wc_master+'chk').checked ==false)
{
alert('In order to receive program information from schools you select, please acknowledge your agreement to be contacted by selecting the checkbox. Only the schools you choose will be able to contact you with more information.');
findObj(wc_master+'chk').focus();
act= false;
}

if(act==true)
{
findObj('divlastsubmit').style.display = 'none';
findObj('divload_btn').style.display = 'block';

//findObj('div_msg').innerHTML='Processing...<span><img src="scripts/activity.gif" /></span>'; 
//$.blockUI({ message: $('#divalert_msg') });
}

return act;
}


function isValidEmail(email){ 
    //var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
    var RegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 
    if(RegExp.test(email)){ 
        return true; 
    }else{ 
        return false; 
        }
    } 
    
    
    
    function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);      
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         break;
         }
      }
   return blnResult;
  }

function alldivhide()
{

}




function getCheckedRadio() 
{

var fl='';
 //check for DOM
        if(!document.getElementById || !document.createTextNode)
        {
            //DOM NOT SUPPORTED
            alert('DOM NOT SUPPORTED.')
            return false;
        }
        
        
        var tags = document.getElementsByTagName('input');
        
        for(i=0;i<tags.length;i++)
        {
            name = tags[i].name;
            //alert(name+'=='+name.indexOf('rbtneducation'))
            if(tags[i].type =="radio" && name.indexOf('rbtneducation') > -1)
            {                
            if(document.getElementById(tags[i].id).checked)
            {
           fl=document.getElementById(tags[i].id).value;
            }
       
            }
           
        }
        return fl;
}


function goback()
{
findObj(wc_master+'divmsg').style.display='none';

 if(document.getElementById('diveducation').style.display=='block')
{

findObj('diveducation').style.display='none';
findObj('divcategory').style.display='block';
progress(0);
}
else if(document.getElementById('divgrad').style.display=='block')
{
findObj('divgrad').style.display='none';
findObj('diveducation').style.display='block';
progress(1);
}
else if(document.getElementById('divdob').style.display=='block')
{
findObj('divdob').style.display='none';
findObj('divgrad').style.display='block';
progress(2);
}
else if(document.getElementById('divcredit').style.display=='block')
{
findObj('divcredit').style.display='none';
findObj('divdob').style.display='block';
progress(3);
}
else if(document.getElementById('divmilitary').style.display=='block')
{
findObj('divmilitary').style.display='none';
findObj('divcredit').style.display='block';

progress(4);
}
else if(document.getElementById('divplan').style.display=='block')
{
findObj('divplan').style.display='none';
findObj('divmilitary').style.display='block';
progress(5);
}
else if(document.getElementById('divuscitizen').style.display=='block')
{
findObj('divuscitizen').style.display='none';
findObj('divplan').style.display='block';
progress(6);
}
else if(document.getElementById('divonlinecampus').style.display=='block')
{
findObj('divonlinecampus').style.display='none';
findObj('divuscitizen').style.display='block';

progress(7);
}
else if(document.getElementById('divuserdetails').style.display=='block')
{
findObj('divuserdetails').style.display='none';
findObj('divonlinecampus').style.display='block';

progress(8);
}
else if(document.getElementById('divuserdetails1').style.display=='block')
{
findObj('divuserdetails1').style.display='none';
findObj('divuserdetails').style.display='block';
try{
findObj('divpop').style.display='block';
}
catch(err){}

progress(9);

}

}


function goNext(the_val, field_name)
{
    if (the_val.length == 3) 
    {
        document.getElementById(field_name).focus();
    }
    }
    


function getAge()
{
var act=true;
var bday=parseInt(findObj(wc_master+'ddlday').value);
var bmo=(parseInt(findObj(wc_master+'ddlmonth').value)-1);
var byr=parseInt(findObj(wc_master+'ddlyear').value);
var byr;
var age;
var now = new Date();
tday=now.getDate();
tmo=(now.getMonth());
tyr=(now.getFullYear());

if((tmo > bmo)||(tmo==bmo & tday>=bday))
{age=byr}
else
{age=byr+1}

if((tyr-age)<18)
{
//alert("As of today, "+now+' \n'+", you are:"+(tyr-age)+ " years old");
//alert("As of today, "+'\n'+", you are:"+(tyr-age)+ " years old,so please select 18 or above");
alert('You should be atleast 18 years of age to use this website.');
act=window.location='thanks18.aspx';
}

return act;

}
