﻿// JavaScript Document με ελληνικά
//global vars
var xmlHttp;
var g_tab ;


function change_frm(kateg) { 
if (kateg=="1") { 
	show_hide('frm_tab_1',1);
	show_hide('frm_tab_2',0);
	show_hide('frm_tab_3',0);
	document.frm_auto.style.display="block"; 
	document.frm_moto.style.display="none";
	document.frm_parts.style.display="none";
	document.frm_boats.style.display="none"; 
	show_hide('t1', 0);
	show_hide('t2', 1);
	show_hide('t3', 1);
	show_hide('t1m', 1);
	show_hide('t2m', 0);
	show_hide('t3m', 0);
}
if (kateg=="2") {
	document.frm_auto.style.display="none";
	document.frm_parts.style.display="none";
	document.frm_boats.style.display="none";
	document.frm_moto.style.display="block";
}
if (kateg=="3") {
	document.frm_moto.style.display="none";
	document.frm_auto.style.display="none";
	document.frm_parts.style.display="block"; 
	document.frm_boats.style.display="none";
}
if (kateg=="4") {
	document.frm_moto.style.display="none";
	document.frm_auto.style.display="none";
	document.frm_parts.style.display="none"; 
	document.frm_boats.style.display="block";
}
if (kateg=="5") {
	show_hide('frm_tab_1',0);
	show_hide('frm_tab_2',1);
	show_hide('frm_tab_3',0);
	show_hide('t1', 1);
	show_hide('t2', 0);
	show_hide('t3', 1);
	show_hide('t1m', 0);
	show_hide('t2m', 1);
	show_hide('t3m', 0);
}
if (kateg=="6") {
	show_hide('frm_tab_1',0);
	show_hide('frm_tab_2',0);
	show_hide('frm_tab_3',1);
	show_hide('t1', 1);
	show_hide('t2', 1);
	show_hide('t3', 0);
	show_hide('t1m', 0);
	show_hide('t2m', 0);
	show_hide('t3m', 1);
}
}

//Auti i function emfanizei i kribei ena antikeimeno 
function show_hide(layer_ref, value,adid) {
if (value == 1) {
state = 'block';
} else {
state = 'none';
} 
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}

/*******************Ajax**************************/
//*****************ajax functions for the montelo field******************//
////////////////////////////////////////////////////////////////ajax function show
function showUser(str,flag,tab)
{ 
g_tab = tab ;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="cars/getmodel.php";
url=url+"?q="+str;
url=url+"&fl="+flag;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

//ajax function checks state
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if (g_tab == 1) {
   document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
 } else {
   document.getElementById("txtHint2").innerHTML=xmlHttp.responseText;
 }
 } 
}
///////////////////////////////////////////////////////////////ajax function show
function show_area(str,flag,tab)
{ 
g_tab = tab ;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="estate/getregion.php";
url=url+"?q="+str;
url=url+"&fl="+flag;
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

//ajax function checks state
function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if (g_tab == 1) {
   document.getElementById("reg_2").innerHTML=xmlHttp.responseText;
 } else {
   document.getElementById("reg_3").innerHTML=xmlHttp.responseText;
 }
 } 
}

//////////////////////////////////////////////////////ajax function show
function show_kind(str,flag)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="jobs/getkind.php";
url=url+"?q="+str;
url=url+"&fl="+flag;
xmlHttp.onreadystatechange=stateChanged3;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

//ajax function checks state
function stateChanged3() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
   document.getElementById("kind_field").innerHTML=xmlHttp.responseText;
 } 
}

//ajax function get
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;
}
