function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 


function serarch_lead_details(m_id)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	if(document.getElementById("second_date").value)
		{
		if(document.getElementById("first_date").value=="")
    		 {
				alert("Please Enter From Date");
				return false;
    	     }
        }
	type_search=document.getElementById("type_all_search").value;
	search_data=document.getElementById("search_alltext").value;
	s_date=document.getElementById("first_date").value;
	e_date=document.getElementById("second_date").value;
	t_status=document.getElementById("allt_status").value;
	owner=document.getElementById("lead_owner").value;
	
	
	
	var url="lead_management/view_leades_body.php?type_search="+type_search+"&search_text="+search_data+"&mid="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&lead_status="+t_status+"&search=a";
	//alert(url);
	xmlHttp=GetXmlHttpObject(all_tkt_list22)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function all_tkt_list22() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("view_lead").innerHTML=xmlHttp.responseText 
	}
	
}

function daily_lead_details(m_id)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("ss");
	if(document.getElementById("second_date").value)
		{
		if(document.getElementById("first_date").value=="")
    		 {
				alert("Please Enter From Date");
				return false;
    	     }
        }
	
	s_date=document.getElementById("first_date").value;
	e_date=document.getElementById("second_date").value;
	owner=document.getElementById("lead_assign").value;
	
	
	
	var url="lead_management/daily_report_div.php?mid="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&search=a";
	//alert(url);
	xmlHttp=GetXmlHttpObject(daily_div_report)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function daily_div_report() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("daily_report").innerHTML=xmlHttp.responseText 
	}
	
}

function lead_summary_details(m_id)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("ss");
	if(document.getElementById("second_date").value)
		{
		if(document.getElementById("first_date").value=="")
    		 {
				alert("Please Enter From Date");
				return false;
    	     }
        }
	
	s_date=document.getElementById("first_date").value;
	e_date=document.getElementById("second_date").value;
	
	
	
	
	var url="lead_management/lead_summary_div.php?mid="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&search=a";
	//alert(url);
	xmlHttp=GetXmlHttpObject(lead_summary_report)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function lead_summary_report() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("lead_summary12").innerHTML=xmlHttp.responseText 
	}
	
}


function edit_lead_div(uid,gid,page_n){
     emailwindow=dhtmlmodal.open('UserBox', 'iframe', page_n+'?lead_id='+uid+'&group_id='+gid, 'Edit Lead', 'width=850px,height=600px,center=1,resize=1,scrolling=1')

} //

function view_lead_detail_div(uid,page_n){
     emailwindow=dhtmlmodal.open('UserBox', 'iframe', page_n+'?lead_id='+uid, 'Lead Detail', 'width=850px,height=600px,center=1,resize=1,scrolling=1')

} //

function assign_lead_detail_div(uid,page_n,mid){
     emailwindow=dhtmlmodal.open('UserBox', 'iframe', page_n+'?lead_id='+uid+'&mid='+mid, 'Assign Task', 'width=850px,height=600px,center=1,resize=1,scrolling=1')

} //
 function LeadDetails(id)
	 {
	     emailwindow=dhtmlmodal.open('UserBox', 'iframe', 'lead_management/lead_details.php?lead_id='+id, 'Lead Details', 'width=850px,height=440px,center=1,resize=1,scrolling=1')
	 } 
	 
	 function add_response(url)
	 {
	  emailwindow=dhtmlmodal.open('UserBox', 'iframe', url, 'Lead Details', 'width=850px,height=440px,center=1,resize=1,scrolling=1')
	 } 
	 
function lead_detail(url)
{
   emailwindow=dhtmlmodal.open('UserBox', 'iframe', url, 'Lead Details', 'width=850px,height=440px,center=1,resize=1,scrolling=1')
   	   
} 

