var xmlHttp
var path_new="http://www.propertyrealestatemarket.com/";
//var path_new="http://computer12/realestate_video/";

function get_city()
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="getcity.php";
  var str=document.getElementById("listing_country_id").value;
  //alert(str);
  url=url+"?countryid="+str;
  url=url+"&sid="+Math.random();
  //alert("here");
  xmlHttp.onreadystatechange=stateChanged2;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChanged2()
{ 
  if (xmlHttp.readyState==4)
  { 
  //alert(xmlHttp.responseText);
  document.getElementById("div_city").innerHTML=xmlHttp.responseText;
  }
}



function get_country()
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="getcountry.php";
  var str=document.getElementById("continent_id").value;
  //alert(str);
  url=url+"?conid="+str;
  url=url+"&sid="+Math.random();
  //alert("here");
  xmlHttp.onreadystatechange=stateChanged1;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChanged1()
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("div_country").innerHTML=xmlHttp.responseText;
document.getElementById("div_city").innerHTML="";
}
}

function get_sub()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getsubcat.php";
var str=document.getElementById("category_id").value;
url=url+"?catid="+str;
url=url+"&sid="+Math.random();
//alert("here");
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("sub_cat").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
function get_city_name()
{
if(document.getElementById("listing_city_id").value=="NA")
{
document.getElementById("div_city_name").innerHTML="Mention City :<br><input type='text' name='city_name' id='city_name'>";
}
else
document.getElementById("div_city_name").innerHTML="";
}

function go_next()
{
//alert("here");
var ld=document.getElementById("lid").value;
//alert(lid);
document.location.href="listing_image.php?action=videoup&lid="+ld;
}
function go_complete()
{
document.location.href="listing_image.php";
}
function check_varies()
{
//alert("thhshsh");
if(document.getElementById("is_varies").checked==true)
document.getElementById("div_range").innerHTML="To &nbsp;&nbsp; <input type='text' name='to_selling_price' id='to_selling_price' size=14>";
else
document.getElementById("div_range").innerHTML="";
}
function check_varies1()
{
//alert("thhshsh");
if(document.getElementById("is_varies_rt").checked==true)
document.getElementById("div_range_rt").innerHTML="To &nbsp;&nbsp; <input type='text' name='to_rental_price' id='to_rental_price' size=14>";
else
document.getElementById("div_range_rt").innerHTML="";
}

function set_sale()
{
  //alert("test");
  if(document.getElementById("sale").checked==true)
  document.getElementById("div_selling").style.visibility = "visible";
  else
  {
      document.getElementById("div_selling").style.visibility = "hidden";
      //document.getElementById("from_selling_price").value="";
      //document.getElementById("to_selling_price").value="";
      //document.getElementById("is_varies").checked=false;
      //document.getElementById("div_range").innerHTML="";
      //document.getElementById("is_price_financing").checked=false;
      //document.getElementById("is_selling_price_negotiable").checked=false;

  }
}


