// Copyrights Korput Internet IT Consultancy & HR Inc © 2006
// All Javascript and CSS code written by Ünal Tabak <www.unaltabak.com>
// Do not change these lines for copyright. 18/January/2006
// http://www.korput.com/

//======================================== CUSTOM JAVASCRIPT START ==============================================

//------------------------------------------------
function plswait_show()
{
	if (document.getElementById)
	{
		document.getElementById('plswait').style.visibility='visible';
	} else {
	if (document.layers) 
	{ //NS4
		document.plswait.visibility = 'visible';
	}
	else { //IE4
		document.all.plswait.style.visibility = 'visible';	
		 }
	}
}

//------------------------------------------------
function plswait_hide()
{
	if (document.getElementById)
	{
		document.getElementById('plswait').style.visibility='hidden';
	} else {
	if (document.layers) 
	{ //NS4
		document.plswait.visibility = 'hidden';
	}
	else { //IE4
		document.all.plswait.style.visibility = 'hidden';	
		 }
	}
}

//------------------------------------------------
function address_warning(x)
{
	if (x=="1")
	{
		if (document.getElementById)
		{
			document.getElementById('address').style.visibility='visible';
			document.getElementById('address0').style.visibility='visible';
		} else {
		if (document.layers) 
		{ //NS4
			document.address.visibility = 'visible';
			document.address0.visibility = 'visible';	}
		else { //IE4
			document.all.address.style.visibility = 'visible';
			document.all.address0.style.visibility = 'visible';
			 }
		}
	} else {

		if (document.getElementById)
		{
			document.getElementById('address').style.visibility='hidden';
			document.getElementById('address0').style.visibility='hidden';
		} else {
		if (document.layers) 
		{ //NS4
			document.address.visibility = 'hidden';
			document.address0.visibility = 'hidden';	}
		else { //IE4
			document.all.address.style.visibility = 'hidden';
			document.all.address0.style.visibility = 'hidden';
			 }
		}
	}
} //address warning function


//------------------------------------------------
function sirketi_warning(x)
{
	if (x=="1")
	{
		if (document.getElementById)
		{
			document.getElementById('sirketi').style.visibility='visible';
			document.getElementById('sirpozmes').style.visibility='visible';
		} else {
		if (document.layers) 
		{ //NS4
			document.sirketi.visibility = 'visible';
			document.sirpozmes.visibility = 'visible';	}
		else { //IE4
			document.all.sirketi.style.visibility = 'visible';
			document.all.sirpozmes.style.visibility = 'visible';
			 }
		}
	} else {

		if (document.getElementById)
		{
			document.getElementById('sirketi').style.visibility='hidden';
			document.getElementById('sirpozmes').style.visibility='hidden';
		} else {
		if (document.layers) 
		{ //NS4
			document.sirketi.visibility = 'hidden';
			document.sirpozmes.visibility = 'hidden';	}
		else { //IE4
			document.all.sirketi.style.visibility = 'hidden';
			document.all.sirpozmes.style.visibility = 'hidden';
			 }
		}
	}
} //sirketi warning function

//------------------------------------------------
function pozisyonu_warning(x)
{
	if (x=="1")
	{
		if (document.getElementById)
		{
			document.getElementById('pozisyonu').style.visibility='visible';
			document.getElementById('sirpozmes').style.visibility='visible';
		} else {
		if (document.layers) 
		{ //NS4
			document.pozisyonu.visibility = 'visible';
			document.sirpozmes.visibility = 'visible';	}
		else { //IE4
			document.all.pozisyonu.style.visibility = 'visible';
			document.all.sirpozmes.style.visibility = 'visible';
			 }
		}
	} else {

		if (document.getElementById)
		{
			document.getElementById('pozisyonu').style.visibility='hidden';
			document.getElementById('sirpozmes').style.visibility='hidden';
		} else {
		if (document.layers) 
		{ //NS4
			document.pozisyonu.visibility = 'hidden';
			document.sirpozmes.visibility = 'hidden';	}
		else { //IE4
			document.all.pozisyonu.style.visibility = 'hidden';
			document.all.sirpozmes.style.visibility = 'hidden';
			 }
		}
	}
} //pozisyonu warning function

//------------------------------------------------
function meslegi_warning(x)
{
	if (x=="1")
	{
		if (document.getElementById)
		{
			document.getElementById('meslegi').style.visibility='visible';
			document.getElementById('sirpozmes').style.visibility='visible';
		} else {
		if (document.layers) 
		{ //NS4
			document.meslegi.visibility = 'visible';
			document.sirpozmes.visibility = 'visible';	}
		else { //IE4
			document.all.meslegi.style.visibility = 'visible';
			document.all.sirpozmes.style.visibility = 'visible';
			 }
		}
	} else {

		if (document.getElementById)
		{
			document.getElementById('meslegi').style.visibility='hidden';
			document.getElementById('sirpozmes').style.visibility='hidden';
		} else {
		if (document.layers) 
		{ //NS4
			document.meslegi.visibility = 'hidden';
			document.sirpozmes.visibility = 'hidden';	}
		else { //IE4
			document.all.meslegi.style.visibility = 'hidden';
			document.all.sirpozmes.style.visibility = 'hidden';
			 }
		}
	}
} //meslegi warning function

