time = 6000;
speed = 1000;
var newimage = 0;
var totalimages = 0;

switchmov = 0;
currentnav = 0;
max_width = 0;
current = 0;
moveamount = "";
moveamountto = ""; 

main = "";

function check_current_pos(){

if(currentnav == totalimages-1){

	jQuery('#products_nav a.right').hide();

}else{

	jQuery('#products_nav a.right').show();

}

if(currentnav == 0){

jQuery('#products_nav a.left').hide();

}else{

jQuery('#products_nav a.left').show();

}



}

function moveto(inum){
	inum--;
	currentnav = inum;
	next = moveamount*inum;
	current = next;
	jQuery('#'+main).animate({scrollLeft:current}, speed);
	jQuery('#products_central a').removeClass('active');
	jQuery('#products_central a').eq(inum).addClass('active');
check_current_pos();

}

function moveleft(){

	if(current == max_width-moveamount){
	
	
	
	}else{
	
		currentnav++; 
		next = moveamount+current;
		current = next;
		jQuery('#'+main).animate({scrollLeft:current}, speed);
		jQuery('#products_central a').removeClass('active');
		jQuery('#products_central a').eq(currentnav).addClass('active');
	
	}

check_current_pos();

}








function moveright(){

if(current > 0){
currentnav--;
next = current-moveamount;
current = next;
jQuery('#'+main).animate({scrollLeft: current}, speed);
	jQuery('#products_central a').removeClass('active');
	jQuery('#products_central a').eq(currentnav).addClass('active');
}
}

function closes(){

jQuery('#lbOverlay2').hide();
jQuery('#teacher').hide();

}

function jumpboxs(){

var leftt = (screen.width/2)-(368/2);

jQuery('#lbOverlay2').css('height',jQuery(document).height());
jQuery('#lbOverlay2').css('width',jQuery(document).width());
jQuery('#lbOverlay2').show();

jQuery('#teacher').css('left',leftt);
jQuery('#teacher').show();
}



jQuery(document).ready(function(){





jQuery.smoothAnchors('slow', "swing", false);




operating = $.client.os;
browsers = $.client.browser;
if(operating == "Mac"){

	if(browsers == "Safari"){

		jQuery('.block').attr('style','position:absolute; bottom:3px; left:0px; width:950px;  height:15px;');

	}else{

		jQuery('.block').attr('style','position:absolute; bottom:2px; left:0px; width:950px;  height:15px;');
	
	}

}

size = jQuery('ul#mycarousel li').size();
totalimages = size; 
liwidth = jQuery('ul#mycarousel li').width();
moveamount = liwidth;
check_current_pos();

fullwidth = liwidth * size;
max_width = fullwidth;
parentid = jQuery('ul#mycarousel').parent().attr('id');
main = parentid; 
jQuery('#'+main).animate({scrollLeft: 0}, speed);

jQuery('ul#mycarousel').css('position','absolute');
jQuery('ul#mycarousel').css('width',fullwidth+'px');
jQuery('ul#mycarousel li').css('float','left').css('margin','0px').css('padding','0px').css('width',liwidth).css('list-style','none').css('z-index','100');
jQuery('ul#mycarousel li').removeClass('hiddenimg');
jQuery('#'+parentid).css('overflow','hidden');

jQuery('#products_nav a.right').click(function(){
moveleft();





});

jQuery('#products_nav a.left').click(function(){
moveright();


});


jQuery('#tabs_left').click(function(){


	jQuery('#tabs_right').removeClass('selected');
	jQuery(this).addClass('selected');
	jQuery('#news_tab').hide();
	jQuery('#events_tab').show();

})


jQuery('#tabs_right').click(function(){


	jQuery('#tabs_left').removeClass('selected');
	jQuery(this).addClass('selected');
	jQuery('#news_tab').show();
	jQuery('#events_tab').hide();

})

jQuery('#products_central a').click(function(){


hpl = jQuery(this).html();

moveto(hpl);


});

//autoscroll();
	jQuery('#slideshow ul#mycarousel').cycle({
      fx: 'scrollLeft',
      speed: 1500,
      timeout: 5000
    });


	jQuery('#slideshow').cycle({
		fx:			'scrollLeft',
		speed:		1500,
		timeout:	5000,
		slideExpr:	'.slide'
    });



jQuery('#closes').click(function(){

closes();
return false;

});


jQuery('#jumpbox').mousedown(function(){

jumpboxs();
return false;

});
})