function transfer_lead(portid,ow){
        
	
	url='lead_management/transfer_lead.php?lead_id='+portid+'&owner_lead='+ow;
	mywindow = window.open (url,"PrintView","scrollbars=1,resizable=no,width=600,height=400");
	mywindow.moveTo(1,1);
	}
	function review_lead_cont(portid,ser){
        
	
	url='lead_management/lead_cont_review.php?lead_id='+portid+'&service='+ser;
	mywindow = window.open (url,"PrintView","scrollbars=1,resizable=no,width=800,height=600");
	mywindow.moveTo(1,1);
	}
	function lead_dassign_task(url)
{
   emailwindow=dhtmlmodal.open('UserBox', 'iframe', url, 'Lead Details', 'width=850px,height=440px,center=1,resize=1,scrolling=1')
   	   
} 
function task_d(url)
	 {
	   mywindow = window.open (url,"PrintView","scrollbars=1,resizable=no,width=600,height=400");
	   mywindow.moveTo(1,1);
	 } 
	 function review_lead_cont1(portid,ser){
        
	
	url='lead_management/add_lead_com_review.php?lead_id='+portid+'&service='+ser;
	mywindow = window.open (url,"PrintView","scrollbars=1,resizable=no,width=800,height=600");
	mywindow.moveTo(1,1);
	}
	function upload_cont(portid){
        
	
	url='lead_management/upload_contract.php?lead_id='+portid;
	mywindow = window.open (url,"PrintView","scrollbars=1,resizable=no,width=600,height=400");
	mywindow.moveTo(1,1);
	}
	
	function edit_lead(cid,page_n){
       
	emailwindow=dhtmlmodal.open('UserBox', 'iframe', page_n+'?lead_id='+cid, 'Edit Lead', 'width=850px,height=440px,center=1,resize=1,scrolling=1')

}
function paging_lead_details(j)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	
	type_search=document.getElementById("hidden_type_search").value;
	search_data=document.getElementById("hidden_search_text").value;
	s_date=document.getElementById("hidden_first_date").value;
	e_date=document.getElementById("hidden_second_date").value;
	t_status=document.getElementById("hidden_allt_status").value;
	owner=document.getElementById("hidden_lead_owner").value;
	col=document.getElementById("hidden_column_id").value;
	qry=document.getElementById("hidden_query").value;
	m_id=document.getElementById("hidden_menu").value;
	
	var url="lead_management/view_leades_body.php?type_search="+type_search+"&search_text="+search_data+"&pageNum_rr="+j+"&selectme="+j+"&mid="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&lead_status="+t_status+"&qry="+qry+"&column_val="+col+"&search=y";
	
	//alert(url);
	xmlHttp=GetXmlHttpObject(all_tkt_list2)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 
function all_tkt_list2() 
{ 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("view_lead").innerHTML=xmlHttp.responseText 
	}
	
}
function serarch_lead_details(m_id)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	if(document.getElementById("second_date").value)
		{
		if(document.getElementById("first_date").value=="")
    		 {
				alert("Please Enter From Date");
				return false;
    	     }
        }
	type_search=document.getElementById("type_all_search").value;
	search_data=document.getElementById("search_alltext").value;
	s_date=document.getElementById("first_date").value;
	e_date=document.getElementById("second_date").value;
	t_status=document.getElementById("allt_status").value;
	owner=document.getElementById("lead_owner").value;
	
	m_id=document.getElementById("hidden_menu").value;
	//alert(m_id)
	var url="lead_management/view_leades_body.php?type_search="+type_search+"&search_text="+search_data+"&mid="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&lead_status="+t_status+"&search=a";
	//alert(url);
	xmlHttp=GetXmlHttpObject(all_tkt_list2)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 
function serarch_lead_details_com(m_id)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	if(document.getElementById("second_date").value)
		{
		if(document.getElementById("first_date").value=="")
    		 {
				alert("Please Enter From Date");
				return false;
    	     }
        }
	type_search=document.getElementById("type_all_search").value;
	search_data=document.getElementById("search_alltext").value;
	s_date=document.getElementById("first_date").value;
	e_date=document.getElementById("second_date").value;
	t_status=document.getElementById("allt_status").value;
	owner=document.getElementById("lead_owner").value;
	
	
	
	var url="lead_management/view_leades_com_body.php?type_search="+type_search+"&search_text="+search_data+"&nav_link="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&lead_status="+t_status+"&search=a";
	//alert(url);
	xmlHttp=GetXmlHttpObject(all_tkt_list_com)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function all_tkt_list_com() 
{ 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("view_lead_com").innerHTML=xmlHttp.responseText 
	}
	
}
function paging_lead_details_review(j)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	
	type_search=document.getElementById("hidden_type_search").value;
	search_data=document.getElementById("hidden_search_text").value;
	s_date=document.getElementById("hidden_first_date").value;
	e_date=document.getElementById("hidden_second_date").value;
	t_status=document.getElementById("hidden_allt_status").value;
	owner=document.getElementById("hidden_lead_owner").value;
	col=document.getElementById("hidden_column_id").value;
	qry=document.getElementById("hidden_query").value;
	m_id=document.getElementById("hidden_menu").value;
	
	var url="lead_management/view_leades_com_body.php?type_search="+type_search+"&search_text="+search_data+"&pageNum_rr="+j+"&selectme="+j+"&nav_link="+m_id+"&start_date="+s_date+"&end_date="+e_date+"&lead_owner="+owner+"&lead_status="+t_status+"&qry="+qry+"&column_val="+col+"&search=y";
	
	//alert(url);
	xmlHttp=GetXmlHttpObject(all_tkt_list_com)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function show_Task(date1,flag,mid)
{///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//alert("surendra");
	
	
	
	var url="lead_management/my_assigned_task.php?p_date="+date1+"&flag="+flag+"&mid="+mid+"&search=search";
	
	//alert(url);
	xmlHttp=GetXmlHttpObject(show_t)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 
function show_t() 
{ 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		document.getElementById("show_task").innerHTML=xmlHttp.responseText 
	}
	
}
