
/*======productscroller============*/

var scrollOverflowHideChild, scrollID, overFlowWidth, curPos = 0, eachBoxWidth;

$(document).ready(function () {
    //SCROLLING:
    eachBoxWidth = $('#scrollOverflowHide ul li:first').outerWidth() + 0; // 17=="margin-right"
    scrollOverflowHideChild = eachBoxWidth * $('#scrollOverflowHide ul li').length;
    overFlowWidth = scrollOverflowHideChild - $('#scrollOverflowHide').width(); //alert(overFlowWidth);
    $('#scrollOverflowHide ul').css('width', scrollOverflowHideChild + 'px');


    if (overFlowWidth > 0) {
        //HOVER SCROLL:
        /*$('.left, .right').hover(
        function(){
        if($(this).is('.left')){
        scrollID=setInterval('scrollFeature(-1)',5);}
        else
        scrollID=setInterval('scrollFeature(+1)',5);
        },
        function(){clearInterval(scrollID)}
        );*/


        //CLICK SCROLL:
        var direction, tempCurPos;
        $('.leftscroller, .rightscroller').click(function () {
            //direction set:
            //alert('test');
            direction = $(this).is('.rightscroller') ? -1 : +1;

            if (!((curPos == 0 && direction == 1) || (curPos == -overFlowWidth && direction == -1)))
                curPos += (eachBoxWidth * direction);

            if (0 < curPos || curPos < -overFlowWidth)
                curPos = (0 < curPos) ? 0 : -overFlowWidth + 17;

            if (tempCurPos != curPos)
                $('#scrollOverflowHide ul').animate({ left: curPos }, 600);
            tempCurPos = curPos;
        });
    }


});

/*======productscroller============*/


/*======================================================FOR MENU DISPLAY==========================================================*/
$(document).ready(function () {

    $(".tabbingMenu li").click(
		function () {
		    $(".tabbingMenu li").removeClass('tab_current');
		    var index = $(".tabbingMenu li").index(this);
		    $(".tab_cell").hide();
		    $(".tab_cell").eq(index).fadeIn("slow");

		    $(".tabbingMenu li").eq(index).addClass('tab_current');
		});


});


/*=======bannerLeft slider====================*/

var intervalId, curBnr = 0;

$(document).ready(function () {
    playBnr();

    $(".bullet li").click(
		function () {
		    var index = $(".bullet li").index(this);
		    if (curBnr != index) {
		        curBnr = index;
		        pauseBnr();
		        changeBnr();
		        playBnr();
		    }
		}
	);

});

function pauseBnr() { clearInterval(intervalId) }
function playBnr() { intervalId = setInterval('startBnrPlay()', 5000) }

function startBnrPlay() {
    var allButnsLen = $('.slideBullet li').length;
    if (curBnr == (allButnsLen - 1))
        curBnr = 0;
    else
        curBnr++;
    changeBnr();
}

function changeBnr() {
    $('.bullet li').removeClass('select').eq(curBnr).addClass('select');
    //if($.browser.msie && $.browser.version <=8)
    $('.bannerSlide li').hide().eq(curBnr).show();
    //else
    $('.bannerSlide li').hide().eq(curBnr).fadeIn('slow');
}

/*=======bannerLeft slider====================*/


/*======================================================FOR MENU DISPLAY==========================================================*/
$(document).ready(function () {


    $("#adminnavibar ul li").hover(
						  function () { $(this).find('ul').stop(true, true).slideDown(); },
						  function () { $(this).find('ul').slideUp(); }
						  );


});

