function ajaxFunction($path,$type,$totalcount)
{  
	var xmlHttp;
  	try
    {    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
  	catch (e)
    {    // Internet Explorer    
		try
     	{      
		   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	 	}
    	catch (e)
      	{      
			try
        	{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
      		catch (e)
        	{        
				alert("Your browser does not support AJAX!");        
				return false;        
			}      
		}    
	}
	
    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
      {
	  	for(i=1;i<=$totalcount;i++)
 		{
 			if(i==$totalcount)
 			{
 				document.getElementById("currencyVal"+i).innerHTML="<b>"+xmlHttp.responseText+"</b>";
 			}
 			else
 			{
 				document.getElementById("currencyVal"+i).innerHTML=xmlHttp.responseText;
 			}
 		}
	  }
    }
    xmlHttp.open("GET",$path+"admin/invoice_currency.php?currency_val="+$type,true);
    xmlHttp.send(null);  
}
function addMoreData($level, $type, $path)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			if($type=="adv")
			{
         	 	document.getElementById("adv_level"+$level).innerHTML = xmlHttp.responseText;
			}
			else if($type=="product")
			{
         	 	document.getElementById("product_level"+$level).innerHTML = xmlHttp.responseText;
			}	
			else if($type=="agency")
			{
         	 	document.getElementById("agency_level"+$level).innerHTML = xmlHttp.responseText;
			}	
        }
    }
    xmlHttp.open("GET", $path+"sales/add_content.php?level="+$level+"&type="+$type+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
function addMoreDataAdmin($level, $type, $path)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			if($type=="agency")
			{
         	 	
				document.getElementById("agency_level"+$level).innerHTML = xmlHttp.responseText;
			}	
        }
    }
	xmlHttp.open("GET", $path+"admin/add_content.php?level="+$level+"&type="+$type+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
function contactsInf($path, $adv_id, $mode, $adv_conid, $type)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			document.getElementById("adv_contacts").innerHTML = xmlHttp.responseText;
	    }
    }
	if($mode)
	{
		xmlHttp.open("GET", $path+"admin/adv_contact.php?adv_id="+$adv_id+"&mode="+$mode+"&advertiser_contacts="+$adv_conid+"&type="+$type+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+"admin/adv_contact.php?adv_id="+$adv_id+"&type="+$type+"&dummy="+Math.random(),true);
	}
    
    xmlHttp.send(null);
}
function agency_contactsInf($path, $agen_id, $mode, $agen_conid, $type)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			document.getElementById("agen_contacts").innerHTML = xmlHttp.responseText;
	    }
    }
	if($mode)
	{
		xmlHttp.open("GET", $path+"admin/agen_contact.php?agen_id="+$agen_id+"&mode="+$mode+"&agency_contacts="+$agen_conid+"&type="+$type+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+"admin/agen_contact.php?agen_id="+$agen_id+"&type="+$type+"&dummy="+Math.random(),true);
	}
    
    xmlHttp.send(null);
}
function inv_contactsInf($path, $agen_conid, $agenid)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			document.getElementById("agen_contacts").innerHTML = xmlHttp.responseText;
		}
    }
	xmlHttp.open("GET", $path+"admin/agen_invcontact.php?agen_id="+$agenid+"&agen_cont="+$agen_conid+"&dummy="+Math.random(),true);
	xmlHttp.send(null);
}
function agency_sales_contactsInf($path, $agen_id, $mode, $agen_conid, $type)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			document.getElementById("agen_contacts_sales").innerHTML = xmlHttp.responseText;
	    }
    }
	if($mode)
	{
		xmlHttp.open("GET", $path+"sales/agen_contact.php?agen_id="+$agen_id+"&mode="+$mode+"&agency_contact="+$agen_conid+"&type="+$type+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+"sales/agen_contact.php?agen_id="+$agen_id+"&type="+$type+"&dummy="+Math.random(),true);
	}
    
    xmlHttp.send(null);
}
function adserve_stats($type, $size)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			document.getElementById("adserve_size").innerHTML = xmlHttp.responseText;
	    }
    }
	if($size)
	{
		xmlHttp.open("GET", "adserve_size.php?type="+$type+"&script_size="+$size+"&dummy="+Math.random(),true);
	}
	else
	{






		xmlHttp.open("GET", "adserve_size.php?type="+$type+"&dummy="+Math.random(),true);
	}
	xmlHttp.send(null);
}
function addMoreBanner($tdIdName, $path, $location, $size, $bannerName, $level, $type, $levelName, $mode, $type_inf, $type_url)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
	
    xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
        {
			var x= parseInt(document.getElementById(""+$levelName).value);
			document.getElementById(""+$tdIdName+""+x).innerHTML = xmlHttp.responseText;
		}
    }
	
	if($mode == "")
	{
		var x= parseInt(document.getElementById(""+$levelName).value);
	
		var y = x + 1;
		$level = y;
		
		if($type == "banner")
		{
			document.getElementById("actualbannercount"+$bannerName).value = $level;	
		}
		else
		{
			document.getElementById("actualtextcount").value = 	$level;	
		}
		xmlHttp.open("GET", $path+""+$location+"/moreBanners.php?size="+$size+"&bannerName="+$bannerName+"&level="+$level+"&type="+$type+"&dummy="+Math.random(),true);
	}
	else
	{
		$level = parseInt($level) + 1;
		xmlHttp.open("GET", $path+""+$location+"/moreBanners.php?size="+$size+"&bannerName="+$bannerName+"&level="+$level+"&type="+$type+"&mode="+$mode+"&type_inf="+$type_inf+"&type_url="+$type_url+"&dummy="+Math.random(),true);
	}
    xmlHttp.send(null);
}
function addQuestion($path, $level, $mode, $val, $addVal,$coregid, $qlevel, $coregLevel)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
   
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
        {
			if($mode == 'drop')
			{
				document.getElementById("sel_type"+$level).innerHTML = xmlHttp.responseText;
			}
			else if($mode == 'add')
			{
				document.getElementById("addType_"+$level+"_"+$addVal).innerHTML = xmlHttp.responseText;
				document.getElementById("q"+$level+"_add").value = $addVal;
			}
			else
			{
				document.getElementById("addQuestionLevel"+$level).innerHTML = xmlHttp.responseText;
			}
		}
    }
	var x = document.URL;
	var sp_var = x.split('sales');
	if(!$coregLevel || $coregLevel=="undefined")
	{
	   var $coregLevel = 1;
	}
	if($mode == 'drop')
	{
		if(sp_var.length >1)
		{
			xmlHttp.open("GET", $path+"sales/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&mode=drop&id="+$coregid+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
		else
		{
			xmlHttp.open("GET", $path+"admin/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&mode=drop&id="+$coregid+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
	}
	else if($mode == 'add')
	{
		if(sp_var.length >1)
		{
			xmlHttp.open("GET", $path+"sales/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&addLevel="+$addVal+"&mode=add&id="+$coregid+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
		else
		{
			xmlHttp.open("GET", $path+"admin/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&addLevel="+$addVal+"&mode=add&id="+$coregid+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
	}
	else
	{
		if(sp_var.length >1)
		{
			xmlHttp.open("GET", $path+"sales/coregQuestions.php?qlevel="+$level+"&id="+$coregid+"&clevel="+$coregLevel+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
		else
		{
			xmlHttp.open("GET", $path+"admin/coregQuestions.php?qlevel="+$level+"&id="+$coregid+"&clevel="+$coregLevel+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
		}
	}
	xmlHttp.send(null);
}

function editQuestion($path, $level, $mode, $val, $result, $coregid, $result2, $qlevel, $coregLevel)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
	xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==4)
        {
			document.getElementById("edit_quescode"+$level).style.display = "none";
			document.getElementById("sel_type"+$level).innerHTML = xmlHttp.responseText;
		}
	}
	var x = document.URL;
	var sp_var = x.split('sales');
	if(!$coregLevel || $coregLevel=="undefined")
	{
	   var $coregLevel = 1;
	}
	if(sp_var.length >1)
	{
		xmlHttp.open("GET", $path+"sales/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&mode=editdrop&id="+$coregid+"&result="+$result+"&res="+$result2+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+"admin/coregQuestions.php?qlevel="+$level+"&val="+$val+"&clevel="+$coregLevel+"&mode=editdrop&id="+$coregid+"&result="+$result+"&res="+$result2+"&ques_level="+$qlevel+"&dummy="+Math.random(),true);
	}
	xmlHttp.send(null);
}
function addMoreReturn($level, $path, $file, $type_level,$return_mode)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
			if($file == "coregs")
			{
				document.getElementById("return_level"+$level).innerHTML = xmlHttp.responseText;	
			}
			else if($file == "direct")
			{
				document.getElementById("return_level"+$level+"_"+$type_level).innerHTML = xmlHttp.responseText;	
			}	
        }
    }
    xmlHttp.open("GET", $path+"admin/return_values.php?level="+$level+"&file="+$file+"&type_l="+$type_level+"&rm="+$return_mode+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}		
function addMoreLogin($level, $path)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
       document.getElementById("partners_level"+$level).innerHTML = xmlHttp.responseText;	
    }
    xmlHttp.open("GET", $path+"partners_logins.php?level="+$level+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}	
function bookkeeperText($path,$result,$type,$result2)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
    {
       document.getElementById("bookkeeper").innerHTML = xmlHttp.responseText;	
    }
    xmlHttp.open("GET", $path+"admin/bookkeeper.php?result="+$result+"&type="+$type+"&result2="+$result2+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}	
function getStats($path,$qid,$sign,$from_date,$to_date)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
   
    if($sign == '-')
    {
    	document.getElementById("getVal"+$qid).innerHTML = "<a href='javascript:getStats(\""+$path+"\","+$qid+",\"+\",\""+$from_date+"\",\""+$to_date+"\");'>+</a>";	
    	document.getElementById("show_status"+$qid).innerHTML = '';
	}
	else
	{
		xmlHttp.onreadystatechange=function()
		{
		   document.getElementById("show_status"+$qid).innerHTML = xmlHttp.responseText;	
		   document.getElementById("getVal"+$qid).innerHTML = "<a href='javascript:getStats(\""+$path+"\","+$qid+",\"-\",\""+$from_date+"\",\""+$to_date+"\");'>-</a>";
		}
		xmlHttp.open("GET", $path+"admin/quesPageStats.php?qid="+$qid+"&from_date="+$from_date+"&to_date="+$to_date+"&dummy="+Math.random(),true);
	}
	xmlHttp.send(null);			
}
function getStats2($path,$sid,$sign,$from_date,$to_date)
{
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
   
    if($sign == '-')
    {
    	document.getElementById("getVal"+$sid).innerHTML = "<a href='javascript:getStats2(\""+$path+"\","+$sid+",\"+\",\""+$from_date+"\",\""+$to_date+"\");'>+</a>";	
    	document.getElementById("show_status"+$sid).innerHTML = '';
	}
	else
	{
		xmlHttp.onreadystatechange=function()
		{
		   document.getElementById("show_status"+$sid).innerHTML = xmlHttp.responseText;	
		   document.getElementById("getVal"+$sid).innerHTML = "<a href='javascript:getStats2(\""+$path+"\","+$sid+",\"-\",\""+$from_date+"\",\""+$to_date+"\");'>-</a>";
		}
		xmlHttp.open("GET", $path+"admin/quesPageStats2.php?sid="+$sid+"&from_date="+$from_date+"&to_date="+$to_date+"&dummy="+Math.random(),true);
	}
	xmlHttp.send(null);			
}
function generateUrl($path, $camID, $qid)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("genurl").innerHTML = xmlHttp.responseText;	
		}  
	}
    xmlHttp.open("GET", $path+"admin/ques_url.php?camID="+$camID+"&qid="+$qid+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}	
function externalTracking($path,$level)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("externalTrack"+$level).innerHTML = xmlHttp.responseText;	
		}  
	}
    xmlHttp.open("GET", $path+"admin/external_track.php?level="+$level+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}	
