var req;
var yorum;
var sx;
var cx;
function Initialize()
{
ShowDiv("loading");
    try
    {req=new ActiveXObject("Msxml2.XMLHTTP");}
    catch(e)
    {
        try
        {req=new ActiveXObject("Microsoft.XMLHTTP");}
        catch(oc)
        {req=null;}
    }

    if(!req&&typeof XMLHttpRequest!="undefined")
    {
        req= new
    XMLHttpRequest();

}
	homedirr =''

} 
function BodyLoad()
{
	ShowDiv("loading");
	SorguGonder('islogin','login');
	HideDiv("loading");
}
function SorguGonder(is,key)
    {
	ShowDiv("loading");
	iss = is
	keyy = key
	td = new Date()
	month = td.getMonth() + 1
	day = td.getDate()
	year = td.getFullYear()
	s = ""
	h=td.getHours()
	m=td.getMinutes()
	as=td.getSeconds()
	tk= month + s + day + s + year + s + h + s + m + s + as
   
	Initialize(); varurl= homedirr + "/ajax.asp?islem=" + is + "&t=" + tk + "&tm="+key;

    if(req!=null)
    {
        req.onreadystatechange = Process;
        req.open("GET", varurl, true);
        req.send(null);
	}
}
function Process(){
		if (req.readyState == 4) { 
      if (req.status == 200) { 
			eval(req.responseText);		
		      } else {
			alert("Hata: " + req.statusText);
      }
    }
}
function ShowDiv(divid)
{
   if (document.layers) document.layers[divid].style.display="inline";
   else document.getElementById(divid).style.display="inline";
}
function HideDiv(divid)
{
   if (document.layers) document.layers[divid].style.display="none";
   else document.getElementById(divid).style.display="none";
}

function DivUpdate(divid,val)
{
   if (document.layers) document.layers[divid].innerHTML=val;
   else document.getElementById(divid).innerHTML=val;
}
function BodyLoad()
{
	ShowDiv("loading");
	SorguGonder('islogin','login');
	HideDiv("loading");
}
function uyeForm(formName){
	ShowDiv("loading");
	formName.kadi.style.background = 'd1d1d1';
	formName.kadi.style.color = '000';
	formName.sifre.style.background = 'd1d1d1';
	formName.sifre.style.color = '000';
	document.getElementById('frmAlerts').innerHTML = '&nbsp;';

	if(formName.kadi.value == '' || formName.kadi.value.length < 2){
	formName.kadi.style.color = 'FFF';
	formName.kadi.style.background = 'D00000';
	formName.kadi.focus();
	document.getElementById('frmAlerts').innerHTML ='K. Adı Kısa!';
	HideDiv("loading");
	return false;
	}
	if(formName.sifre.value == '' || formName.sifre.value.length < 2){
		formName.sifre.style.color = 'FFF';
		formName.sifre.style.background = 'D00000';
		formName.sifre.focus();
		document.getElementById('frmAlerts').innerHTML ='Şifre Kısa!';
		HideDiv("loading");
		return false;
	}
	SorguGonder('login',formName.kadi.value + "|-|" + formName.sifre.value);
	HideDiv("loading");

}

function yorumPost(formName){
	ShowDiv("loading");
	document.getElementById('frmAlerts2').innerHTML = '';
	
	if(formName.yorum.value == '' || formName.yorum.value.length < 10){
	formName.yorum.focus();
	document.getElementById('frmAlerts2').innerHTML ='Yorumunuz çok kısadır!';
	HideDiv("loading");
	return false;
	}
	SorguGonder('yorumpost',yorumtip + "|-|" +  escape(formName.yorum.value) + "|-|" + yorumid + "|-|" + escape(formName.puan.options[formName.puan.selectedIndex].text));
	HideDiv("loading");
}

function oyPost(formName,formType){
	ShowDiv("loading");
	SorguGonder('oypost', yorumid + "|-|" + escape(formName.oy.options[formName.oy.selectedIndex].text) + "|-|" + escape(formType));
	HideDiv("loading");
}

function anketForm(s,c){
	ShowDiv("loading");
	if( c == "" )
	{
	HideDiv("loading");
	return false;
	}
	SorguGonder('anketCevapGonder',s + "|-|" + c);
	HideDiv("loading");

}
function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

function SelectTemizle() {
    for (var i = 0; i < arguments.length; i++) {
        var element = arguments[i];

        if (typeof element == 'string')
            element = document.getElementsByName(element)[0];

        if (element && element.options) {
            element.options.length = 0;
            element.selectedIndex = -1;
        }
    }
}