// JavaScript Document

function downloadForm(tick,ids){

	if(confirm("Have you read and agreed with the course brochure for "+tick)){

		window.location.href = ids;

		

	}

}



function feedback_validate()

{

	if (document.enquiry.comments.value==""){

		alert("Please Enter your Comments")

		document.enquiry.comments.focus()

		return false

	}



	if(document.enquiry.capt.value == ""){

		alert("Please Enter Number");

		document.enquiry.capt.focus();

		return false;

	}





	if(document.enquiry.sktick.value != document.enquiry.capt.value)

	{

		alert("Please Verify the Number");

		document.enquiry.capt.focus();

		return false;

	}

	return true;

}



function enquiry_validate()

{

	if (document.enquiry.name.value==""){

		alert("Please Enter your Name")

		document.enquiry.name.focus()

		return false

	}

	if ((document.enquiry.tel.value==null)||(document.enquiry.tel.value=="")){

		alert("Please Enter your Phone Number")

		document.enquiry.tel.focus()

		return false

	}

	if (checkInternationalPhone(document.enquiry.tel.value)==false){

		alert("Please Enter a Valid Phone Number")

		document.enquiry.tel.value=""

		document.enquiry.tel.focus()

		return false

	}



	

	if ((document.enquiry.email.value==null)||(document.enquiry.email.value=="")){

		alert("Please Enter your Email ID")

		document.enquiry.email.focus()

		return false

	}

	

	if (echeck(document.enquiry.email.value)==false){

		document.enquiry.email.value=""

		document.enquiry.email.focus()

		return false

	}



	if (document.enquiry.comments.value==""){

		alert("Please Enter your Enquiry")

		document.enquiry.comments.focus()

		return false

	}



	if(document.enquiry.capt.value == ""){

		alert("Please Enter Number");

		document.enquiry.capt.focus();

		return false;

	}





	if(document.enquiry.sktick.value != document.enquiry.capt.value)

	{

		alert("Please Verify the Number");

		document.enquiry.capt.focus();

		return false;

	}

	return true;

}





function accomodation_validate()

{

	if (document.accomodation.g_name.value==""){

		alert("Please Enter Your Given Name")

		document.accomodation.g_name.focus()

		return false

	}

	if (document.accomodation.f_name.value==""){

		alert("Please Enter Your Family Name")

		document.accomodation.f_name.focus()

		return false

	}

	if (document.accomodation.startdate.value==""){

		alert("Please Enter Course Start Date")

		document.accomodation.startdate.focus()

		return false

	}

	if (document.accomodation.student_id.value==""){

		alert("Please Enter Your ID")

		document.accomodation.student_id.focus()

		return false

	}

	if (document.accomodation.batch.value==""){

		alert("Please Enter Your Batch")

		document.accomodation.batch.focus()

		return false

	}

	if (document.accomodation.address.value==""){

		alert("Please Enter Address")

		document.accomodation.address.focus()

		return false

	}

	if ((document.accomodation.email.value==null)||(document.accomodation.email.value=="")){

		alert("Please Enter Your Email ID")

		document.accomodation.email.focus()

		return false

	}

	

	if (echeck(document.accomodation.email.value)==false){

		document.accomodation.email.value=""

		document.accomodation.email.focus()

		return false

	}
	if (document.accomodation.gender.value==""){

		alert("Please Select Your Gender")

		document.accomodation.gender.focus()

		return false

	}

	if ((document.accomodation.tel.value==null)||(document.accomodation.tel.value=="")){

		alert("Please Enter Your Phone Number")

		document.accomodation.tel.focus()

		return false

	}

	if (checkInternationalPhone(document.accomodation.tel.value)==false){

		alert("Please Enter a Valid Phone Number")

		document.accomodation.tel.value=""

		document.accomodation.tel.focus()

		return false

	}



	if(document.accomodation.capt.value == ""){

		alert("Please Enter Number");

		document.accomodation.capt.focus();

		return false;

	}





	if(document.accomodation.sktick.value != document.accomodation.capt.value)

	{

		alert("Please Verify the Number");

		document.accomodation.capt.focus();

		return false;

	}

	return true;

}







function pApplyonline_validate()