function notOpenList($path,$type,$val)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("notopenList").innerHTML = xmlHttp.responseText;	
		}  
	}
	if($type == "agent")
	{
    	xmlHttp.open("GET", $path+"admin/agenciesNotopenList.php?val="+$val+"&dummy="+Math.random(),true);
	}
	else if($type == "advertiser")
	{
    	xmlHttp.open("GET", $path+"admin/advertisersNotopenList.php?val="+$val+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+"admin/partnersNotopenList.php?val="+$val+"&dummy="+Math.random(),true);
	}	
    xmlHttp.send(null);	
}	
function returnTypeChange($path,$type,$mode,$file,$coregid)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("returnCode").innerHTML = xmlHttp.responseText;	
		}  
	}
	xmlHttp.open("GET", $path+"admin/returncode.php?type="+$type+"&mode="+$mode+"&file="+$file+"&id="+$coregid+"&dummy="+Math.random(),true);
    xmlHttp.send(null);	
}	

function micTool($path, $code, $id, $del)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", $path+"admin/tool_code.php?code="+$code+"&id="+$id+"&del="+$del+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}	


function call_add_field_valid($val, $id, $nam)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			//document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
			add_field_value(xmlHttp.responseText, $val, $nam);
			//alert(xmlHttp.responseText);
			
		}
		  
	}
	xmlHttp.open("GET", "./check_add_field.php?val="+$val+"&id="+$id+"&nam="+$nam,true);
    xmlHttp.send(null);
}	


