$(document).ready(function(){
    $('#header .top .left').flash({
        swf: basePATH + 'assets/swf/logo.swf',
        width: 150,
        height: 149,
        params: {
	    quality: 'high',
	    menu: 'false',
	    FlashVars: 'menuPATH='+basePATH+selectLANG+'/'
        }
    });
    /*
    $('#header .bottom .left').flash({
        swf: basePATH + 'assets/swf/menu_'+selectLANG+'.swf',
        width: 714,
        height: 33,
        params: {
	    quality: 'high',
	    menu: 'false',
	    FlashVars: 'menuPATH='+basePATH+selectLANG+'/'
        }
    });
    */
    $('a.open, #header .bottom .right .select').click(function(){
	if ($('ul.lang_menu').css('display') == 'none')
	{
	    $('#header .bottom .right a.open').addClass('hover');
	    $('ul.lang_menu').fadeIn('fast');
	}
	else
	{
	    $('#header .bottom .right a.open').removeClass('hover');
	    $('ul.lang_menu').fadeOut('fast');
	}
	return false;
    });
    $(document).click(function(){
	$('#header .bottom .right a.open').removeClass('hover');
	$('ul.lang_menu').fadeOut('fast');
    });
    $('#categories ul li a').click(function(){
        var thisUrl = $(this).attr('href');
        var thisParent = $(this).parent();
        var thisChildren = $(this).parent().children('ul').html();
        if (thisChildren == null)
        {
            parent.location.href = thisUrl;
            return true;
        }
        else
        {
            if ($(thisParent).children('ul').css('display') == 'none')
            {
                $(thisParent).children('ul').animate({ opacity: 0.1 }, 1).fadeIn('fast').animate({ opacity: 1 }, 100);
            }
            else
            {
                $(thisParent).children('ul').fadeOut('fast');
            }
            return false;
        }
    });
    $("a[rel='group']").colorbox();
    $.timer(3000,function() {
	$.ajax({
	    type:'POST',
	    url:basePATH+'control.ajax.php',
	    success: function (msg) {
		if (msg == 'Offline') {
		    $('.online').hide('fast');
		    $('.offline').show('fast');
		}else{
		    $('.offline').hide('fast');
		    $('.online').show('fast');
		}
	    }
	});
    });
    $('a.online, a.offline').click(function(){
	window.open(basePATH+'msn.html', 'popup', 'width=400, height=400, scrollbars=no, toolbar=no');
	return false;
    });
    $('#top_search_input').focus(function() {
        if (this.value == this.defaultValue){ 
            this.value = '';
            $(this).css('color', '#515151').css('fontStyle', 'normal');
	}
	if (this.value != this.defaultValue){
            this.select();
	}
    });
    $('#top_search_input').blur(function() {
        if ($.trim(this.value) == ''){
            this.value = (this.defaultValue ? this.defaultValue : '');
            $(this).css('color', '#9f9f9f').css('fontStyle', 'italic');
        }else{
            $(this).css('color', '#515151');
        }
    });
    var default_top_search_input = $('#top_search_input').val();
    $('#top_search').submit(function(){
	if (default_top_search_input != $('#top_search_input').val() && $('#top_search_input').val() != '')
	{
	    document.location.href = basePATH+selectLANG+'/search/' + $('#top_search_input').val();
	}
	return false;
    });
    $('.ecataglogue .left li a, .products .left li a').corner('5px');
});

    var message="THIS FEATURE IS NOT AVAILABLE!";

    ///////////////////////////////////
    function clickIE4(){
    if (event.button==2){
    alert(message);
    return false;
    }}

    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    alert(message);
    return false;
    }}}

    if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4;
    }
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE4;
    }

    document.oncontextmenu=new Function("alert(message);return false")
