function GetLocation(id,location_prefix)
  {
  new Ajax.Request(
      "ajax/getlocation.php?area="+ id + "&location_prefix="+ location_prefix + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
        if(location_prefix!="")	
        {
          tname='location_div_' + location_prefix;
          document.getElementById(tname).innerHTML=res.responseText	
        } 
         else
          document.getElementById('location_div').innerHTML=res.responseText	
          
         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function GetLocationProperty(id,id2,location_prefix)
  {
  new Ajax.Request(
      "ajax/getlocationProperty.php?area="+ id + "&city="+ id2 + "&location_prefix="+ location_prefix + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
        if(location_prefix!="")	
        {
          tname='location_div_' + location_prefix;
          document.getElementById(tname).innerHTML=res.responseText	
        } 
         else
          document.getElementById('location_div').innerHTML=res.responseText	
          
         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  
  function GetLocationFilterProperty(id,act)
  {
    new Ajax.Request(
      "ajax/getLocationFilterProperty.php?area="+ id + "&act=" + act +"&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	if(act=='city')
          		document.getElementById('filtercityid').innerHTML=res.responseText	;
            if(act=='city_zone')
           		document.getElementById('filtercityzoneid').innerHTML=res.responseText	;

         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  } 
  
  
 function GetLocationFilter(id)
  {
  new Ajax.Request(
      "ajax/getLocationFilter.php?area="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         
          	document.getElementById('filtercityid').innerHTML=res.responseText	;

         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  } 
  
  function getFilterCategoryData(id)
  {
  new Ajax.Request(
      "ajax/getFilterCategoryData.php?area="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('filtersubcategoryid').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function getFilterAutoCategoyData(id)
  {

    
   new Ajax.Request(
      "ajax/getFilterAutoData.php?category="+ id + "&act=cat" + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('filtersubcategoryid').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function getFilterAutoModelData(id)
  {
  new Ajax.Request(
      "ajax/getFilterAutoData.php?category="+ id + "&act=model" + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('filtermodel').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
 
  
  function GetCategory(id)
  {
  new Ajax.Request(
      "ajax/getcategories.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  } 
  
  function GetCategoryHorizont(id)
  {
  new Ajax.Request(
      "ajax/getcategoriesHorizont.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  } 
  
function JobCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/getjobtitles.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function TrevelCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/gettrevelcat.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
function PetsCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/getpetscat.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function SpecialistlCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/getspecialistcat.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  function SecondHandCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/getsecondhandcat.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
  
  function KidsCategoryBox(id)
  {
  new Ajax.Request(
      "ajax/getkidscategoies.php?category="+ id + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  } 
  
  function AutoCategoryBox(id,id1,id2)
  {
  new Ajax.Request(
      "ajax/getautocat.php?category="+ id + "&catid="+ id1 + "&rnd=" + Math.random()*5,
      {
        method: "get",
         onSuccess: function (res)
         {
         	
          document.getElementById('category_div').innerHTML=res.responseText	
          


         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
  }
  
function ActivateButton(ellementid,status)
  {
  	if(status)
  		document.getElementById(ellementid).disabled=false;
  	else
  		document.getElementById(ellementid).disabled=true;
  }
  

function ShowAdAddition(handler,saleid,devid,_new,e,requestData)
{	
	
	 if(e!="-1")
	 {
		
		 if(isIE())
		   {
		        tname=e.srcElement.tagName;
		   }
		else
		  {
		        tname=e.target.tagName;
		  }
		
		  if(tname=="INPUT" || tname=="IMG" || tname=="FONT")
		    return;
	      
	}   
        
	
 if(document.getElementById("offer_" + devid + "_" + saleid).style.display=="none")
 {
 	switch (handler)
 	{
 	   case "1":
 	 	  handler="getAdData.php"  + "?id="+ saleid +"&devid="+ devid + "&requestData=" + requestData + "&rnd=" + Math.random()*5;
 	   break;
 	   
 	   case "2":		     
 	    handler="editAdData.php"   + "?id="+ saleid +"&devid="+ devid +  "&requestData=" + requestData + "&rnd=" + Math.random()*5;

 	   break;
 	   
 	   default :
 	      handler="getAdData.php" + "?id="+ saleid +"&devid="+ devid + "&requestData=" + requestData + "&rnd=" + Math.random()*5;
 	   break;	
 	}
 	
 	 
     new Ajax.Request(
      "ajax/" + handler ,
      {
        method: "post",
         onSuccess: function (res)
         {
         	
          document.getElementById("offer_" + devid + "_" + saleid).style.display="block";
		  document.getElementById("offer_" + devid + "_" + saleid).innerHTML=res.responseText;
		  document.getElementById("row_" + devid + "_" + saleid).style.border="1px green solid";
		  

		 document.getElementById("row_" + devid + "_" + saleid).style.backgroundColor="#f0f0f0";
		 document.getElementById("pre_row_" + devid + "_" + saleid).style.backgroundColor="#e9f4cc";

         },
        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
       }
      )
 }
 else
  {
   document.getElementById("offer_" + devid + "_" + saleid).style.display="none";
   document.getElementById("row_" + devid + "_" + saleid).style.border="0px white solid";
   document.getElementById("row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
   if(!_new)
  	 	document.getElementById("pre_row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
   else
	   document.getElementById("pre_row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
  }

 }
 
function CloseAdditionInformation(devid,saleid,_new)
{
	document.getElementById("offer_" + devid + "_" + saleid).style.display="none";
   document.getElementById("row_" + devid + "_" + saleid).style.border="0px white solid";
   document.getElementById("row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
   if(!_new)
  	 	document.getElementById("pre_row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
   else
	   document.getElementById("pre_row_" + devid + "_" + saleid).style.backgroundColor="#ffffff";
}


function DeleteImageAjax(id,act,param,imgnum)
	{
		 new Ajax.Request(
	      "ajax/editAdImageManager.php?id="+ id + "&act="+ act + "&param="+ param + "&imgnum="+ imgnum + "&rnd1=" + Math.random()*5,
	      {
	        method: "post",
	         onSuccess: function (res)
	         {
	         	
	          document.getElementById('imgmanager').innerHTML=res.responseText	
	          
	
	
	         },
	        onFailure: function() { alert ("ERROR OCCURED DURING AJAX REQUEST"); }
	       }
	      )
	}
	
	function SetAction(act,formname,adid,prefix)
	{
		switch (act)
		{
			case "up":
			
				document.getElementById(formname).elements['act'].value="up_ad" ;
				document.getElementById(formname).elements['selected_ad'].value=adid ;
				document.getElementById(formname).elements['selctedprefix'].value=prefix ;
				SubmitById(formname);
		
			break
			
			case "visible":
			
				document.getElementById(formname).elements['act'].value="visible" ;
				document.getElementById(formname).elements['selected_ad'].value=adid ;
				document.getElementById(formname).elements['selctedprefix'].value=prefix ;
				SubmitById(formname);
		
			break
			
			case "invisible":
				document.getElementById(formname).elements['act'].value="invisible" ;
				document.getElementById(formname).elements['selected_ad'].value=adid ;
				document.getElementById(formname).elements['selctedprefix'].value=prefix ;
				SubmitById(formname);
		
			break
			
			
			case "delete":
			
			if(verify1(''))
			{	
				document.getElementById(formname).elements['act'].value="delete_ad" ;
				document.getElementById(formname).elements['selected_ad'].value=adid ;
				document.getElementById(formname).elements['selctedprefix'].value=prefix
				SubmitById(formname);
			}
			break;
		}
	}
