var MinDate = Date.parse("01.01.0001 00:00:00");

function EvalString(o) {
    if (o != null && typeof o == 'string') {
        return o;
    } else {
        return '-'
    }
}

function EvalDate(o, format, nullString) {
    if (format == null)
        format = "dd.MM.yyyy HH:mm";
    if (typeof o == 'string') {
        if (o.substring(o.length - 1) == "Z")
            o = o.substring(0, o.length - 1);
        o = Date.parse(o);
    }

    if (o == null)
        return (nullString != null ? nullString : EvalString(null));
    if (o._orient != null && o._is != null) {
        if (MinDate.equals(o)) return null;
        return o.toString(format);
    } else if (typeof o === 'object') {
        return o.toString();
    } else {
        return (nullString != null ? nullString : EvalString(null));
    }
}
function request(query) {
    var res = { _query: query };
    if (query != null) {
        var queries = query.toString().split("&");

        var reg = new RegExp(/(\w+)=(.+)/g);
        $.each(queries, function() {
            while ((result = reg.exec(this)) != null) {
                res[result[1]] = result[2];
            }
        });
    }
    return res;
};

function GenerateClientPager  (intActivePageIndex, intRowCount, onClickEvent, PageSize, PagerWidth, context) {

    var strHtml = "<ul>";
    var intPageCount = Math.ceil(intRowCount / PageSize);
    if (intPageCount > 1) {
        step = parseInt(PagerWidth / 2);
        intStart = intActivePageIndex - (step);
        intFinish = intActivePageIndex + (step);

        if (intActivePageIndex >= 1 && intActivePageIndex <= step + 1) {
            intStart = 1;
            intFinish = PagerWidth;
        }
        else
            if (intActivePageIndex >= (intPageCount - step) && intActivePageIndex <= intPageCount) {
            intStart = intPageCount - PagerWidth + 1;
            intFinish = intPageCount;
        }

        if (intStart < 1)
            intStart = 1;

        if (intFinish > intPageCount)
            intFinish = intPageCount;

        //if (!(intActivePageIndex >= 1 && intActivePageIndex <= step + 1)) {    
        if (intActivePageIndex > 1) {
            strHtml += "<li><a href=\"javascript:;\" onclick=\"" + onClickEvent.replace("{Index}", intActivePageIndex - 1) + "\"><img src=\"../_i/paging_back.jpg\" border=\"0\" /></a></li>";
        }

        for (i = intStart; i <= intFinish && i <= intPageCount; i++) {
            if (intActivePageIndex != i)
                strHtml += "<li class=\"pagerLink\"><a href=\"javascript:;\" onclick=\"" + onClickEvent.replace(/{Index}/g, i) + "\">" + i + "</a></li>";
            else
                strHtml += "<li class=\"pagerLink\"><a href=\"javascript:;\" class=\"active\"  onclick=\"return false;\">" + i + "</a></li>";

        }


        //if (!(intActivePageIndex >= (intPageCount - step) && intActivePageIndex <= intPageCount)) {
        if (intActivePageIndex < intPageCount) {
            strHtml += "<li><a href=\"javascript:;\" onclick=\"" + onClickEvent.replace("{Index}", intActivePageIndex + 1) + "\"><img src=\"../_i/paging_next.jpg\" border=\"0\" /></a></li>";
        }

        strHtml += "</ul>"
    }
    var pagerDiv = $(context);
    pagerDiv.empty();
    pagerDiv.html(strHtml);
    return strHtml;
}


$(document).ready(function(){

/* ============== FAQ LVL 1 =============== */
$(".faqItem .faqTitle a").click(function(){
    // soru indeksi getiriliyor
    
    var _index = $(".faqItem .faqTitle a").index(this);
        // eger ayni soruya tiklaniyorsa, false donuyoruz
        if($(".faqItem").eq(_index).hasClass("active")) {
            $(".faqItem").eq(_index).removeClass("active")
            $(".faqItem .faqContent").eq(_index).slideUp("slow");
            return false;
        }
        if($(".faqItem .faqContent").eq(_index).text() == ""){
                
            return false;
        }
        // tüm elementlerde dolasip, class temizleyip slideup yapiliyor
    
        $(".faqItem").eq(_index).addClass("active");
        $($(".faqItem .faqContent").eq(_index)).slideToggle("slow");
      // linki disable etmek icin return false
      return false;
});


$().ready(function(){
    $(".faqItemUrun .faqTitleUrun a").click(function(){
        var _index = $(".faqItemUrun .faqTitleUrun a").index(this);
        if($(".faqItemUrun").eq(_index).hasClass("active")) {
            $(".faqItemUrun").eq(_index).removeClass("active")
            $(".faqItemUrun .faqContentUrun").eq(_index).slideUp("slow");
            return false;
        }
        $(".faqItemUrun").each(function(){
            $(this).removeClass("active");
        })
        $(".faqContentUrun").each(function(){
             $(this).slideUp("slow");
        })
        $(".faqItemUrun").eq(_index).addClass("active");
        $($(".faqItemUrun .faqContentUrun").eq(_index)).slideToggle("slow");
        return false;
    })
	
	$(".wrapper .left .arsiv ul li:last-child").each(function(i) {
        if (i == $(".wrapper .left .arsiv ul li:last-child").size() - 1) {
            $(this).css("border-bottom", "none");
        }
    });
    
    $("#btnSorgula").click(function(){
		    
		    var deger = $("#ctl00_ContentPlaceHolder1_txtPoliceNo").val();
			
			if (!deger.length) {
			    $("#errorMessage").show();
			}
			
    });
    
    $("#ctl00_ContentPlaceHolder1_txtPoliceNo").change(function(){
		    
		$("#errorMessage").hide();

});

$("table tr:last-child td").css("border-bottom", "none");

})



$("#wrapper .content .leftMenu .navigation .naviCont #ctl00_LeftNavigation ul li:first child").each(function() {
        
            $(this).css("background-color", "#000000");

        });
$(".navigation ul li.selectedd_sub ul li.selected ul li:first-child").addClass("top");
$(".navigation ul li.selectedd_sub ul li.selected ul li:last-child").addClass("bottom");
});



