var req;
var sx;
var dblcounter = 0;
var	msg;
var cx;
var homedirr;
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 SendQuery(is,key)
    {
	ShowDiv('loading');
	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 + "&timestamp=" + tk + "&tm="+key;

    if(req!=null)
    {
        req.onreadystatechange = Process;
        req.open("GET", varurl, true);
        req.send(null);
	}
	HideDiv('loading');
}
function PostQuery(is,key)
    {
	ShowDiv('loading');
	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 + "&timestamp=" + tk;

    if(req!=null)
    {
        req.onreadystatechange = Process;
		req.open("POST", varurl, true);		
		req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=latin5");
        req.send("tm=" + key);
	}
	HideDiv('loading');
}
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 isValidEmail(mail) {
  var field = mail;
  var str = mail;
  if(isNotNull(mail)){
  	  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
	  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
	  if (!reg1.test(str) && reg2.test(str)) {
		return true;
	  }
	  else{
		return false;
	  }	
  }
  else{
  	return false;
  }  
 } 
 function isNotNull(inVal){
	regx=/\s*/;
	inVal=inVal.replace(regx,'');	
	if(inVal.length > 0)
		return true
	else
		return false;
}
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}
function dbln4(entry){
	// entry Kopyalama
	//textRange = entry.createTextRange();
	//textRange.execCommand("RemoveFormat");
	//textRange.execCommand("Copy");
}
function hen(d,a,b)
{
  var o=document.getElementsByName(d)[0]; // denyo firefox'a workaround
  if(document.selection && !window.opera)
  {
	  var rg=document.selection.createRange();
	  if(rg.parentElement()==o) {
		  rg.text = a+rg.text+b;
		  rg.select();
		} else alert("lutfen once $eetmek istediginiz metni secin");
  }
  else if(o.textLength||window.opera)
  {
  	var s = o.value;
  	o.value = s.substring(0,o.selectionStart)+a+s.substring(o.selectionStart,o.selectionEnd)+b+s.substring(o.selectionEnd,o.textLength);
  } else o.value += a+b;
  o.focus();
  return true;
}