function set_rent()
{
//alert("test");
  if(document.getElementById("rent").checked==true)
  document.getElementById("div_rental").style.visibility = "visible";
  else
  {
      document.getElementById("div_rental").style.visibility = "hidden";
      //document.getElementById("from_rental_price").value="";
      ///document.getElementById("to_rental_price").value="";
      //document.getElementById("is_varies_rt").checked=false;
      //document.getElementById("div_range_rt").innerHTML="";
      //document.getElementById("is_price_financing").checked=false;
      //document.getElementById("rental_period_id").selectedIndex=0;
      //document.getElementById("is_rental_price_negotiable").checked=false;

  }

}
function is_confirm(llid,imgid)
{
  is_confirm=confirm("Do you want to delete this image?");
  if (is_confirm)
  {
    window.location.href="listing_image.php?action=delete&lid="+llid+"&img_id="+imgid;
  }
  //document.window.location.href="listing_image.php?action=delete&lid="+llid+"&img_id="+imgid;
}
function is_comfirm_vid(llid,vidid)
{
  is_confirm=confirm("Do you want to delete this video?");
  if (is_confirm)
  {
    window.location.href="listing_image.php?action=deletevid&lid="+llid+"&vid_id="+vidid;
  }
}
function show_cat()
{
//alert("here");
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url=path_new+"getcategory.php";
  //var str=document.getElementById("continent_id").value;
  //alert(str);
  //url=url;
  url=url+"?sid="+Math.random();
  //alert(url);
  //alert("here");
  xmlHttp.onreadystatechange=stateChangedcat;

  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedcat()
{ 
  if (xmlHttp.readyState==4)
  { 

    document.getElementById("proptype").innerHTML=xmlHttp.responseText;
  }
}

function getbrowsertype()
  {

    var AgntUsr=navigator.userAgent.toLowerCase();
    var AppVer=navigator.appVersion.toLowerCase();
    var DomYes=document.getElementById?1:0;
    var NavYes=AgntUsr.indexOf('mozilla')!=-1&&AgntUsr.indexOf('compatible')==-1?1:0;
    var ExpYes=AgntUsr.indexOf('msie')!=-1?1:0;
    if (NavYes==1)
    return 1;
    if (ExpYes==1)
    return 0;
    //alert(NavYes);
    //alert(ExpYes);
  }
function show_worldwide()
{
  thisid=document.getElementById("div_worldwide");
  thisid.style.visibility="visible";
   thisid.style.position="absolute";
   z=document.body.offsetWidth;
    //alert(z);
    var btype;
    btype=getbrowsertype();
    if (btype==1)
    x=z-1000;
    else
    x=z-1024;
    x=x/2;
    x=x+16;
    x=parseInt(x,10);
    //alert(x);
    thisid.style.left=x+'px';
}
function remove_worldwide()
{
  thisid=document.getElementById("div_worldwide");
  thisid.style.visibility="hidden";
   thisid.style.position="absolute";
}

function show_proptype()
{
  thisid=document.getElementById("div_proptype");
  thisid.style.visibility="visible";
   thisid.style.position="absolute";
   z=document.body.offsetWidth;
    //alert(z);
    var btype;
    btype=getbrowsertype();
    if (btype==1){
    //alert("You are here.");
    x=z-1000;
    }
    else
    x=z-1024;
    x=x/2;
    x=x+16;
    x=parseInt(x,10);
    //alert(x);
    thisid.style.left=x+'px';
   // alert(thisid.style.position);
}
function remove_proptype()
{
  thisid=document.getElementById("div_proptype");
  thisid.style.visibility="hidden";
   thisid.style.position="absolute";
}



function show_world()
{
  //alert("show");
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url=path_new+"getgroup.php";
  //var str=document.getElementById("continent_id").value;
  //alert(str);
  //url=url;
  url=url+"?sid="+Math.random();
  //alert(url);
  //alert("here");
  if(document.getElementById("divworld").style.position=="absolute")
  document.getElementById("divworld").style.position="absolute";
  xmlHttp.onreadystatechange=stateChangedwor;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedwor()
{ 
  if (xmlHttp.readyState==4)
  { 
    //alert(document.getElementById("divworld").style.visibility);
    if(document.getElementById("divworld").style.visibility=="hidden")
    {
    document.getElementById("divworld").innerHTML=xmlHttp.responseText;
    document.getElementById("divworld").style.visibility="visible";
    }
  }
}
function show_world1()
{
var mysrc=event.srcElement.id.substr(0,3);
//alert(mysrc);
if (mysrc=='mtd' || mysrc=="anc" || mysrc=="tab")
{
}
else{
//alert("Go away!");
//if(event.srcElement.id=="tab1")
//{
//alert("inside loop");
//}
//else
//alert("outside loop");
document.getElementById("divworld").innerHTML="";
if(document.getElementById("divworld").style.visibility=="visible")
document.getElementById("divworld").style.visibility="hidden";
if(document.getElementById("divworld").style.visibility=="relative")
document.getElementById("divworld").style.position="absolute";
document.getElementById("divworld").style.top="0px";
}
}
var divname;
function show_city(cid,did)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
   divname=cid;
   divname1=did;
  var url=path_new+"getcitydetails.php";
  url=url+"?country_id="+cid+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedcity;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedcity()
{ 
  if (xmlHttp.readyState==4)
  { 

    document.getElementById("font"+divname).innerHTML="(-)";
    document.getElementById("link"+divname).href="javascript:close_div("+divname+","+divname1+");";
    //document.getElementById(divname).style.position="relative";
    document.getElementById(divname1).innerHTML=xmlHttp.responseText;

  }
}
function search_submit(cid)
{
//alert(cid);
document.getElementById("page").value=cid;
document.frmsearch.submit();
}
function close_div(cid,did)
{
document.getElementById(did).innerHTML="";
//document.getElementById(cid).style.position="absolute";
document.getElementById("font"+cid).innerHTML="(+)";
document.getElementById("link"+cid).href="javascript:show_city("+cid+","+did+");";

}
function world_close()
{
document.getElementById("divworld").innerHTML="";
document.getElementById("divworld").style.visibility="hidden";
document.getElementById("divworld").style.position="absolute";
}
function get_sub_cat(pid)
{
//alert(pid);
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }

  var url=path_new+"getsubcatdetails.php?parent_id="+pid;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedsubcat;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedsubcat()
{ 
  if (xmlHttp.readyState==4)
  { 

    //alert(xmlHttp.responseText);
    document.getElementById("all").checked=false;
    document.getElementById("subcat").innerHTML=xmlHttp.responseText;

  }
}
function get_country_search(cid)
{
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
  var url=path_new+"getcountrydetails.php?country_id="+cid;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedcountry;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedcountry()
{ 
  if (xmlHttp.readyState==4)
  { 
  //alert("this is a test.");
   //alert(xmlHttp.responseText);
    document.getElementById("divcountry").innerHTML=xmlHttp.responseText;
    document.getElementById("cgroup").style.visibility="hidden";
    document.getElementById("divall").style.visibility="visible";
    document.getElementById("div2").style.visibility="hidden";
    document.getElementById("allcoun").checked=false;



  }
}
function get_purdetail(purid)
{
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
  var url=path_new+"getpur.php?pur_id="+purid;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedpursrh;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedpursrh()
{ 
  if (xmlHttp.readyState==4)
  { 
  //alert("this is a test.");
   //alert(xmlHttp.responseText);
    document.getElementById("divpur").innerHTML=xmlHttp.responseText;

  }
}
function check_feature()
{
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
 var flg;
 //alert(document.getElementById("checkfeature").checked);
 if(document.getElementById("checkfeature").checked==true)
  flg=1;
 else
  flg=2;

  var url=path_new+"getfeaturesrh.php?flag="+flg;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChangedfeature;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);

}
function stateChangedfeature()
{ 
  if (xmlHttp.readyState==4)
  { 


    document.getElementById("divfeature").innerHTML=xmlHttp.responseText;

  }
}
function check_country()
{

  if(document.getElementById("allcoun").checked==true)
  {
    //alert();
    var str1=document.getElementById("totcountry").value.split("-");
    var i;

    //alert(str1.length);
    for(i=0;i<=str1.length-1;i++)
    {
    //alert();
    document.getElementById("C_"+str1[i]).checked=true;

    }

  }
  else
  {

    var str1=document.getElementById("totcountry").value.split("-");
    var i;

    for(i=0;i<=str1.length-1;i++)
    {
     document.getElementById("C_"+str1[i]).checked=false;
    }

  }

}
function prop_check()
{

if(document.getElementById("all").checked==true)
  {
    //alert(document.getElementById("subcat1").value);
    var str1=document.getElementById("subcat1").value.split("-");
    var i;

    //alert(str1.length);
    for(i=0;i<=str1.length-1;i++)
    {
    //alert(str1[i]);
    document.getElementById(str1[i]).checked=true;

    }

  }
  else
  {

    var str1=document.getElementById("subcat1").value.split("-");
    var i;

    for(i=0;i<=str1.length-1;i++)
    {
     document.getElementById(str1[i]).checked=false;
    }
    }

}
function show_feedback(lid)
{
 //alert(lid);
xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);

  var url=path_new+"getfeedback.php";
  url=url+"?sid="+Math.random()+"&listing_id="+lid;
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedfeed1;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedfeed1()
{ 
  if (xmlHttp.readyState==4)
  { 
    //alert(xmlHttp.responseText);
    document.getElementById("feedback").innerHTML=xmlHttp.responseText;
  }
}

function view_inquiry(llid)
{
window.location.href="view_listing.php?action=inquiry&lid="+llid;
}
function view_feedback(llid)
{
window.location.href="view_listing.php?action=feedback&lid="+llid;
}
function view_reply(llid)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);

  var url=path_new+"getfeedback.php";
  url=url+"?sid="+Math.random();
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedfeed;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);

}
function stateChangedfeed()
{
  //alert("testtesttesttest");
  if (xmlHttp.readyState==4)
  { 
    //alert("test here");
    document.getElementById("feedback").innerHTML=xmlHttp.responseText;

  }
}
var varstr;
function listing_show(str,pgg)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);

  //var pgg=1;
  varstr=str;
  var url=path_new+"getlisting.php?view_type="+str+"&page="+pgg;
  url=url+"?sid="+Math.random();
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedfeed;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
  seltabid=str+"_tab";
  oldseltabid=document.getElementById("seltab").value+"_tab";
  //document.getElementById("hp_midlt_new_"+str).id="hp_midlt_black_new_"+str
  //alert(document.getElementById(str).className);

  //alert(document.getElementById(seltabid).rows[0].cells[0].id);
  document.getElementById(seltabid).rows[0].cells[0].id=str;

  //alert(document.getElementById(oldseltabid).rows[0].cells[0].id);
  document.getElementById(oldseltabid).rows[0].cells[0].id=str+"_normal";
  //oldselval=document.getElementById("seltab").value;
  //newid=str+"_normal";
  //document.getElementById(oldselval).id=newid;
  document.getElementById("seltab").value=str;
}
function stateChangedfeed()
{ 
  if (xmlHttp.readyState==4)
  { 
    //alert("test here");
    document.getElementById("div_listing").innerHTML=xmlHttp.responseText;
    //namehref="hp_midlt_new_"+varstr;
    //selhref="hp_midlt_black_new_"+document.getElementById("seltab").value;//make the style name of selected.
    //document.getElementById(selhref).id="hp_midlt_new_"+document.getElementById("seltab").value;//assign to it
    //document.getElementById("seltab").value=varstr;


  }
}
function show_feedback1(lid)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);

  var url=path_new+"getfeedbackdetails.php?listing_id="+lid;
  url=url+"&sid="+Math.random();
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedfeed2;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedfeed2()
{ 
  if (xmlHttp.readyState==4)
  { 
    //alert("test here");
    document.getElementById("showfeedback").innerHTML=xmlHttp.responseText;

  }
}
var divreply;
function view_reply(inqid)
{
  //alert(inqid);
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
  divreply=inqid;

  var url=path_new+"getinquiry.php?inquiry_id="+inqid;
  url=url+"&sid="+Math.random();
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedviewreply;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedviewreply()
{ 
  if (xmlHttp.readyState==4)
  { 
    //alert("test here");
    document.getElementById(divreply).innerHTML=xmlHttp.responseText;
    //namehref="hp_midlt_new_"+divreply;
    //alert("hp_midlt_new_"+divreply);
    //document.getElementById(namehref).id = "hp_midlt_black_new_"+divreply;
    //selhref="hp_midlt_black_new_"+document.getElementById(seltab).value;
    //document.getElementById(selhref).id="hp_midlt_new_"+divreply;
  }
}
function win_open(img)
{
//alert(img);
window.open( path_new+"bigimage.php?image="+img, "myWindow","status = 1, height = 650, width = 700,top=20,left=200, resizable = 1" );


}
function show_article(cid,pn)
{
  //alert(inqid);
  //alert(cid);
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
  //divreply=inqid;

  var url=path_new+"getarticle.php?article_continent_id="+cid+"&page="+pn;
  url=url+"&sid="+Math.random();
  //alert(url);
  xmlHttp.onreadystatechange=stateChangedarticle;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedarticle()
{
  if (xmlHttp.readyState==4)
  { 
    //alert("test here");
    document.getElementById("showarticle").innerHTML=xmlHttp.responseText;

  }
}
function sec_close()
{
  document.getElementById("showarticle").innerHTML="";

}
function article_submit(pid)
{
document.getElementById("page").value=pid;
document.frmarticle.submit();
}
function vid_play(vid)
{
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    }
  //alert(cid);
  //divreply=inqid;
  //alert(path_new);
  var url=path_new+"getvideo.php?vid_id="+vid;
  url=url+"&sid="+Math.random();

  xmlHttp.onreadystatechange=stateChangedvidplay;
  //alert(url);
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function stateChangedvidplay()
{
  if (xmlHttp.readyState==4)
  {

    //alert("test here");
    document.getElementById("vid_play").innerHTML=xmlHttp.responseText;

  }
}
function vid_play1(vid)
{
//alert(vid);
window.open( path_new+"videoplay.php?vid_id="+vid, "myWindow","status = 1, height = 650, width = 700,top=20,left=200, resizable = 1" );
}

function vid_play7(vid)
{
alert(path_new);
}









