// JavaScript Document

var url = "ajax.php";
var http=GetXmlHttpObject();
function GetXmlHttpObject()
{
	var http=null;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	            http = new XMLHttpRequest();
	            if (http.overrideMimeType) {
	                http.overrideMimeType('text/xml');
	                // See note below about this line
	            }
	        }   
	        else if (window.ActiveXObject) { // IE
	            try {
	                http = new ActiveXObject("Msxml2.XMLHTTP");
	            } 
	            catch (e) {
	                try {
	                    http = new ActiveXObject("Microsoft.XMLHTTP");
	                } 
	                catch (e) {}
	            }
	        } 
	return http;
	
	/*try
	  {
	  // Firefox, Opera 8.0+, Safari
	  http=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    http=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    http=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }*/

}
//////////////////////////////


function oykullan(oy)
{
	http.open('POST', 'oy_kullan.php', true);
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	http.onreadystatechange= function() {
		div_=document.getElementById('sonuc');
		yazi='<img src="img/loading.gif" style="float:left;">';
		if(http.readyState==4)
		{
			yazi = http.responseText;			
		}
		div_.innerHTML=yazi;
	};    
	http.send("oy=" + oy); 
/*
alert(oy);
var oy = document.getElementById('cvp').value;
		
var sc = "oy=" + oy ; 
JXP(1, 'sonuc', 'oy_kullan.php', sc);
*/
}

function kontrol() {
	var ad=document.getElementById('ad').value; 
	var eposta=document.getElementById('eposta').value;
	var mesaj=document.getElementById('mesaj').value;
		if(ad=="" || eposta=="" || mesaj=="")
		{
			alert('Ad,Eposta,Mesaj girilmesi zorunludur!');
			return false;
		}
		else
		{
			return true;
		}
}


function alt_bolum_goster(id)
{
	div_=document.getElementById('div_' + id);
	resim = document.getElementById('img_'+id);
	if(div_.style['display']!='block')
	{
		
	   if(http.readyState!=4)
		{
			http.abort();
		}	
		
		//alert(url);
		
		http.open('POST', url, true);
		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
		http.onreadystatechange= function() {
			yazi='<img src="img/loading.gif" style="float:left;">';
			if(http.readyState==4)
			{
				yazi = http.responseText;			
				
			}
			
			div_.innerHTML=yazi;
			div_.style.display='block'; 
			resim.src='img/acilir_alt.jpg';
		};    
		http.send("sayfa=alt_bolumler&bolum_id=" + id); 
	}
	else
	{
		div_.style.display='none';
		resim.src='img/acilir.jpg';
	}
	

}

function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
        return false;
    else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
        alert("Resimlerin tüm hakları saklıdır. İçerik Kopyalanamaz, Dağıtılamaz.");
        return false;
    }
    return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
