﻿
jQuery(Document_Loaded);

function writeCookie(name, value, days) {
    //Fix Days 
    if (days == null || days == "") days = 365;

    // Set Date 
    var d = new Date();
    d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = "; expires=" + d.toGMTString();

    // Write Cookie 
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var c = document.cookie;
    if (c.indexOf(name) != -1) {
        pos1 = c.indexOf("=", c.indexOf(name)) + 1;
        pos2 = c.indexOf(";", pos1);
        // If last cookie 
        if (pos2 == -1) pos2 = c.length; ;

        data = c.substring(pos1, pos2);

        return data;
    }
}  
function Document_Loaded() {
    var menuId = "#saturday";
    jQuery(menuId).find('li:has(ul)').hover(
        function () {

            jQuery(this).find('ul:eq(0)').css('visibility', 'visible');
            jQuery(menuId).find('li:eq(2)>a').attr('class', 'current');
        }
        , function () {

            jQuery(this).find('ul').css('visibility', 'hidden');
            jQuery(menuId).find('li:eq(2)>a').attr('class', '');
        }
    );

    if(readCookie("anket") == null || readCookie("anket") == "")
        writeCookie("anket", 1);

    $("#mrk_govde_ic img[align=left]").css({float:"left"});
    $("#mrk_govde_ic img[align=right]").css({ float: "right" });

    $("#mrk_govde_ic img[vspace]").each(function(i)
    {
        $(this).css({ paddingTop: $(this).attr("vspace") + "px", paddingBottom: $(this).attr("vspace") + "px" });
    });
    
    

    $("#mrk_govde_ic img[hspace]").each(function(i)
    {
        $(this).css({ paddingRight: $(this).attr("hspace") + "px", paddingLeft: $(this).attr("hspace") + "px" });
    });

    

    } //Loaded

    function runpopup(filename, h, w) {
        popup = window.open(filename, null, "height=" + h + ",width=" + w + ",scrollbars=1")
        popup.focus();
        if (popup.document.close()) {
            popup.document.close()
        }
    }


    haber_getir = function () {

        var items = document.getElementById("manset_hesap").getElementsByTagName("li");
        var newwidth = 99 / items.length;
        for (var i = 0; i < items.length; i++) {
            items[i].style.width = (newwidth) + "%";
        }
        mansetGoster(1);

    }

    var aktifManset = 1;

    function mansetGoster(m) {
        document.getElementById('res_' + aktifManset).style.display = 'none';
        document.getElementById('res_' + m).style.display = 'inline';
        document.getElementById('manset_baslik3').innerHTML = document.getElementById('man_' + m).innerHTML;
        aktifManset = m;
    }


    function meteorYukle(k) {
        if (k == 'undefined')
            alert("Lütfen bir şehir seçiniz...");
        else {
            img = document.getElementById('meteorSrc');
            //img.style.display='none';
            img.src = 'http://www.dmi.gov.tr/sunum/imgtahmingor-b1-g.aspx?merkez=' + k + '&gun=T&renkC=111&renkT=000&renkZ=fff';
        }
    }

    function showWeather() {
        document.getElementById('meteorSrc').style.display = '';
    }

    function phoeNormalWindow(u) {
        window.open(u, "mywindow", "menubar=0,resizable=1,width=750,height=550,toolbar=0,scrollbars=1");
    }
    function anketpop(islem) {
        var sikId = $("#anketSiklar input:checked").val();

        if (islem != 0) {

            
                      
                runpopup('/Anket.aspx?id=' + sikId, 460, 400);
                
           
        }
        else
            runpopup('/Anket.aspx', 460, 400);
    }

    

    
