





//********************************************ecno conditon*****************************//


function ecno_cdtn_validate (ecno_cdtn)


{


	


    valid = true;


	if(ecno_cdtn==0 )


    {


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


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


        return false;


    }


	else


	{


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


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


        return false;





	}


}


//*************************************spouse_present_validate***********************//


function spouse_present_validate (spouse_present)


{


valid = true;


	if(spouse_present== "" )


    {


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


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


        return false;


    }


	


	else


	{


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


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


        return false;





	}


}


//*****************************************familiarity_validate***********************


function familiarity_validate (familiarity)


{


    valid = true;


	if(familiarity== "" )


    {


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


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


        return false;


    }


	else


	{


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


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


        return false;





	}


}


////****************************************condition_validate**************************************//


function condition_validate (condition)


{


    valid = true;


	if(condition== "" )


    {


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


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


        return false;


    }


	else


	{


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


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


        return false;





	}


}














//****************************************************************************************//


function phone_validate (phone_no)


{


    valid = true;





	if(phone_no== "" )


    {


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


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


        return false;


    }


	if(phone_no.length <6 )


    {


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


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


        return false;


    }





	else


	{


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


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


        return false;





	}


}


//*******************************************************************************************//


function phone_validate1 (phone_no)


{


    valid = true;





	if(phone_no== "" )


    {


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


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


        return false;


    }


	if(phone_no.length <10 )


    {


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


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


        return false;


    }





	else


	{


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


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


        return false;





	}


}


//**************************************************************************************//


function name_validate (lead_first_name)


{


    valid = true;


	if(lead_first_name== "" )


    {


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


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


        return false;


    }


	if(lead_first_name.length <=2 )


    {


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


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


        return false;    }





	else


	{


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


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


        return false;





	}


}


//************************************************NOTE VALIDAE**************************************//


function note_validate (note)


{


    valid = true;


	if(note== "" )


    {


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


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


        return false;


    }


	if(note.length <=3 )


    {


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


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


        return false;    }





	else


	{


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


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


        return false;





	}


}





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


var p8= jQuery.noConflict();





function exe_demo_condition(ecno_cdtn,spouse_present,familiarity,condition,note,pro_id,demo_status,referal_count)


{ 


/*if(referal_count!=0)


{


*/if((ecno_cdtn!="")&&(spouse_present!='')&&(familiarity!='')&&(condition!=''))


	{


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


		p8.ajax({


		type: "GET",


		url: "scheduled_demos/executed_demo_status/executed_demo_condition_db.php",


		data: "ecno_cdtn="+ecno_cdtn+"&spouse_present="+spouse_present+"&familiarity="+familiarity+"&condition="+condition+"&note="+note+"&prospector_id="+pro_id+"&demo_status="+demo_status+"&action=SUBMIT",


		success: function(msg){p8("#exe_demo_div").html(msg);}


		});


		window.close();


	}


	else


	{


		ecno_cdtn_validate(ecno_cdtn),spouse_present_validate(spouse_present),familiarity_validate (familiarity),condition_validate (condition);


	}


}


/*else


{


			alert("Add Referals...!");


			document.prospector_entry_form.referal_name.focus();


}


}


*/


//**************************************************************************************************//





function add_referals(referal_name,referal_last_name,referal_last_name1,phone_no,refered_phone_no,refered_by,pro_id)


{ 


	if((phone_no!="")&&(referal_name!=''))


	{		


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


		p8.ajax({


		type: "GET",


		url: "scheduled_demos/executed_demo_status/executed_demo_condition_db.php",


		data: "referal_name="+referal_name+"&referal_last_name="+referal_last_name+"&referal_last_name1="+referal_last_name1+"&phone_no="+phone_no+"&refered_phone_no="+refered_phone_no+"&refered_by="+refered_by+"&prospector_id="+pro_id+"&action=ADD",


		success: function(msg){p8("#exe_demo_referal_div").html(msg);}


		});


		document.getElementById("referal_name").value="";


		document.getElementById("referal_last_name").value="";


		document.getElementById("referal_last_name1").value="";


		document.getElementById("phone_no").value="";


		alert("Referal Added.");


	}


	else


	{


		phone_validate(phone_no),name_validate (referal_name);


	}


}


/********************************************************************************************************************/


function delete_list_prospec(delete_id,prospector_id)


{


	if(confirm('Are You Sure! You Want To Delete?'))


{





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


		p8.ajax({


		type: "GET",


		url: "scheduled_demos/executed_demo_status/executed_demo_condition_db.php",


		data: "delete_id="+delete_id+"&prospector_id="+prospector_id+"&action=ref_delete",


		success: function(msg){p8("#exe_demo_referal_div").html(msg);}


		});


}


}





/*****************************************************************************************************************/