$(document).ready(function(){
      $('#langnav li').hover(function() {
        $(this).addClass('over');
      }, function() {
        $(this).removeClass('over');
      });
	  $('#mainnav ul li').hover(function() {
        $(this).addClass('over');
      }, function() {
        $(this).removeClass('over');
      });
      $('#calendar_box table tr .action').hover(function() {
        $(this).addClass('over');
      }, function() {
        $(this).removeClass('over');
      });
      $('#calendar .wrapper div').hover(function() {
        $(this).addClass('over');
      }, function() {
        $(this).removeClass('over');
      });
      
      
      var content_dropyears = $("#dropyears").html();
      $("#dropyears").remove();
      $("body").append(content_dropyears);
      $("#dropyearsul").hide();
      $('#calendar .year').hover(function() {
			var offset = $(this).offset();
			var top_marg = $(this).height() + offset.top;
			$("#dropyearsul").css("top",top_marg).css("left",offset.left).show();
			$('#dropyearsul').hover(function() {
				$("#dropyearsul").show();
			}, function() {
				$("#dropyearsul").hide();
			});

	  }, function() {
           $("#dropyearsul").hide();
      });

      var content_dropmonth = $("#dropmonth").html();
      $("#dropmonth").remove();
      $("body").append(content_dropmonth);
      $("#dropmonthul").hide();
      $('#calendar .month').hover(function() {
			var offset = $(this).offset();
			var top_marg = $(this).height() + offset.top;
			$("#dropmonthul").css("top",top_marg).css("left",offset.left).show();

			$('#dropmonthul').hover(function() {
				$("#dropmonthul").show();
			}, function() {
				$("#dropmonthul").hide();
			});

	  }, function() {
           $("#dropmonthul").hide();
      });
      
      
      

var thumbArray = $(".nav_container .scroller img");
thumbArray.parent().removeAttr("href");

thumbArray.click( function() {
	var imgLink = $(this).attr("src").replace( "small", "big" );
	$(".nav_container .scroller .selected").removeClass("selected");
	$(this).parent().addClass("selected");
	$(".img_container img").attr("src",imgLink);
});

$("#arrow_L").click( function() {
	if ( $(".nav_container .scroller a:first").hasClass("selected") ) {
		return false;
	} else {
		$(".nav_container .scroller .selected").prev().addClass("selected");
		$(".nav_container .scroller .selected:last").removeClass("selected");
		var imgLink = $(".nav_container .scroller .selected img").attr("src").replace( "small", "big" );
		$(".img_container img").attr("src",imgLink);
	}
	if ( ($(".nav_container .scroller .selected").prevAll().length)%8 == 7 ) {
	    var movement = -((($(".nav_container .scroller .selected").prevAll().length)-7)/8)*478;
	    //alert (movement);
		$(".nav_container .scroller").animate({ marginLeft: movement }, 800);
	}
});

$("#arrow_R").click( function() {
    if ( $(".nav_container .scroller a:last").hasClass("selected") ) {
		return false;
	} else {
		$(".nav_container .scroller .selected").next().addClass("selected");
		$(".nav_container .scroller .selected:first").removeClass("selected");
		var imgLink = $(".nav_container .scroller .selected img").attr("src").replace( "small", "big" );
		$(".img_container img").attr("src",imgLink);
	}
	if ( ($(".nav_container .scroller .selected").prevAll().length)%8 == 0 ) {
	    var movement = -((($(".nav_container .scroller .selected").prevAll().length)/8)*478);
    	$(".nav_container .scroller").animate({ marginLeft: movement }, 800);
	}
});



});

jQuery().ready(function(){
	jQuery('.accordion').accordion({
		header: 'h4',
		active: false,
		alwaysOpen: true,
		autoHeight: false
	});
});

jQuery().ready(function(){
	$("#logn_normal .toggle").click(function(){
		$(this).parent("div").hide();
		$("#logn_forgot").show();
	});
	$("#logn_forgot .toggle").click(function(){
		$(this).parent("div").hide();
		$("#logn_normal").show();
	});
});
