function display_loading(){
    document.getElementById('__loading_div').style.display = 'block';
}

function close_loading(){
    document.getElementById('__loading_div').style.display = 'none';
}

function display_floatingMessage(message, title){
    if(message == undefined) var message = '';
    if(title == undefined) var title = '';
    
    if(message !== false){
        document.getElementById('__message_div_message_part').innerHTML = message;
    }
        
    document.getElementById('__message_title').innerHTML = title;
    document.getElementById('__message_div').style.display = 'block';
}

function close_floatingMessage(){
    document.getElementById('__message_div').style.display = 'none';
    document.getElementById('__message_div_message_part').innerHTML = '';
}

function vitrin_tabdegistir(aktiflesen, pasiflesen){
    $('#tab_baslik_' + aktiflesen).addClass('secili');
    $('#tab_baslik_' + pasiflesen).removeClass('secili');
    
    $('#tab_icerik_' + aktiflesen).show();
    $('#tab_icerik_' + pasiflesen).hide();
    
    resimboyut_duzenle();
}//end function vitrin_tabdegistir()

function resimboyut_duzenle(selector){
    if(selector == '' || selector == undefined)
        var selector = '.urunler .resim A IMG';
    
    $(selector).each(function(){
        var _height = parseInt($(this).innerHeight());
        
        if(_height == 0){//chrome için
            $(this).load(function(){
                var _height = parseInt($(this).innerHeight());
                
                __resimBoyutlandir(this, _height);
            });
        }
        else{
            __resimBoyutlandir(this, _height);
        }
    });
}//end function resimboyut_duzenle()

function __resimBoyutlandir(Obj,_height){
    var _width = parseInt($(Obj).innerWidth());
    var _src = $(Obj).attr('src');

    if(_height > 120){
        _width = parseInt(_width*(120/_height)) + '';
        _height = '120';

        //alert(_height);
    }

    $(Obj).css({'width':_width + 'px', 'height:':_height+'px'});
    
    //var _parent = $(Obj).parent();
    
    //$(Obj).remove();
    //alert(_height);
    //_parent.append('<img title="' +_src+ '" src="' +_src+ '" style="width:' +_width+ 'px; height:' +_height+ 'px;">');
}//end function __resimBoyutlandir()

$(function(){

    /** BEGIN: Disable Zooming **/
    function __mouseWheel(e)
    {
        // disabling
        e=e?e:window.event;
        if(e.ctrlKey)
        {
            
            if(e.preventDefault) e.preventDefault();
            else e.returnValue=false;
            return false;
        }
    }
    /*
    var __body_obj=document.body;  // obj=element for example body
    // bind mousewheel event on the mouseWheel function
    if(__body_obj.addEventListener)
    {
        __body_obj.addEventListener('DOMMouseScroll',__mouseWheel,false);
        __body_obj.addEventListener("mousewheel",__mouseWheel,false);
    }
    else if(__body_obj.attachEvent){
        __body_obj.attachEvent('DOMMouseScroll',__mouseWheel,false);
        __body_obj.attachEvent("mousewheel",__mouseWheel,false);
    }
    else{
        __body_obj.onmousewheel=__mouseWheel;
        __body_obj.mousewheel=__mouseWheel;
    }
    
    __body_obj.onmousewheel=__mouseWheel;
    __body_obj.mousewheel=__mouseWheel;
    */

    $(document.body).mousewheel(__mouseWheel);
    
    $(document).bind('keypress keyup keydown', function(e){
        var charCode = (e.charCode) ? e.charCode :
               ((e.keyCode) ? e.keyCode :
               ((e.which) ? e.which : 0));

        if((charCode == 43 || charCode == 45)){
            //alert(charCode);
        }

        if((charCode == 43 || charCode == 45) && e.ctrlKey){
            return false;
        }

    });
    
    
    
    /** END: Disable Zooming **/

    
    
    $('.prefilled_input').each(function(){
        var _val = $(this).val();
        
        $(this).focus(function(){
            if($(this).val() == _val){
                $(this).val('');
                $(this).css({'color':'#f0f0f0'});
            }
        });
        
        $(this).blur(function(){
            if($(this).val() == ''){
                $(this).val(_val);
                $(this).css({'color':'#f0f0f0'});
            }
        });
    });

    var __reg_sayfa_ac = /^altSayfa_ac\([0-9]+\)/;

    $('a').each(function(){
        if(__reg_sayfa_ac.test($(this).attr('href'))){
            
            $(this).click(function(){
                $_id = trim($(this).attr('href').replace('altSayfa_ac(','').replace(')',''));

                altSayfa_ac($_id);
                return false;
            });
        }
    });
    
    //resim boyutlarını düzelt
    //resimboyut_duzenle();
    
});

