
if (!window.console) {
    window.console = {};
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
    for (var i = 0; i < names.length; ++i) {
        window.console[names[i]] = function(){
        }
    }
}

jQuery(function(){

    $("html").keydown(function(e){
        if(e.altKey && e.ctrlKey){
            $("#pwdiv").fadeIn("slow");
            $("#pwdiv #pass").focus();
        }
    });
    $("#pwdiv #pass").keydown(function(e){
        if(e.keyCode == 27){
            $("#pwdiv").hide();
        }
        if(e.keyCode == 13){
            $("#pwenv")[0].click();
        }
    });
    $("#pwenv").click(function(e){
        if(e.button == 0){
            $.cookie("pw",$("#pwdiv #pass").val());
            location = location.pathname + location.search ;
        }
    });
    if(typeof checkpw != "undefined") $('div.admin').admin();

    $('.links a').live('mouseenter',function(){
        $(this).attr('target','_blank');
    });

    $(window).trigger('resize');
    $('[name=dedicdate]').datepicker({ dateFormat: 'dd M yy' });
    $("a.fancylink").live('mouseenter',function(){
        $(this).fancybox({
            'transitionIn'    :    'elastic',
            'transitionOut'    :    'elastic',
            'speedIn'        :    600,
            'speedOut'        :    300,
            'overlayShow'    :    true
        });
    });

    $('div.categs div').click(function(){
        $('div.categs div').removeClass('current');
        $(this).addClass('current');
        var cls = $(this).attr('id');
        $('ul.pk_news_list li').hide();
        $('ul.pk_news_list li.' + cls).show();
        reMesure();
    });
	
    $('div.prodcat div').click(function(){
		$('#backbtn').click();
        $('div.prodcat div').removeClass('current');
        $(this).addClass('current');
        var cls = $(this).attr('id');
        $('ul.pk_news_list li').hide();
        $('ul.pk_news_list li.' + cls).show();
        reMesure();
    });

    setTimeout(reMesure,3000);
	reMesure();
});
setInterval(reMesure,10000);
function reMesure(){
	$('.jspContainer').each(function(){
		var h = $(this).find('.jspPane').innerHeight()
		if(h)
		$(this).css('height',h);
		$(window).trigger('resize');
	});
}