function email_existing(frm, $path, $camid, $val){
	var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
	xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
      {
	  	//alert("em :"+xmlHttp.responseText);
		frm.email_vals.value = xmlHttp.responseText;
		//alert(document.user_survey.email_vals.value);
		//Valid(document.microsite);
		var test = "Valid"+camID;
		eval(test + '(frm)');
	  }
    }
	xmlHttp.open("GET",$path+"check_existing_email.php?camid="+$camid+"&em="+$val,true);
	xmlHttp.send(null);
}
function addPack($path,$location)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("newpackage").innerHTML = xmlHttp.responseText;	
		}  
	}
	xmlHttp.open("GET", $path+""+$location+"/package.php?dummy="+Math.random(),true);
    xmlHttp.send(null);
}	
function addFlash($tdIdName, $path, $location, $bannerName)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById(""+$tdIdName+"").innerHTML = xmlHttp.responseText;
		}  
	}
	xmlHttp.open("GET", $path+""+$location+"/flash_banner.php?bannerName="+$bannerName+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}	
function editPack($path,$location,$packid,$camid,$adv_id,$mode)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	//document.getElementById("package_edit").style.display = "none";
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("editpackage").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	if($location == "sales")
	{
		xmlHttp.open("GET", $path+""+$location+"/package.php?mode=edit&camid="+$camid+"&packid="+$packid+"&id="+$adv_id+"&mode2="+$mode+"&dummy="+Math.random(),true);
	}
	else
	{
		xmlHttp.open("GET", $path+""+$location+"/package.php?mode=edit&camid="+$camid+"&packid="+$packid+"&dummy="+Math.random(),true);
	}			
    xmlHttp.send(null);
}
function surveymicTool($path, $code, $id, $del, $page)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", $path+"admin/survey_tool_code.php?pagenum="+$page+"&code="+$code+"&id="+$id+"&del="+$del+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
function surveymicTool2($path, $code, $id, $pnum, $del)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", $path+"admin/survey_tool_code2.php?code="+$code+"&id="+$id+"&pagenum="+$pnum+"&del="+$del+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
function showQuesOptionCam(path, optnum, rnum, rid, ctype, qid, pnum, optvalue, accType)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("displayOptCam"+rnum).innerHTML = xmlHttp.responseText;	
		}
		  
	}	
	xmlHttp.open("GET", path+"questionair_option_code.php?optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&qid="+qid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
	
	xmlHttp.send(null);
}
function showOptionCam(path, optnum, rnum, rid, ctype, sid, pnum, optvalue, accType, boxId)
{
	if(document.getElementById(boxId).checked == true && ctype == 3)
	{
		var xmlHttp;
		try
		{
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{				
				document.getElementById("displayOptCam"+rnum+"_"+optnum).innerHTML = xmlHttp.responseText;					
			}
			  
		}
		xmlHttp.open("GET", path+"survey/survey_option_code.php?optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&sid="+sid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
		xmlHttp.send(null);
	}
	else if(ctype == 3)
	{		
		document.getElementById("displayOptCam"+rnum+"_"+optnum).innerHTML = "";				
	}else
	{
		var xmlHttp;
		try
		{
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{				
				document.getElementById("displayOptCam"+rnum).innerHTML = xmlHttp.responseText;		
			}
			  
		}
		xmlHttp.open("GET", path+"survey/survey_option_code.php?optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&sid="+sid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
		xmlHttp.send(null);
	}
}
function showOptionCam2(path, optnum, rnum, rid, ctype, sid, pnum, optvalue, accType)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("displayOptCamCoreg"+rnum).innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", path+"survey/survey_option_code2.php?optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&sid="+sid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
	xmlHttp.send(null);
}

/*********************Survey****************************/
function call_add_field_valid2($val, $id, $nam)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			//document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
			add_field_value(xmlHttp.responseText, $val, $nam);
			//alert(xmlHttp.responseText);
			
		}
		  
	}
	xmlHttp.open("GET", "./check_add_field2.php?val="+$val+"&id="+$id+"&nam="+$nam,true);
    xmlHttp.send(null);
}
/************************Get the rejection leads of campaign******************************/
function getRectionLeads(path, camID, camFlag)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{			
			if(parseInt(camFlag)==1)
			document.getElementById("displayCoregRejLeads"+camID).innerHTML = xmlHttp.responseText;
			else
			document.getElementById("displayRejLeads"+camID).innerHTML = xmlHttp.responseText;	
		}
		  
	}
	if(parseInt(camFlag)==1)
	xmlHttp.open("GET", path+"admin/getRejectionLeads.php?coregcamID="+camID+"&dummy="+Math.random(),true);
	else
	xmlHttp.open("GET", path+"admin/getRejectionLeads.php?camID="+camID+"&dummy="+Math.random(),true);
	
	xmlHttp.send(null);
}
/*************************Get the rejection leads of campaign*****************************/
/*************************Get the campaigns for user requested country*****************************/
function loadPartersCampaigns(userid, mode, country)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{						
			document.getElementById("displayUserCams"+userid).innerHTML = xmlHttp.responseText;	
		}else
		{
			document.getElementById("displayUserCams"+userid).innerHTML = "Please wait...";
		}
	}
	
	var req_country = "dk";
	var req_mode = "edit";
	
	if(mode=="1")
	req_mode = "edit";
	else if(mode=="2")
	req_mode = "add";
	else
	req_mode = mode;
	
	if(country=="1")
	req_country = "dk";
	else if(country=="2")
	req_country = "se";
	else if(country=="3")
	req_country = "de";
	else if(country=="4")
	req_country = "uk";
	else if(country=="5")
	req_country = "es";
	else if(country=="6")
	req_country = "no";
	else if(country=="7")
	req_country = "fi";
	else if(country=="8")
	req_country = "au";
	else if(country=="9")
	req_country = "fr";
	else if(country=="10")
	req_country = "pt";
	else if(country=="11")
	req_country = "it";
	else
	req_country = country;
	
	//set default campaign percentage is 0 while changing the country
	document.getElementById('pay_all').value = "";
	document.getElementById('pay_all_coreg').value = "";
	
	for(var i=0; i<document.partnersfrm.set_country.length; i++)
	{
	   if(document.partnersfrm.set_country[i].checked)
	   {
		var con_code = document.partnersfrm.set_country[i].value;
		var slct_country2 = 'sel_country_'+con_code;
		
		document.getElementById(slct_country2).style.color = "black";
	   }
	}
	
	var ptype = document.getElementById("partner_type").value;
	
	//active country color change
	var slct_country = 'sel_country_'+req_country;	
	document.getElementById(slct_country).style.color = "red";
	
	var path = "http://affilate.mikkelsenmedia.dk/partnersystem/";
	
	xmlHttp.open("GET", path+"admin/partners_campaigns.php?ptype="+ptype+"&userid="+userid+"&mode="+req_mode+"&req_country="+req_country+"&dummy="+Math.random(),true);
	
	xmlHttp.send(null);
}
/*************************Get the campaigns for user requested country*****************************/