{

	if (document.applyonline_professional.f_name.value==""){

		alert("Please Enter your First Name")

		document.applyonline_professional.f_name.focus()

		return false

	}

	if (document.applyonline_professional.l_name.value==""){

		alert("Please Enter your Last Name")

		document.applyonline_professional.l_name.focus()

		return false

	}

	if (document.applyonline_professional.address.value==""){

		alert("Please Enter Address")

		document.applyonline_professional.address.focus()

		return false

	}

	if ((document.applyonline_professional.tel.value==null)||(document.applyonline_professional.tel.value=="")){

		alert("Please Enter your Phone Number")

		document.applyonline_professional.tel.focus()

		return false

	}

	if (checkInternationalPhone(document.applyonline_professional.tel.value)==false){

		alert("Please Enter a Valid Phone Number")

		document.applyonline_professional.tel.value=""

		document.applyonline_professional.tel.focus()

		return false

	}

	if ((document.applyonline_professional.email.value==null)||(document.applyonline_professional.email.value=="")){

		alert("Please Enter your Email ID")

		document.applyonline_professional.email.focus()

		return false

	}

	

	if (echeck(document.applyonline_professional.email.value)==false){

		document.applyonline_professional.email.value=""

		document.applyonline_professional.email.focus()

		return false

	}

	

	

	

	

	if (document.applyonline_professional.alumini.selectedIndex==0 & document.applyonline_professional.alumini1.value==""){

		alert("Please Enter Enter Your Alumini Code")

		document.applyonline_professional.alumini1.focus()

		return false

	}

	if (document.applyonline_professional.hss.selectedIndex==0 && document.applyonline_professional.hss1.value==""){

		alert("Please Enter Your HSS Staff Code")

		document.applyonline_professional.hss1.focus()

		return false

	}



	

	

	



	if(document.applyonline_professional.capt.value == ""){

		alert("Please Enter Number");

		document.applyonline_professional.capt.focus();

		return false;

	}





	if(document.applyonline_professional.sktick.value != document.applyonline_professional.capt.value)

	{

		alert("Please Verify the Number");

		document.applyonline_professional.capt.focus();

		return false;

	}

	return true;

}



function diploma_validate()

{

	if (document.applyonline_diploma.f_name.value==""){

		alert("Please Enter your First Name")

		document.applyonline_diploma.f_name.focus()

		return false

	}

	if (document.applyonline_diploma.family_name.value==""){

		alert("Please Enter your Family Name")

		document.applyonline_diploma.family_name.focus()

		return false

	}

	

	if (document.applyonline_diploma.streetno.value==""){

		alert("Please Enter Street No")

		document.applyonline_diploma.streetno.focus()

		return false

	}

	

	if (document.applyonline_diploma.streetname.value==""){

		alert("Please Enter Street Name")

		document.applyonline_diploma.streetname.focus()

		return false

	}

	

	if (document.applyonline_diploma.city.value==""){

		alert("Please Enter City")

		document.applyonline_diploma.city.focus()

		return false

	}

	if (document.applyonline_diploma.state.value==""){

		alert("Please Enter State")

		document.applyonline_diploma.state.focus()

		return false

	}

	if (document.applyonline_diploma.post.value==""){

		alert("Please Enter Post")

		document.applyonline_diploma.post.focus()

		return false

	}

	

	if ((document.applyonline_diploma.email.value==null)||(document.applyonline_diploma.email.value=="")){

		alert("Please Enter your Email ID")

		document.applyonline_diploma.email.focus()

		return false

	}

	

	if (echeck(document.applyonline_diploma.email.value)==false){

		document.applyonline_diploma.email.value=""

		document.applyonline_diploma.email.focus()

		return false

	}

	

	



	

	

	



	if(document.applyonline_diploma.capt.value == ""){

		alert("Please Enter Number");

		document.applyonline_diploma.capt.focus();

		return false;

	}





	if(document.applyonline_diploma.sktick.value != document.applyonline_diploma.capt.value)

	{

		alert("Please Verify the Number");

		document.applyonline_diploma.capt.focus();

		return false;

	}

	return true;

}











function register_validate()