//------------------- AJAX START -----------------------

//XMLhttp variable will hold the XMLHttpRequest object
var xmlhttp = false;

// If the user is using Mozilla/Firefox/Safari/etc
if (window.XMLHttpRequest) {
		//Intiate the object
		xmlhttp = new XMLHttpRequest();
		//Set the mime type
		xmlhttp.overrideMimeType('text/xml');
} else if (window.ActiveXObject) { // If the user is using IE
		//Intiate the object
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} else { window.location="/error/ajaxerr.php"; }

function CountryChangesCityNDistrict() {

	//Put the form data into a variable
	var Driver = document.getElementById('ulkesi').value;
	
	//If the form data is *not* blank, query the DB and return the results
	if(Driver !== "") {

		if ( Driver == 192 || Driver == "192" ) { 

			//Change the content of the "result" DIV to "Searching..."
			document.getElementById('ili_res').innerHTML = "İler getiriliyor...";
			document.getElementById('ilcesi_res').innerHTML = "<select name='ilcesi' onFocus='text_focus(this);' onBlur='text_blur(this);' style=\"z-index:1; background-color:#FFFFFF; color:000080; border-top:0; border-left:0; border-right:1; border-bottom:1; border-top:0; border-left:0; border-right:1; border-bottom:1; font-family:verdana; font-size:11;\">\n	<option value=\"\" selected>» Lütfen önce bir İL seçiniz</option>\n</select>\n";
			//This sets a variable with the URL (and query strings) to our PHP script
			var url = '/ajax.php?ili_ulkesi=' + Driver;
			//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
			xmlhttp.open('GET', url, true);
			//Check that the PHP script has finished sending us the result
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					//Replace the content of the "result" DIV with the result returned by the PHP script
					document.getElementById('ili_res').innerHTML = xmlhttp.responseText + ' ';
				} else {
					//If the PHP script fails to send a response, or sends back an error, display a simple user-friendly notification
					document.getElementById('ili_res').innerHTML = 'İler getiriliyor...';
					//errwin = window.open("/error/errmail.php?hata=İller listesi getirilemiyor","error_win","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=300,height=160");
				}
			}
			xmlhttp.send(null);

		 } else { 

			document.getElementById('ili_res').innerHTML	= "<select name='ilcesi' onFocus='text_focus(this);' onBlur='text_blur(this);' style=\"z-index:1; background-color:#FFFFFF; color:#000080; border-top:0; border-left:0; border-right:1; border-bottom:1; border-top:0; border-left:0; border-right:1; border-bottom:1; font-family:verdana; font-size:11;\">\n	<option value=\"0\" selected>» YURTDIŞI / DİĞER -------</option>\n</select>\n";
			document.getElementById('ilcesi_res').innerHTML = "<select name='ilcesi' onFocus='text_focus(this);' onBlur='text_blur(this);' style=\"z-index:1; background-color:#FFFFFF; color:#000080; border-top:0; border-left:0; border-right:1; border-bottom:1; border-top:0; border-left:0; border-right:1; border-bottom:1; font-family:verdana; font-size:11;\">\n	<option value=\"0\" selected>» YURTDIŞI / DİĞER -------</option>\n</select>\n";
		 
		 }
 		plswait_hide();
	}
}


function CityChangesDistrict() {
	//Put the form data into a variable
	var Initiator = document.getElementById('ili').value;

	//If the form data is *not* blank, query the DB and return the results
	if(Initiator !== "") 
	{

		//Change the content of the "result" DIV to "Searching..."
		document.getElementById('ilcesi_res').innerHTML = "<img src='/images/bos.gif' width='1' height='10'><br><img id='bos' name='bos' src='/images/bos.gif' width='50' height='1'><img id='loading' name='loading' src='/imagez/loading.gif'>";
		//This sets a variable with the URL (and query strings) to our PHP script
		var url = '/ajax.php?ilce_ili=' + Initiator;
		//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
		xmlhttp.open('GET', url, true);
		//Check that the PHP script has finished sending us the result
		xmlhttp.onreadystatechange = function() {
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				//Replace the content of the "result" DIV with the result returned by the PHP script
				document.getElementById('ilcesi_res').innerHTML = xmlhttp.responseText + ' ';
			} else {
				//If the PHP script fails to send a response, or sends back an error, display a simple user-friendly notification
				document.getElementById('ilcesi_res').innerHTML = "<img src='/images/bos.gif' width='1' height='10'><br><img id='bos' name='bos' src='/images/bos.gif' width='50' height='1'><img id='loading' name='loading' src='/imagez/loading.gif'>";
				//errwin = window.open("/error/errmail.php?hata=1","error_win","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=300,height=160"); //İlçeler listesi getirilemiyor
			}
		}
		xmlhttp.send(null);  
		plswait_hide();
	}
}

//------------------- AJAX END -----------------------
//======================================== CUSTOM JAVASCRIPT END ==============================================
