
function setCookie( name, value, expires, path, domain, secure )
{
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime(today.getTime() );

    /*
    if the expires variable is set, make the correct
    expires time, the current script below will set
    it for x number of days, to make it for hours,
    delete * 24, for minutes, delete * 60 * 24
    */
    if ( expires )
    {
    expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
    }

    function getCookie(check_name) {
        // first we'll split this cookie up into name/value pairs
        // note: document.cookie only returns name=value, not the other components
        var a_all_cookies = document.cookie.split(';');
        var a_temp_cookie = '';
        var cookie_name = '';
        var cookie_value = '';
        var b_cookie_found = false; // set boolean t/f default f

        for (i = 0; i < a_all_cookies.length; i++) {
            // now we'll split apart each name=value pair
            a_temp_cookie = a_all_cookies[i].split('=');


            // and trim left/right whitespace while we're at it
            cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

            // if the extracted name matches passed check_name
            if (cookie_name == check_name) {
                b_cookie_found = true;
                // we need to handle case where cookie has no value but exists (no = sign, that is):
                if (a_temp_cookie.length > 1) {
                    cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
                }
                // note that in cases where cookie is initialized but no value, null is returned
                return cookie_value;
                break;
            }
            a_temp_cookie = null;
            cookie_name = '';
        }
        if (!b_cookie_found) {
            return null;
        }
    }

$(document).ready(function () {
    _sound();
    menuHover();
   
   
});


function _pageInitSound() {
    var _bln = getCookie("_sound");
       if (_bln == "null") {
           setCookie('_sound', 'on', '', '/', '', '');
    }
}

function _onLoad() {
    document.getElementById('morkravatflash').focus();
   
   try{
    var _bln = getCookie('mailshare');
    if (_bln == "1") {
        setCookie('mailshare', '0', '', '/', '', '');
        op();
    }
    }catch (err) {}
}

function _sound() {
    var _bln = getCookie("_sound");
    //alert(_bln);
    if (_bln == "on") {
        document.getElementById('subsound').innerHTML = "<img src='/content/img/icons/soundon.png' width='25' height='25' alt='Ses Aç' />";
       
    }
    else {
        
        document.getElementById('subsound').innerHTML = "<img src='/content/img/icons/soundoff.png' width='25' height='25' alt='Ses Kapat' />";       
    }
    thisMovie(_bln);
}
function _onoffsound() {
    var _bln = getCookie("_sound");
    if (_bln == "off") {
        setCookie('_sound', 'on', '', '/', '', '');
    }
    else {
        setCookie('_sound', 'off', '', '/', '', '');
    }
    _sound();
}
var flag = "0";

function _display(name, _display_value) {

    if (_display_value == "1")
        document.getElementById(name).style.display = 'block';
    else if (_display_value == "0" && flag == "0")
        document.getElementById(name).style.display = 'none';

    else if (_display_value == "2") {
        document.getElementById(name).style.display = 'block';

        if (flag == "0")
            flag = "1";
        else flag = "0";
    }

}

function thisMovie(_onoff) {
    try {
        return window["morkravatflash"].sendToActionScript(_onoff);
    }
    catch (err) {
        try {
            return document["morkravatflash"].sendToActionScript(_onoff);
        }
        catch (err) {
            return window["morkravatflash"].sendToActionScript(_onoff);
        }
    }
}


////////////modal popup
function _close() {
        $('#mailsender').hide();
        $('#mask').hide();
}

function op() {

    var maskHeight = $(document).height();
    var maskWidth = $(window).width();


 	$('#mask').fadeTo('fast', 0.6);
    
	$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
            
    var winH = $(window).height();
    var winW = $(window).width();

    $('#mailsender').css('top', winH / 2 - $('#mailsender').height() / 2);
    $('#mailsender').css('left', winW / 2 - $('#mailsender').width() / 2);
    document.getElementById('mailsender').display = 'block';

    $('#mailsender').fadeIn(600);
}

function sentMail(form1) {
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("lbl_info").innerHTML = xmlhttp.responseText;
            clearForm(form1);

        }
    }
    xmlhttp.open("GET", "/content/mailSender.aspx?sendername=" + form1.txt_name.value + "&recipientname=" + form1.txt_to_name.value + "&mail=" + form1.txt_email.value + "&url=" + document.URL + "&mesaj=" + form1.txt_mesaj.value + "", true);
    xmlhttp.send();
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        document.getElementById("lbl_info").innerHTML = xmlhttp.responseText;
        clearForm(form1);
    }
}
function clearForm(form1) {
    form1.btn_sent_mail.disabled = false;
    form1.btn_sent_mail.value = "Gönder";
    form1.txt_name.value = "";
    form1.txt_to_name.value = ""
    form1.txt_email.value = "";
    form1.txt_mesaj.value = "";
}