/************************Insert the facebook application responses ******************************/
function insertResponseDetails(path, postID, partnerID, camID, mikkAppID, typeID)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{			
			//getting response			
		}		  
	}
	//alert("camID="+camID+"&postID="+postID+"&partnerID="+partnerID+"&mikkAppID="+mikkAppID+"&typeID="+typeID+"");
	xmlHttp.open("GET", path+"insertFBresponse.php?camID="+camID+"&postID="+postID+"&partnerID="+partnerID+"&mikkAppID="+mikkAppID+"&typeID="+typeID+"&dummy="+Math.random(),true);
	
	xmlHttp.send(null);
}
/*************************Insert the facebook application responses*****************************/

/*************************Get the campaigns for user requested country*****************************/
function loadPendingPartersCampaigns(id, mode, country)
{
	var xmlHttp;
  	try
	{
	    // Firefox, Opera 8.0+, Safari
	    xmlHttp=new XMLHttpRequest();
	}
  	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{						
			document.getElementById("displayUserCams"+id).innerHTML = xmlHttp.responseText;	
		}else
		{
			document.getElementById("displayUserCams"+id).innerHTML = "Please wait...";
		}
	}
	
	var req_country = "dk";
	var req_mode = "edit";
	
	if(mode=="1")
	req_mode = "edit";
	else if(mode=="2")
	req_mode = "add";
	else
	req_mode = mode;
	
	if(country=="1")
	req_country = "dk";
	else if(country=="2")
	req_country = "se";
	else if(country=="3")
	req_country = "de";
	else if(country=="4")
	req_country = "uk";
	else if(country=="5")
	req_country = "es";
	else if(country=="6")
	req_country = "no";
	else if(country=="7")
	req_country = "fi";
	else if(country=="8")
	req_country = "au";
	else if(country=="9")
	req_country = "fr";
	else if(country=="10")
	req_country = "pt";
	else if(country=="11")
	req_country = "it";
	else
	req_country = country;
	
	
	for(var i=0; i<document.partnersfrm.set_country.length; i++)
	{
	   if(document.partnersfrm.set_country[i].checked)
	   {
		var con_code = document.partnersfrm.set_country[i].value;
		var slct_country2 = 'sel_country_'+con_code;
		
		document.getElementById(slct_country2).style.color = "black";
	   }
	}
	
	var ptype = document.getElementById("partner_type").value;
	//active country color change
	var slct_country = 'sel_country_'+req_country;	
	document.getElementById(slct_country).style.color = "red";
	
	var path = "http://affilate.mikkelsenmedia.dk/partnersystem/";
	
	xmlHttp.open("GET", path+"admin/pending_partners_campaigns.php?ptype="+ptype+"&id="+id+"&mode="+req_mode+"&req_country="+req_country+"&dummy="+Math.random(),true);
	
	xmlHttp.send(null);
}
/*************************Get the campaigns for user requested country*****************************/
function fbmicTool($path, $code, $id, $del)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", $path+"admin/fb_tool_code.php?code="+$code+"&id="+$id+"&del="+$del+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
/*******************FB Survey********************/
function fbSurveymicTool($path, $code, $id, $del, $page)
{
	var xmlHttp;
  	try
    {
    	// Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }
  	catch (e)
    {
    	// Internet Explorer
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	}
    	catch (e)
      	{
      		try
        	{
       			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	}
      		catch (e)
        	{
        		alert("Your browser does not support AJAX!");
        		return false;
        	}
      	}
    }
	xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4)
      	{
			document.getElementById("code_tool").innerHTML = xmlHttp.responseText;	
		}
		  
	}
	xmlHttp.open("GET", $path+"admin/fb_survey_tool_code.php?pagenum="+$page+"&code="+$code+"&id="+$id+"&del="+$del+"&dummy="+Math.random(),true);
    xmlHttp.send(null);
}
/******************FB SUrvey**********************/

