$frame_left = 0;
$frame_no = 1;
$move_by = 635;

$gframe_left = 0;
$gframe_no = 1;
$gmove_by = 227;

$(document).ready(function() {

	$(".hre").bind("mouseover", function()
	{
		var id = $(this).attr("id").replace("jsa", "");
		var id2 = id-1;

		$("#jsh"+id).css("background", "#E35200");
		$("#jsh"+id2).css("background", "#E35200");
		$("#jsh"+id).css("margin", "0");
		$("#jsh"+id2).css("margin", "0");
	});

	$(".hre").bind("mouseout", function()
	{
		var id = $(this).attr("id").replace("jsa", "");
		var id2 = id-1;
		$("#jsh"+id).css("background", "url(/images/jsli.gif) 0 0 repeat-x");
		$("#jsh"+id2).css("background", "url(/images/jsli.gif) 0 0 repeat-x");
		$("#jsh"+id).css("margin", "0 25px 0 50px");
		$("#jsh"+id2).css("margin", "0 25px 0 50px");
	});

	$("a[class^=ax]").bind("mouseover", function()
	{	
		var id = $(this).attr("class").replace("ax", "");
		$("#js"+id).css("display", "");
		//$(".ax"+id).removeAttr("href");
	});

	$("a[class^=ax]").bind("mouseout", function()
	{	
		var id = $(this).attr("class").replace("ax", "");
		$("#js"+id).css("display", "none");
		//$(".ax"+id).attr("href", "#");
	});

	$(".js").bind("mouseover", function()
	{	
		var id = $(this).attr("id").replace("js", "");
		$(this).css("display", "");
		//$(".ax"+id).removeAttr("href");
	});

	$("#snizu").html($("#sverhu").html());  

	$("#maintext2").html($("#maintext1").html());
/*
	var is = 0;
	var current_is = 1;
	$(".controller .left").bind('click', function(){
		$("#is"+current_is).hide();
		$("#is"+(current_is-1)).show();
		current_is--;
		$(".controller .right").show();
		if (current_is == 1) $(".controller .left").hide();
		return false;
	});
	$(".controller .right").bind('click', function(){
		if (current_is < is)
		{
			$("#is"+current_is).hide();
			$("#is"+(current_is+1)).show();
			$(".controller .left").show();
			current_is++;
		}
		if (is == current_is) $(".controller .right").hide();
		return false;
	});
	$(".scroll-element").each(function()
	{
		is++;
		$(this).attr('id', 'is'+is);
		$(this).hide();
	});
	$("#is1").show();
	if (is == current_is) $(".controller .right").hide();
	$(".controller .left").hide();
*/
    $max_clicks = $("#scroller .scroll").children().size();
    $imgCont = $move_by * $max_clicks;
    
    $("#scroller .scroll").css("width", $imgCont);

    $("#scroller .controller .left").bind('click', function() {
    	$new_frame_no = (($frame_no/1)-1);
		$new_left = (($frame_left/1) + $move_by);
		
		if ($new_frame_no <= 0) {
			$new_left = -($move_by*$max_clicks)+$move_by;
			$new_frame_no = $max_clicks;
		}
		
		$new_left_attr = $new_left+"px";
		$("#scroller .scroll").animate({ opacity: 0.8 }, 100).animate({ left: $new_left_attr}, 600).animate({ opacity: 1 }, 100);
		$frame_left = $new_left;
		$frame_no = $new_frame_no;
		
		return false;
    });
    $("#scroller .controller .right").bind('click', function() {
    	$new_frame_no = (($frame_no/1)+1);
		$new_left = (($frame_left/1) - $move_by);
		
		if ($new_frame_no > $max_clicks) {
			$new_left = 0;
			$new_frame_no = 1;
		}		
		
		$new_left_attr = $new_left+"px";
		$("#scroller .scroll").animate({ opacity: 0.8 }, 100).animate({left: $new_left_attr}, 600).animate({ opacity: 1 }, 100);
		$frame_left = $new_left;
		$frame_no = $new_frame_no;
		
		return false;
    });
	$("a.lightbox").lightBox();
});

function hhj(handler)
{
	var id = $(handler).attr("id").replace("js", "");
	$(handler).css("display", "none");
	//$(".ax"+id).attr("href", "#");
}
