/*$(document).ready(function(){alert();

						   	var form = $("#sales_entry_form");

							var email = $("#email_id");

	var emailInfo = $("#emailInfo");

	email.blur(validateEmail);

	email.keyup(validateEmail);

	form.submit(function(){

		if(validateEmail())

			return true

		else

			return false;

	});

	

	function validateEmail(){alert();

		//testing regular expression

		var a = $("#email_id").val();

		var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;

		//if it's valid email

		if(filter.test(a)){

			email.removeClass("error");

			emailInfo.text("");

			emailInfo.removeClass("error");

			return true;

		}

		//if it's NOT valid

		else{

			email.addClass("error");

			emailInfo.text("Valid E-mail please, you will need it to log in!");

			emailInfo.addClass("error");

			return false;

		}

	}

});*/

/*$(document).ready(function() { 



  $('#btn-submit').click(function() {  



    $(".error").hide();

    var hasError = false;

    var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

    var emailblockReg =

     /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/;



    var emailaddressVal = $("#email_id").val();

    if(emailaddressVal == '') {

      $("#email_id").after('<span class="error">Please enter your email address.</span>');

      hasError = true;

    }



    else if(!emailReg.test(emailaddressVal)) {

      $("#email_id").after('<span class="error">Enter a valid email address.</span>');

      hasError = true;

    }



    else if(!emailblockReg.test(emailaddressVal)) {

      $("#email_id").after('<span class="error">No yahoo, gmail or hotmail emails.</span>');

      hasError = true

    } 



    if(hasError == true) { return false; }



    });

});

*//********************************************** PROSPECTOR VALIDATION *********************************************************/

function condact_no_validate (condact_no)

{

    valid = true;



	if(condact_no== "" )

    {

		document.getElementById("condact_no_err_design").style.display = "block";

		document.getElementById("condact_no_err_msg").style.display = "block";

        return false;

    }

	if(condact_no.length <=10 )

    {

		document.getElementById("condact_no_err_design").style.display = "block";

		document.getElementById("condact_no_err_msg").style.display = "block";

        return false;

    }



	else

	{

		document.getElementById("condact_no_err_design").style.display = "none";

		document.getElementById("condact_no_err_msg").style.display = "none";

        return false;



	}

}



/*function email_id_validate (email_id)

{

    valid = true;

	if(email_id== "" )

    {

		document.getElementById("email_id_err_design").style.display = "block";

		document.getElementById("email_id_err_msg").style.display = "block";

        return false;

    }

	

	else

	{

		document.getElementById("email_id_err_design").style.display = "none";

		document.getElementById("email_id_err_msg").style.display = "none";

        return false;



	}

}

*/



function desigination (destin)

{

    valid = true;

	if(destin== "" )

    {

		document.getElementById("destin_no_err_design").style.display = "block";

		document.getElementById("destin_no_err_msg").style.display = "block";

        return false;

    }

	else

	{

		document.getElementById("destin_no_err_design").style.display = "none";

		document.getElementById("destin_no_err_msg").style.display = "none";

        return false;



	}

}

function sales_name_validate (sales_name)

{

    valid = true;

	if(sales_name== "" )

    {

		document.getElementById("sales_name_no_err_design").style.display = "block";

		document.getElementById("sales_name_no_err_msg").style.display = "block";

        return false;

    }

	else

	{

		document.getElementById("sales_name_no_err_design").style.display = "none";

		document.getElementById("sales_name_no_err_msg").style.display = "none";

        return false;



	}

}

function address_validate (address)

{

    valid = true;

	if(address== "" )

    {

		document.getElementById("address_err_design").style.display = "block";

		document.getElementById("address_err_msg").style.display = "block";

        return false;

    }

	else

	{

		document.getElementById("address_err_design").style.display = "none";

		document.getElementById("address_err_msg").style.display = "none";

        return false;



	}

}



/****************************** NEW PROSPECTOR ***************************************/

var p= jQuery.noConflict();

function add_sales_details(destin,sales_name,condact_no,email_id,address)

{

	if((destin!="")&&(sales_name!="")&&(condact_no!="")&&(email_id!="")&&(address!=""))

	{

		p("#sales_details_div").html('<img src="images/ajax-loader.gif"> Loading...');

		p.ajax({

		type: "GET",

		url: "prospector_entry/prospector_entry_db.php",

		data: "destin="+destin+"&sales_name="+sales_name+"&condact_no="+condact_no+"&email_id="+email_id+"&address="+address+"&action=SAVE",

		success: function(msg){p("#sales_details_div").html(msg);}

		});

		window.close();

	}

	else

	{

		condact_no_validate (condact_no),desigination (destin),sales_name_validate (sales_name),address_validate (address);

	}

}

