// JavaScript Document

// Home Page Listing Tabs
	var activeSellerTitle='';
	var activeSearchTitle='';
  var horactiveTitle1 = "SuperTabDivId_3";
  var horactiveContent1 = "SubMainDivId_3";
  var verActiveTitle = new Array("","","");
  var verActiveContent = new Array("","","");
  var firstContent = new Array("newProLink_3_0_Container","newProLink_1_0_Container","newProLink_2_0_Container");
  var firstTitle = new Array("CityDivId_3_0","CityDivId_1_0","CityDivId_2_0");
  
  var verActiveSubContent = new Array("s_3_1", "s_1_1", "s_2_1");

  //Activate vertical DIV of passed ID's. Also receives index of currently active horizontal DIV.
  function verticalToggleDiv(contentDivId, titleDivId, horTabIndex, TransTy, CityID)
   {
       //First deactivate currently active tab.
       //If none is active, it means, first is active by default.
	   if(TransTy==3)
	   {
		   document.getElementById("sub_trans_ty_3").value='';
		   document.getElementById("sub_trans_ty_3").value=TransTy;
		   document.getElementById("sub_cit_id_3").value='';
		   document.getElementById("sub_cit_id_3").value=CityID;
		   //alert(document.getElementById("sub_trans_ty_3").value);
		   //alert(document.getElementById("sub_cit_id_3").value);
	   }
	   else if(TransTy==1)
	   {
		   //alert(TransTy);
		   //alert(CityID);
		   document.getElementById("sub_trans_ty_1").value='';
		   document.getElementById("sub_trans_ty_1").value=TransTy;
		   document.getElementById("sub_cit_id_1").value='';
		   document.getElementById("sub_cit_id_1").value=CityID;
	   }
	   else if(TransTy==2)
	   {
		   document.getElementById("sub_trans_ty_2").value='';
		   document.getElementById("sub_trans_ty_2").value=TransTy;
		   document.getElementById("sub_cit_id_2").value='';
		   document.getElementById("sub_cit_id_2").value=CityID;
	   }
	   
       if(verActiveTitle[horTabIndex] != "")
        document.getElementById(verActiveTitle[horTabIndex]).className = 'leftLinkDeActiveContainer';
       else
        document.getElementById(firstTitle[horTabIndex]).className = 'leftLinkDeActiveContainer';
  
      if(verActiveContent[horTabIndex] != "")
        document.getElementById(verActiveContent[horTabIndex]).style.display = 'none';
      else
        document.getElementById(firstContent[horTabIndex]).style.display = 'none';

      //Set the new tab as active.
      verActiveTitle[horTabIndex] = titleDivId;
      verActiveContent[horTabIndex] = contentDivId;

      document.getElementById(verActiveContent[horTabIndex]).style.display = 'block';
      document.getElementById(verActiveTitle[horTabIndex]).className = 'leftLinkActiveContainer';      
   }

 function horizonToggle(contentDivId1, titleDivId1)
    { 
      
      if(horactiveTitle1 != "")
        document.getElementById(horactiveTitle1).className = 'deActiveTabs';
        document.getElementById(horactiveTitle1).style.color = '#909090';
      if(horactiveContent1 != "")
        document.getElementById(horactiveContent1).style.display = 'none';

      horactiveTitle1 = titleDivId1;
      horactiveContent1 = contentDivId1;

      document.getElementById(horactiveContent1).style.display = 'block';
      document.getElementById(horactiveTitle1).className = 'activeTabs';
      document.getElementById(horactiveTitle1).style.color = '#000000';
    }

//change color of the text to black of deactive tab
function activateTabTittle(id1)
  {
    //alert(id1!=activeSearchTitle);
	
    if(id1!=activeSearchTitle && id1!=horactiveTitle1 && id1!=activeSellerTitle){
    document.getElementById(id1).style.color = '#000000';
    }
  }
//change color of the text to black of deactive tab

