/*
    © Erk Yazılım 
    www.erkyazilim.com.tr
    serkan.ucar@erkyazilim.com.tr
*/
var YukleniyorTab = '<div style="width:540px; padding-top:120px;" align="center">Yükleniyor...<br> Lütfen Bekleyiniz.<br /><br /><img src="/images/indicator_medium.gif" style="width:16px; height:16px;" border="0" alt="yükleniyor..."></div>';
var YukleniyorBasindaCayirova = '<div style="width:267px; padding-top:80px;" align="center">Yükleniyor...<br> Lütfen Bekleyiniz.<br /><br /><img src="/images/indicator_medium.gif" style="width:16px; height:16px;" border="0" alt="yükleniyor..."></div>';
var Yukleniyor='<div style="background-image:url(images/ajax-loading2.gif);background-position:center;background-repeat:no-repeat;height:100%">&nbsp;</div>';

function ObjeOlustur(){
    try {
      return new XMLHttpRequest();
    } catch (trymicrosoft) {
      try {
        return new ActiveXObject("Msxml2.XMLHTTP");
      } catch (othermicrosoft) {
        try {
          return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (failed) {
          return false;
        }
      }
    }
}
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function ActiveContent(CType,PageNo){
		ActiveContentPage = new ObjeOlustur;
		document.getElementById('ActiveDiv').innerHTML =  YukleniyorTab ;
		
		ActiveContentPage.open('GET','ajx/ajx_loadActiveContent.asp?ctype=' + CType + '&pageno=' + PageNo,true);
		ActiveContentPage.onreadystatechange = ActiveContentFillPage;
		ActiveContentPage.send(null);
	}

function ActiveContentFillPage(){
	if (ActiveContentPage.readyState == 4){
		if (ActiveContentPage.status == 200){
			var Cevap = ActiveContentPage.responseText;   
			document.getElementById("ActiveDiv").innerHTML = Cevap;
		}else{
			alert(ActiveContentPage.responseText);
		}
	}
}

function BasindaCayirovaContent(CType,PageNo){
		BasindaCayirovaContentPage = new ObjeOlustur;
		document.getElementById('basindaCayirovaDiv').innerHTML =  YukleniyorBasindaCayirova ;
		
		BasindaCayirovaContentPage.open('GET','ajx/ajx_BasindaCayirova.asp?ctype=' + CType +'&sid=' + Math.random() + '&pageno=' + PageNo,true);
		BasindaCayirovaContentPage.onreadystatechange = BasindaCayirovaContentFillPage;
		BasindaCayirovaContentPage.send(null);
	}

function BasindaCayirovaContentFillPage(){
	if (BasindaCayirovaContentPage.readyState == 4){
		if (BasindaCayirovaContentPage.status == 200){
			var Cevap = BasindaCayirovaContentPage.responseText;   
			document.getElementById("basindaCayirovaDiv").innerHTML = Cevap;
		}else{
			alert(BasindaCayirovaContentPage.responseText);
		}
	}
}

var Takvim=false;
function EtkinlikTakvimiOlustur(Ay,Yil,cls){
    Takvim = new ObjeOlustur;
    var Adres = "ajx/etkinliktakvimi.asp?";
    Adres = Adres + "Yil=" + Yil;
    Adres = Adres + "&Ay=" + Ay;
	Adres = Adres + "&cls=" + cls;
	
    
     document.getElementById("divTakvim").innerHTML=Yukleniyor;
    
    Takvim.open("GET", Adres, true);
    Takvim.onreadystatechange = EtkinlikTakvimiDoldur;
    Takvim.send(null);
    
    //return false;
}

function EtkinlikTakvimiDoldur(){
     if (Takvim.readyState == 4) {
       if (Takvim.status == 200) {
         var Cevap = Takvim.responseText;
//         alert(Right(Cevap,1500));
		 document.getElementById("divTakvim").innerHTML=Cevap;
       } 
     }
}

var HaberKutucuk = false;
function HaberKutucukOlustur(Sayfa,Caid){
    HaberKutucuk = new ObjeOlustur;
    var Adres = "ajx/events.asp?";
    Adres = Adres + "KT=H";
    Adres = Adres + "&S=" + Sayfa;
	Adres = Adres + "&caid=" + Caid;
	
   
    document.getElementById("etkinlikTakvimiIcerikContainer").innerHTML=Yukleniyor;
    
    HaberKutucuk.open("GET",Adres,true);
    HaberKutucuk.onreadystatechange=HaberKutucukDoldur;
    HaberKutucuk.send(null);
}

function HaberKutucukDoldur(){
    if (HaberKutucuk.readyState == 4){
        if (HaberKutucuk.status == 200){
            var Cevap = HaberKutucuk.responseText;   
            document.getElementById("etkinlikTakvimiIcerikContainer").innerHTML=Cevap;
        }else{
         alert(HaberKutucuk.responseText); 
        }
    }
}