/*******************Send campaign info to partner********************/
function sendCamEmailToPartner(path, cam_id, cam_flag, ecpc, myecpc, price, pid, cam_type, budget, revenueShare, plus_flag)
{	
	if(trimWhitespace(document.getElementById('partner_email'+cam_id).value)=='')
	{
		alert("Please enter email");
		document.getElementById('partner_email'+cam_id).focus();
		return false;
	}
	else if(!isValidEmailStrict(document.getElementById('partner_email'+cam_id).value))
	{
		alert("Please enter valid email");
		document.getElementById('partner_email'+cam_id).focus();
		return false;
	}
	else if(trimWhitespace(document.getElementById('login_email').value)=="")
	{
		alert("Please add a email on your profile, before you can send emails");		
		return false;
	}else
	{		
		var email = trimWhitespace(document.getElementById('partner_email'+cam_id).value);
		var email_subject = trimWhitespace(document.getElementById('pemail_subject'+cam_id).value);
		var email_message = trimWhitespace(document.getElementById('pemail_message'+cam_id).value);
		var xmlHttp;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById("display_result"+cam_id).innerHTML = xmlHttp.responseText;	
			}
			  
		}
		var params = "&email_subject="+email_subject+"&email_message="+encodeURIComponent(email_message)+"&cam_type="+cam_type+"&budget="+budget+"&revenueShare="+revenueShare+"&plus_flag="+plus_flag;
		xmlHttp.open("POST", path+"admin/send_cam_info_to_partner.php?email="+email+"&cam_id="+cam_id+"&cam_flag="+cam_flag+"&ecpc="+ecpc+"&myecpc="+myecpc+"&price="+price+params+"&pid="+pid+"&dummy="+Math.random(),true);
		xmlHttp.send(null);
	}
}
/******************Send campaign info to partner**********************/
/*******************Send coreg campaign info to partner********************/
function sendCoregEmailToPartner(path, coregid, price, pid, budget)
{	
	if(trimWhitespace(document.getElementById('partner_email'+coregid).value)=='')
	{
		alert("Please enter email");
		document.getElementById('partner_email'+coregid).focus();
		return false;
	}
	else if(!isValidEmailStrict(document.getElementById('partner_email'+coregid).value))
	{
		alert("Please enter valid email");
		document.getElementById('partner_email'+coregid).focus();
		return false;
	}
	else if(trimWhitespace(document.getElementById('login_email').value)=="")
	{
		alert("Please add a email on your profile, before you can send emails");		
		return false;
	}
	else
	{		
		var email = trimWhitespace(document.getElementById('partner_email'+coregid).value);
		var email_subject = trimWhitespace(document.getElementById('pemail_subject'+coregid).value);
		var email_message = trimWhitespace(document.getElementById('pemail_message'+coregid).value);
		var xmlHttp;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById("display_result"+coregid).innerHTML = xmlHttp.responseText;	
			}
			  
		}
		xmlHttp.open("POST", path+"admin/send_coreg_info_to_partner.php?email="+email+"&email_subject="+email_subject+"&email_message="+encodeURIComponent(email_message)+"&coregid="+coregid+"&budget="+budget+"&price="+price+"&pid="+pid+"&dummy="+Math.random(),true);
		xmlHttp.send(null);
	}
}
/******************Send campaign info to partner**********************/
/*******************Save facebook user details into site********************/
function saveFBUserDetails(path, app_string, app_type)
{		
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			//No need to display result
			//document.getElementById("fb_user_result"+app_string).innerHTML = xmlHttp.responseText;	
		}
	}
	
	xmlHttp.open("GET", path+"microsite2/save_fb_userinfo.php?app_string="+app_string+"&app_type="+app_type+"&dummy="+Math.random(),true);
	xmlHttp.send(null);
}
/*******************Save facebook user details into site********************/
function showOptionCamContentMail(path, optnum, rnum, rid, ctype, sid, pnum, optvalue, accType, boxId)
{
	if(document.getElementById(boxId).checked == true && ctype == 3)
	{
		var xmlHttp;
		try
		{
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{				
				document.getElementById("displayOptCamContentMail"+rnum+"_"+optnum).innerHTML = xmlHttp.responseText;				
			}
			  
		}	
		xmlHttp.open("GET", path+"survey/survey_option_code.php?mode=content_mail&optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&sid="+sid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
		
		xmlHttp.send(null);
	}else if(ctype == 3)
	{		
		document.getElementById("displayOptCamContentMail"+rnum+"_"+optnum).innerHTML = "";			
	}else
	{
		var xmlHttp;
		try
		{
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{				
				document.getElementById("displayOptCamContentMail"+rnum).innerHTML = xmlHttp.responseText;	
			}
			  
		}	
		xmlHttp.open("GET", path+"survey/survey_option_code.php?mode=content_mail&optnum="+optnum+"&rnum="+rnum+"&rid="+rid+"&ctype="+ctype+"&sid="+sid+"&pnum="+pnum+"&optvalue="+optvalue+"&accType="+accType+"&dummy="+Math.random(),true);
		
		xmlHttp.send(null);
	}
}

