/*=======bannerLeft slider====================*/
var j = jQuery.noConflict();
/*=======bannerLeft slider====================*/

var intervalId, curBnr=0;

j(document).ready(function(){
	playBnr();
	
	j(".bullet li").click(
		function(){
			var index=j(".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=j('.bannerSlide li').length;
	if(curBnr==(allButnsLen-1))
		curBnr=0;
	else
		curBnr++;
	changeBnr();
}

function changeBnr(){
	j('.bullet li').removeClass('select').eq(curBnr).addClass('select');
	//if(j.browser.msie && j.browser.version <=8)
		j('.bannerSlide li').hide().eq(curBnr).show();
	//else
		j('.bannerSlide li').hide().eq(curBnr).fadeIn('slow');
		}

/*=======bannerLeft slider====================*/



/*==============================productscroller[1]===========================*/

var scrollOverflowHideChild, scrollID, overFlowWidth, curPos=0, eachBoxWidth;
j(document).ready(function(){
	//SCROLLING:
	eachBoxWidth = j('#scrollOverflowHide ul li:first').outerWidth()+0; // 17=="margin-right"
	scrollOverflowHideChild = eachBoxWidth * j('#scrollOverflowHide ul li').length;
	overFlowWidth = scrollOverflowHideChild - j('#scrollOverflowHide').width(); //alert(overFlowWidth);
	j('#scrollOverflowHide ul').css('width',scrollOverflowHideChild+'px');


	if(overFlowWidth > 0){
		
		var direction,tempCurPos;
		j('.leftscroller, .rightscroller').click(function(){
			direction = j(this).is('.leftscroller')? -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)
				j('#scrollOverflowHide ul').animate({left: curPos},600);
				tempCurPos=curPos;
		});
	}
	
	var scrollOverflowHideChild1, scrollID, overFlowWidth1, curPos1=0, eachBoxWidth1;
	
	eachBoxWidth1 = j('#scrollOverflowHide1 ul li:first').outerWidth()+0; // 17=="margin-right"
	scrollOverflowHideChild1 = eachBoxWidth1 * j('#scrollOverflowHide1 ul li').length;
	overFlowWidth1 = scrollOverflowHideChild1 - j('#scrollOverflowHide1').width(); //alert(overFlowWidth);
	j('#scrollOverflowHide1 ul').css('width',scrollOverflowHideChild1+'px');
	
	
	if(overFlowWidth1 > 0){

		var direction1,tempCurPos1;
		j('.leftscroller1, .rightscroller1').click(function(){
			direction1 = j(this).is('.leftscroller1')? -1 : +1;
			
			if(!( (curPos1==0 && direction1==1) || (curPos1 == -overFlowWidth1 && direction1 == -1) ))
				curPos1+=(eachBoxWidth1*direction1);
			
			if(0 < curPos1 || curPos1 < -overFlowWidth1)
				curPos1 = (0 < curPos1)? 0 : -overFlowWidth1+17;
			
			if(tempCurPos1!=curPos1)
				j('#scrollOverflowHide1 ul').animate({left: curPos1},600);
			tempCurPos1=curPos1;
		});
	}


	j("#tab_cell_first").fadeIn(100);
	j(".tabbingMenu li").click(
		function(){
			j(".tabbingMenu li a").removeClass('tab_current');
			var index=j(".tabbingMenu li").index(this);
			j(".tab_cell").hide();
			j(".tab_cell").eq(index).fadeIn("slow");
			
			j(this).children().addClass('tab_current');
		});
		
	j("#tab_cell_01_first").fadeIn(100);
	j(".tabbingMenu_01 li").click(
		function(){
			j(".tabbingMenu_01 li a").removeClass('currentTab');
			var index=j(".tabbingMenu_01 li").index(this);
			j(".tab_cell_01").hide();
			j(".tab_cell_01").eq(index).fadeIn("slow");
			
			j(this).children().addClass('currentTab');
		});




});

