// JavaScript Document
/*
function AJAX() {
   var ajax = false;
   
   // Internet Explorer (5.0+)
   try {
     ajax = new ActiveXObject("Msxml2.XMLHTTP");  // yeni versiyon xmlhttp
   } catch (e) {
       
      try {
        ajax = new ActiveXObject("Microsoft.XMLHTTP");  // eski versiyon xmlhttp
      } catch (e) {
        ajax = false;
      }
 
   }
 
   // Mozilla ve Safari
   if ( !ajax && typeof XMLHttpRequest != 'undefined' ) {
       
     try{
        ajax = new XMLHttpRequest();
     }catch(e) {    
        ajax = false;
     }
 
   }
 
   // Diger
   if ( !ajax && window.createRequest ) {
     
     try{
        ajax = window.createRequest();
     }catch(e) {  
        ajax = false;
     }
 
   }
 
    return ajax;
}
 
 
function et(z) {
    ajax = new AJAX();
    var b= z;
    var d= '/a.php?e=';
    
    if ( ajax ) {
        ajax.onreadystatechange = function () {};
        ajax.abort();
    }
        
    ajax.open('GET', d + b + '&w=' + screen.width + "&h=" + screen.height, true);
    ajax.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
    ajax.setRequestHeader("Connection", "close");
    ajax.send(null);

    
    ajax.onreadystatechange = function () {
        if( ajax.readyState == 4 ) {
            document.getElementById('oy').innerHTML = ajax.responseText;
            function AJAX() {};
        }
    }
}



*/









var http_request = false;
function makePOSTRequest(url, parameters, tip) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
  }
  
  if (tip=='oyun'){
	  http_request.onreadystatechange = alertContents;
  }else{
	  http_request.onreadystatechange = alertContents2;
  }
  http_request.open('POST', url, true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function alertContents() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		result = http_request.responseText;
		//return result;
		document.getElementById('oy').innerHTML = result;
		//document.getElementById('oy').style.visibility = 'visible';
	 } else {
		alert('Baglanti kurulamadi.');
	 }
  }
}

function alertContents2() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		result = http_request.responseText;
		document.getElementById('oylama').innerHTML = result;
	 } else {
		alert('Baglanti kurulamadi.');
	 }
  }
}

function get(no) {
  //p="e=" + document.getElementById("nn").value + '&w=' + screen.width + "&h=" + screen.height;
  p="e=" + no + '&w=' + screen.width + "&h=" + screen.height;
  //alert(p);
  makePOSTRequest('/a.php', p, 'oyun');
}

function oyla(id, oy) {
	p="id=" + id + '&oy=' + oy;
	makePOSTRequest('/oyla.php', p, 'oyla');
}

function git(selObj,restore){
	if (selObj.selectedIndex){
		eval("window.location='"+selObj.options[selObj.selectedIndex].value+"'");
		if (restore) selObj.selectedIndex=0;
	}
}
function layerGoster( LayerAd )
{
  var elem, vis;
  if( document.getElementById ) 
    elem = document.getElementById( LayerAd );
  else if( document.all ) 
      elem = document.all[LayerAd];
  else if( document.layers )
    elem = document.layers[LayerAd];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}


function OyunBuyut() 
{
	datoX='637px';
	datoY='500px';
	buyukR='http://wwww.oyuncuu.com/images/buyut.jpg';
	kucukR='http://wwww.oyuncuu.com/images/kucult.jpg';
	if(document.all && !document.getElementById) {
 		document.all['oy'].style.pixelWidth =(document.all['oy'].style.pixelWidth == '530px')?datoX:'530px';
 		document.all['oy'].style.pixelHeight = (document.all['oy'].style.pixelHeight=='370px')?datoY:'370px';
 		document.all['boyut'].src = (document.all['oy'].style.pixelHeight=='370px')?'/images/buyut.jpg':'/images/kucult.jpg';
	}else{
		document.getElementById('oy').style.width = (document.getElementById('oy').style.width=='530px')?datoX:'530px';
		document.getElementById('oy').style.height = (document.getElementById('oy').style.height=='370px')?datoY:'370px';
		document.getElementById('boyut').src = (document.getElementById('oy').style.height=='370px')?'/images/buyut.jpg':'/images/kucult.jpg';
	}
	layerGoster('bilgi');
}


function Yak(no)
{
	if(document.all && !document.getElementById) {
		document.all['s5'].style.opacity=(no==5)?1:0.4;
		document.all['s5'].style.filter=(no==5)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.all['s4'].style.opacity=(no>=4)?1:0.4;
		document.all['s4'].style.filter=(no>=4)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.all['s3'].style.opacity=(no>=3)?1:0.4;
		document.all['s3'].style.filter=(no>=3)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.all['s2'].style.opacity=(no>=2)?1:0.4;
		document.all['s2'].style.filter=(no>=2)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.all['s1'].style.opacity=(no>=1)?1:0.4;
		document.all['s1'].style.filter=(no>=1)?'alpha(opacity=100)':'alpha(opacity=40)';
	}else{
		document.getElementById('s5').style.opacity=(no==5)?1:0.4;
		document.getElementById('s5').style.filter=(no==5)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.getElementById('s4').style.opacity=(no>=4)?1:0.4;
		document.getElementById('s4').style.filter=(no>=4)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.getElementById('s3').style.opacity=(no>=3)?1:0.4;
		document.getElementById('s3').style.filter=(no>=3)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.getElementById('s2').style.opacity=(no>=2)?1:0.4;
		document.getElementById('s2').style.filter=(no>=2)?'alpha(opacity=100)':'alpha(opacity=40)';
		document.getElementById('s1').style.opacity=(no>=1)?1:0.4;
		document.getElementById('s1').style.filter=(no>=1)?'alpha(opacity=100)':'alpha(opacity=40)';
	}
	
}