function deActivateTabTittle(id1)
  {
    //alert(id1!=activeSearchTitle);
    if(id1!=activeSearchTitle && id1!=horactiveTitle1 && id1!=activeSellerTitle){
        document.getElementById(id1).style.color = '#909090';
      }
  }

 String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function featuredList(city,div_id, TransTyp, city_id, propcat_id)
  { 
    /*if(document.getElementById(div_id).innerHTML.trim() == "") {*/
    //alert("test");
     //Set the loading image. onLoading event is not working properly.
	 if(TransTyp==3)
	{
		document.getElementById(verActiveSubContent[0]).className = 'nav-11';
		verActiveSubContent[0]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[0]);
		document.getElementById(verActiveSubContent[0]).className = 'active-12';
	}
	else if(TransTyp==1)
	{
		document.getElementById(verActiveSubContent[1]).className = 'nav-11';
		verActiveSubContent[1]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[1]);
		document.getElementById(verActiveSubContent[1]).className = 'active-12';
	}
	else if(TransTyp==2)
	{
		document.getElementById(verActiveSubContent[2]).className = 'nav-11';
		verActiveSubContent[2]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[2]);
		document.getElementById(verActiveSubContent[2]).className = 'active-12';
	}
	 document.getElementById(div_id).innerHTML ='';
     document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML;
          //alert('tab_listing.php?city_id='+city_id+'&trans_type='+TransTyp+'&propcat_id='+propcat_id);
     new Ajax.Updater(div_id,'tab_listing.php?city_id='+city_id+'&trans_type='+TransTyp+'&propcat_id='+propcat_id, 
     {
      method: 'get',
      
      //onLoading is creating problem - it's getting called after onSuccess!
      //onLoading: function(){
        //document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML; 
      //},
       
      onSuccess: function(transport) {
       var response = transport.responseText;
       document.getElementById(div_id).innerHTML = response;       
      },
      
      onFailure: function() {
        document.getElementById(div_id).innerHTML = "";
      }
    }
   );
   //}  
  }
  
  
  function Tab_Corporate_Leasing()
  {
	  window.location.href="corporate_leasing.php";
  }
  
  
  function featuredList_pr_cat(TransTyphidid, city_idhidid, propcat_idhidid)
  { 
  
  	//alert(city_idhidid);
	//alert(document.getElementById(TransTyphidid).value);
	//alert(document.getElementById(city_idhidid).value);
    var city_id=document.getElementById(city_idhidid).value;
	var trans_type=document.getElementById(TransTyphidid).value;
	var propcat_id=propcat_idhidid;
	var div_id='ListingContainer_'+trans_type+'_'+city_id;
	if(trans_type==3)
	{
		document.getElementById(verActiveSubContent[0]).className = 'nav-11';
		verActiveSubContent[0]='s_'+trans_type+'_'+propcat_id;
		document.getElementById(verActiveSubContent[0]).className = 'active-12';
	}
	else
	{
		document.getElementById(verActiveSubContent[trans_type]).className = 'nav-11';
		verActiveSubContent[trans_type]='s_'+trans_type+'_'+propcat_id;
		document.getElementById(verActiveSubContent[trans_type]).className = 'active-12';
	}
	
	
	/*if(document.getElementById(div_id).innerHTML.trim() == "") {*/
    //alert('tab_listing.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id);
     //Set the loading image. onLoading event is not working properly.
	 document.getElementById(div_id).innerHTML ='';
     document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML;
          //alert('tab_listing.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id);
      new Ajax.Updater(div_id,'tab_listing.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id, 
     {
      method: 'get',
      
      //onLoading is creating problem - it's getting called after onSuccess!
      //onLoading: function(){
        //document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML; 
      //},
       
      onSuccess: function(transport) {
       var response = transport.responseText;
       document.getElementById(div_id).innerHTML = response;       
      },
      
      onFailure: function() {
        document.getElementById(div_id).innerHTML = "";
      }
    }
   );
   //}  
  }
  
  
    function featuredList_pr_cat_nri(TransTyphidid, city_idhidid, propcat_idhidid)
  { 
  
  	//alert(city_idhidid);
	//alert(document.getElementById(TransTyphidid).value);
	//alert(document.getElementById(city_idhidid).value);
    var city_id=document.getElementById(city_idhidid).value;
	var trans_type=document.getElementById(TransTyphidid).value;
	var propcat_id=propcat_idhidid;
	var div_id='ListingContainer_'+trans_type+'_'+city_id;
	if(trans_type==3)
	{
		document.getElementById(verActiveSubContent[0]).className = 'nav-11';
		verActiveSubContent[0]='s_'+trans_type+'_'+propcat_id;
		document.getElementById(verActiveSubContent[0]).className = 'active-12';
	}
	else
	{
		document.getElementById(verActiveSubContent[trans_type]).className = 'nav-11';
		verActiveSubContent[trans_type]='s_'+trans_type+'_'+propcat_id;
		document.getElementById(verActiveSubContent[trans_type]).className = 'active-12';
	}
	
	
	/*if(document.getElementById(div_id).innerHTML.trim() == "") {*/
    //alert('tab_listing.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id);
     //Set the loading image. onLoading event is not working properly.
	 document.getElementById(div_id).innerHTML ='';
     document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML;
          //alert('tab_listing.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id);
      new Ajax.Updater(div_id,'tab_listing_nri.php?city_id='+city_id+'&trans_type='+trans_type+'&propcat_id='+propcat_id, 
     {
      method: 'get',
      
      //onLoading is creating problem - it's getting called after onSuccess!
      //onLoading: function(){
        //document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML; 
      //},
       
      onSuccess: function(transport) {
       var response = transport.responseText;
       document.getElementById(div_id).innerHTML = response;       
      },
      
      onFailure: function() {
        document.getElementById(div_id).innerHTML = "";
      }
    }
   );
   //}  
  }
  
  
  function featuredList_nri(city,div_id, TransTyp, city_id, propcat_id)
  { 
    /*if(document.getElementById(div_id).innerHTML.trim() == "") {*/
    //alert("test");
     //Set the loading image. onLoading event is not working properly.
	 if(TransTyp==3)
	{
		document.getElementById(verActiveSubContent[0]).className = 'nav-11';
		verActiveSubContent[0]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[0]);
		document.getElementById(verActiveSubContent[0]).className = 'active-12';
	}
	else if(TransTyp==1)
	{
		document.getElementById(verActiveSubContent[1]).className = 'nav-11';
		verActiveSubContent[1]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[1]);
		document.getElementById(verActiveSubContent[1]).className = 'active-12';
	}
	else if(TransTyp==2)
	{
		document.getElementById(verActiveSubContent[2]).className = 'nav-11';
		verActiveSubContent[2]='s_'+TransTyp+'_'+propcat_id;
		//alert(verActiveSubContent[2]);
		document.getElementById(verActiveSubContent[2]).className = 'active-12';
	}
	 document.getElementById(div_id).innerHTML ='';
     document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML;
          //alert('tab_listing.php?city_id='+city_id+'&trans_type='+TransTyp+'&propcat_id='+propcat_id);
     new Ajax.Updater(div_id,'tab_listing_nri.php?city_id='+city_id+'&trans_type='+TransTyp+'&propcat_id='+propcat_id, 
     {
      method: 'get',
      
      //onLoading is creating problem - it's getting called after onSuccess!
      //onLoading: function(){
        //document.getElementById(div_id).innerHTML = document.getElementById('flIndicator').innerHTML; 
      //},
       
      onSuccess: function(transport) {
       var response = transport.responseText;
       document.getElementById(div_id).innerHTML = response;       
      },
      
      onFailure: function() {
        document.getElementById(div_id).innerHTML = "";
      }
    }
   );
   //}  
  }