{

	if (document.register.f_name.value==""){

		alert("Please Enter First Name")

		document.register.f_name.focus()

		return false

	}

	if (document.register.l_name.value==""){

		alert("Please Enter Last Name")

		document.register.l_name.focus()

		return false

	}

	

	if (document.register.streetno.value==""){

		alert("Please Enter Street No")

		document.register.streetno.focus()

		return false

	}

	

	if (document.register.streetname.value==""){

		alert("Please Enter Street Name")

		document.register.streetname.focus()

		return false

	}

	

	if (document.register.city.value==""){

		alert("Please Enter City")

		document.register.city.focus()

		return false

	}

	if (document.register.state.value==""){

		alert("Please Enter State")

		document.register.state.focus()

		return false

	}

	if (document.register.post.value==""){

		alert("Please Enter Post")

		document.register.post.focus()

		return false

	}

	

	if ((document.register.email.value==null)||(document.register.email.value=="")){

		alert("Please Enter your Email ID")

		document.register.email.focus()

		return false

	}

	

	if (echeck(document.register.email.value)==false){

		document.register.email.value=""

		document.register.email.focus()

		return false

	}

	

	

	

	



	if(document.register.capt.value == ""){

		alert("Please Enter Number");

		document.register.capt.focus();

		return false;

	}





	if(document.register.sktick.value != document.register.capt.value)

	{

		alert("Please Verify the Number");

		document.register.capt.focus();

		return false;

	}

	return true;

}







function tellafriend_validate()

{

	if (document.tellafriend.f_name.value==""){

		alert("Please Enter your First Name")

		document.tellafriend.f_name.focus()

		return false

	}

	if ((document.tellafriend.email.value==null)||(document.tellafriend.email.value=="")){

		alert("Please Enter your Email ID")

		document.tellafriend.email.focus()

		return false

	}

	

	if (echeck(document.tellafriend.email.value)==false){

		document.tellafriend.email.value=""

		document.tellafriend.email.focus()

		return false

	}

	

	if (document.tellafriend.f_name_friend.value==""){

		alert("Please Enter your Friend First Name")

		document.tellafriend.f_name_friend.focus()

		return false

	}

	if ((document.tellafriend.email_friend.value==null)||(document.tellafriend.email_friend.value=="")){

		alert("Please Enter your Friend Email ID")

		document.tellafriend.email_friend.focus()

		return false

	}

	

	if (echeck(document.tellafriend.email_friend.value)==false){

		document.tellafriend.email_friend.value=""

		document.tellafriend.email_friend.focus()

		return false

	}

	

	if (document.tellafriend.comments.value==""){

		alert("Please Enter your Comments")

		document.tellafriend.comments.focus()

		return false

	}

	



	if(document.tellafriend.capt.value == ""){

		alert("Please Enter Number");

		document.tellafriend.capt.focus();

		return false;

	}





	if(document.tellafriend.sktick.value != document.tellafriend.capt.value)

	{

		alert("Please Verify the Number");

		document.tellafriend.capt.focus();

		return false;

	}

	return true;

}



/*-----------------EMail Validation--------------------*/

function echeck(str) {



		var at="@"

		var dot="."

		var lat=str.indexOf(at)

		var lstr=str.length

		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    alert("Invalid E-mail ID")

		    return false

		}



		 if (str.indexOf(at,(lat+1))!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.indexOf(dot,(lat+2))==-1){

		    alert("Invalid E-mail ID")

		    return false

		 }

		

		 if (str.indexOf(" ")!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



 		 return true					

	}

	

var digits = "0123456789";

// non-digit characters which are allowed in phone numbers

var phoneNumberDelimiters = "()- ";

// characters which are allowed in international phone numbers

// (a leading + is OK)

var validWorldPhoneChars = phoneNumberDelimiters + "+";

// Minimum no of digits in an international phone no.

var minDigitsInIPhoneNumber = 10;



function isInteger(s)

{   var i;

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character is number.

        var c = s.charAt(i);

        if (((c < "0") || (c > "9"))) return false;

    }

    // All characters are numbers.

    return true;

}

function trim(s)

{   var i;

    var returnString = "";

    // Search through string's characters one by one.

    // If character is not a whitespace, append to returnString.

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character isn't whitespace.

        var c = s.charAt(i);

        if (c != " ") returnString += c;

    }

    return returnString;

}

function stripCharsInBag(s, bag)

{   var i;

    var returnString = "";

    // Search through string's characters one by one.

    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)

    {   

        // Check that current character isn't whitespace.

        var c = s.charAt(i);

        if (bag.indexOf(c) == -1) returnString += c;

    }

    return returnString;

}



