$(document).ready(function() {
// test
// alert('hi');

// URL FAQ active menu
    $('.sub').hide();
    function getUrlVars(){
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for(var i = 0; i < hashes.length; i++){
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }

    var page = getUrlVars()["page"];
    if (page > "FAQ"){
        var linkhref = $('#menu-faq a[href="Faq.aspx?page=' + page + '"]');
        linkhref.parents('.sub').show();
    }

    // FAQ menu
    // cursor
    $('#menu-faq .category').mouseover(function() {
        $(this).css('cursor', 'pointer');
    });

    $('#menu-faq .category').click(function(){
        var submenu = $(this).parent().children('.sub');
        if( submenu.is(":visible") ) {
            $(this).children('img').attr("src", '/images/faq_submenu_open.png');
        }
        else {
            $(this).children('img').attr("src", '/images/faq_submenu_close.png');
        }
        $(submenu).slideToggle('fast');
    });

    /*FAQ SUBMIT BUTTON*/
    if ($('#logedin-module').val() != 0) {
        $('#menu-faq .submit').hide();
    }
// URL FAQ active menu end



//BuyBID
    //table colorize
    $('.buybid input:radio:checked').parents(':eq(1)').addClass('selectedRow');

    // repleace image & selected baground change
    $('.buybid input:radio').click(function() {
        $('.buybid tr').removeClass('selectedRow');
        $(this).parents(':eq(1)').addClass('selectedRow');

    });


// menu top
    $("#menu-top li:last a").css("border-right", "0px");

// menu footh
    $("#menu-footh li:last").css("border-right", "0px");

// color bar
    var activemenu = $("#menu-top-category .active").attr("id");
    $("#active-category-color-bar").addClass(activemenu);

// selectbox
    $('#menu-top-product').selectmenu({selectmenu_id:'select-menu', width:'200px'});

// custom cursors
    $('#select-menu-main').mouseover(function () {
    	$(this).css('cursor', 'pointer');
    });
    $('.submit-login-top').mouseover(function () {
    	$(this).css('cursor', 'pointer');
    });

    $('.small-bid-button').mouseover(function () {
    	$(this).css('cursor', 'pointer');
    });

    $('.full-bid-button').mouseover(function () {
    	$(this).css('cursor', 'pointer');
    });

    $('.submit-small-empty').mouseover(function () {
    	$(this).css('cursor', 'pointer');
    });

// news module
    $("#news-module .news:last").css("border-bottom", "0px");

//popup dynamic
    $(".info-popup-dynamic img").hover(function() {
        $(this).next(".popup").stop(true, true).animate({opacity: "show", bottom: "+20"}, "fast");
    }, function() {
        $(this).next(".popup").animate({opacity: "hide", bottom: "+30"}, "fast");
    });

// small auction box border right and margin right disable
    var smallBoxUniActual = $(".actual-auctions .small-auction-box-uni");
    var smallBoxUniNext = $(".next-auctions .small-auction-box-uni");

    $(smallBoxUniActual).css({"border-right" : "0px", "margin-right" : "0px"});
    $(smallBoxUniNext).css({"border-right" : "0px", "margin-right" : "0px"});

//  Uni HomePage
    var smallBoxUni = $(".small-auction-box-uni");
    var i = 0;
    smallBoxUni.each(function(index) {
        // array hack index+1
        i=index+1;
        if (i % 3 == 0) {
            $(this).css({"border-right" : "0px", "margin-right" : "0px"});
	    }
    });


// CountDown, Profair home page
    var smallBoxNext = $(".next-auctions .small-auction-box");
    var i = 0;
    smallBoxNext.each(function(index) {
        // array hack index+1
        i=index+1;
        if (i % 3 == 0) {
            $(this).css({"border-right" : "0px", "margin-right" : "0px"});
	    }
    });


/********************************************* TAB MENU ************************************************/

// Tab menu
    //When page loads...

    $(".tab_content").hide(); //Hide all content

    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    //$(".tab_content:first").show(); //Show first tab content
    $(".tab1").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function() {

        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content

        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active ID content
        return false;
    });



});


