
var xmlHttp
function eraseCookie(name)
{createCookie(name,"",-1);}
function createCookie(name,value,days)
{if(days)
{var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function showCD(str,type)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{if(type=="category")
{if(document.getElementById("txtHint"))
{document.getElementById("txtHint").innerHTML=xmlHttp.responseText}
if(document.getElementById("textHint"))
{document.getElementById("textHint").innerHTML=xmlHttp.responseText}}
else if(type=="sub_category")
document.getElementById("user_sub_cat").innerHTML=xmlHttp.responseText
else if(type=="area")
document.getElementById("area").innerHTML=xmlHttp.responseText}}
xmlHttp.open("GET","select_category.php?q="+str+"&sid="+Math.random()+"&type="+type,true)
xmlHttp.send(null)}
function showCD_new(domain_select,str,type)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{if(type=="category")
{if(domain_select=="domain_select1")
{document.getElementById("txtHint").innerHTML=xmlHttp.responseText}
else if(domain_select=="domain_select2")
{document.getElementById("textHint").innerHTML=xmlHttp.responseText}}
else if(type=="sub_category")
document.getElementById("user_sub_cat").innerHTML=xmlHttp.responseText
else if(type=="area")
document.getElementById("area").innerHTML=xmlHttp.responseText}}
xmlHttp.open("GET","select_category.php?selected_domain="+domain_select+"&q="+str+"&sid="+Math.random()+"&type="+type,true)
xmlHttp.send(null)}
function advancedSearchAjax(str,type,docType)
{

if(type == 'category'){
if(str == 'AF1')
    {
     $('#paper_txt').html('WhatAbouts');
     $('#report_txt').html('eBooks');
     $('#wequest_box').attr('disabled', 'disabled');
 }
 else{
     $('#paper_txt').html('Papers');
     $('#report_txt').html('Reports for Sale');
     $('#wequest_box').attr('disabled', '');
 }
}

xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{if(type=="category")
{if(str=="all_domain")
{document.getElementById("txtHint").disabled=true;document.getElementById("user_sub_cat").disabled=true;document.getElementById("txtHint").innerHTML=xmlHttp.responseText;document.getElementById("user_sub_cat").innerHTML=xmlHttp.responseText;
}else{document.getElementById("txtHint").disabled=false;document.getElementById("user_sub_cat").disabled=true;document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}}else if(type=="sub_category")
{document.getElementById("user_sub_cat").disabled=false;document.getElementById("user_sub_cat").innerHTML=xmlHttp.responseText}
else if(type=="area")
document.getElementById("area").innerHTML=xmlHttp.responseText}}
xmlHttp.open("GET","/Search/select_category.php?q="+str+"&sid="+Math.random()+"&type="+type+"&docType="+docType,true)
xmlHttp.send(null)}
function changeDropDown(type,docType,selectValue)
{var select=document.getElementById("type");if(selectValue=="All")
{var paper_type_all_select_str="SELECTED"}
else if(selectValue=="pdf")
{var paper_type_pdf_select_str="SELECTED"}
else if(selectValue=="paper")
{var paper_type_text_select_str="SELECTED"}
else if(selectValue=="doc")
{var paper_type_doc_select_str="SELECTED"}
if(docType=="WeQUEST")
select.innerHTML="<select class='selWd2' name='paper_type' onchange='enable_disable(advanced_search.paper_type); enable_type(advanced_search.paper_type,advanced_search.search_in,advanced_search.graphics_criteria);'> <option value='All' "+paper_type_all_select_str+">All</option><option value='pdf' "+paper_type_pdf_select_str+">PDF</option><option value='paper' "+paper_type_text_select_str+">Text</option></select>";else if(docType=="paper"||docType=="press_release")
select.innerHTML="<select class='selWd2' name='paper_type' onchange='enable_disable(advanced_search.paper_type)'> <option value='All' "+paper_type_all_select_str+">All</option><option value='doc' "+paper_type_doc_select_str+">DOC</option><option value='pdf' "+paper_type_pdf_select_str+">PDF</option><option value='paper' "+paper_type_text_select_str+">Text</option></select>";else
select.innerHTML="<select class='selWd2' name='paper_type'  DISABLED> <option value='All'>All</option></select>";}
function enable_type(paperType,searchIn,graphics)
{if(paperType.value=="paper")
{searchIn.disabled=true;graphics.disabled=true;}
if(paperType.value=="all")
{graphics.disabled=true;}}
function showCat(str,type,selCat)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
xmlHttp.onreadystatechange=function()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{if(type=="category")
{document.getElementById("txtHint").innerHTML=xmlHttp.responseText
document.getElementById("textHint").innerHTML=xmlHttp.responseText}
else if(type=="sub_category")
document.getElementById("user_sub_cat").innerHTML=xmlHttp.responseText
else if(type=="area")
document.getElementById("area").innerHTML=xmlHttp.responseText}}
xmlHttp.open("GET","select_category.php?q="+str+"&sid="+Math.random()+"&type="+type+"&selCat="+selCat,true)
xmlHttp.send(null)}
function update_impr(ad_id,flag,campaign_id)
{xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Browser does not support HTTP Request");return;}
xmlHttp.open("GET","/Paper/update_keyword_impression.php?ad_id="+ad_id+"&flag="+flag+"&campaign_id="+campaign_id+"&sid="+Math.random(),true);xmlHttp.send(null);}
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