function checkInternationalPhone(strPhone){

var bracket=3

strPhone=trim(strPhone)

if(strPhone.indexOf("+")>1) return false

if(strPhone.indexOf("-")!=-1)bracket=bracket+1

if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false

var brchr=strPhone.indexOf("(")

if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false

if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false

s=stripCharsInBag(strPhone,validWorldPhoneChars);

return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);

}





function profileDownload()

{

    if (document.profile.nameTxt.value==""){

		alert("Please Enter your Name")

		document.profile.nameTxt.focus()

		return false

	}



    if ((document.profile.emailTxt.value==null)||(document.profile.emailTxt.value=="")){

		alert("Please Enter your Email ID")

		document.profile.emailTxt.focus()

		return false

	}



	if (echeck(document.profile.emailTxt.value)==false){

		document.profile.emailTxt.value=""

		document.profile.emailTxt.focus()

		return false

	}





	if(document.profile.capt.value == ""){

		alert("Please Enter Number");

		document.profile.capt.focus();

		return false;

	}





	if(document.profile.sktick.value != document.profile.capt.value)

	{

		alert("Please Verify the Number");

		document.profile.capt.focus();

		return false;

	}



	return true;

}













function onlinePaymentValidate()

{

	if(document.onlinepayment.title[0].checked == false){

		if(document.onlinepayment.title[1].checked == false){

			if(document.onlinepayment.title[2].checked == false)

			{

				if(document.onlinepayment.title[3].checked == false)

				{

					alert("Please Select Title");

					document.onlinepayment.title[0].focus();

					return false;

				}

			}

		}

	}

	

	if(document.onlinepayment.f_name.value == ""){

		alert("Please Enter First Name");

		document.onlinepayment.f_name.focus();

		return false;

	}

	if(document.onlinepayment.l_name.value == ""){

		alert("Please Enter Last Name");

		document.onlinepayment.l_name.focus();

		return false;

	}

	

	if(document.onlinepayment.address.value == ""){

		alert("Please Enter Address");

		document.onlinepayment.address.focus();

		return false;

	}

	if(document.onlinepayment.city.value == ""){

		alert("Please Enter City");

		document.onlinepayment.city.focus();

		return false;

	}

	if(document.onlinepayment.state.value == ""){

		alert("Please Enter State");

		document.onlinepayment.state.focus();

		return false;

	}

	if(document.onlinepayment.country.value == ""){

		alert("Please Enter Country");

		document.onlinepayment.country.focus();

		return false;

	}

	if ((document.onlinepayment.mob.value==null)||(document.onlinepayment.mob.value=="")){

		alert("Please Enter your Phone Number")

		document.onlinepayment.mob.focus()

		return false

	}

	if (checkInternationalPhone(document.onlinepayment.mob.value)==false){

		alert("Please Enter a Valid Phone Number")

		document.onlinepayment.mob.value=""

		document.onlinepayment.mob.focus()

		return false

	}

	if ((document.onlinepayment.email.value==null)||(document.onlinepayment.email.value=="")){

		alert("Please Enter your Email ID")

		document.onlinepayment.email.focus()

		return false

	}

	

	if (echeck(document.onlinepayment.email.value)==false){

		document.onlinepayment.email.value=""

		document.onlinepayment.email.focus()

		return false

	}

	

	return true;

}



function onlinePayment_payment()

{

	if (document.onlinepayment.payment.selectedIndex==0){

		alert("Please Select Payment Mode")

		document.onlinepayment.payment.focus()

		return false

	}

	

	if(document.onlinepayment.sktick.value != document.onlinepayment.capt.value)

	{

		alert("Please Verify the Number");

		document.onlinepayment.capt.focus();

		return false;

	}



	return true;

}





function step1()

{

    if(document.onlinepayment.question[0].checked == false){

        if(document.onlinepayment.question[1].checked == false){

            alert("Are you one of the following?");

        document.onlinepayment.question[0].focus();

        return false;

    }

    }

    

    

    if(document.onlinepayment.live[0].checked == false){

        if(document.onlinepayment.live[1].checked == false){

            alert("Do you reside in Victoria?");

        document.onlinepayment.live[0].focus();

        return false;

    }

    }

    

    return true;

}





function step2()

{

    

    if(document.onlinepayment.accept.checked == false){

            alert("Please Accept");

        document.onlinepayment.live[0].focus();

        return false;

    }

    

    return true;

}
