


jQuery(document).ready(function() {
	

	//DROP DOWN MENU
	$(function() {
		$('#dropmenubutton').mouseover(function() {
			$("#dropmenu").show();
			$("#dropmenu").animate( { height:"300px" }, { queue:false, duration:500 } )
		});	
	});
	$(function() {
		$('#dropmenu').mouseleave(function() {
			$("#dropmenu").animate( { height:"1px" }, { queue:false, duration:500 } )
			$("#dropmenu").hide();
		});	
	});
	$(function() {
		$('#dropmenubutton').click(function() {
			$("#dropmenu").animate( { height:"300px" }, { queue:false, duration:500 } )
		});	
	});
	$(function() {
		$('#dropmenu').click(function() {
			$("#dropmenu").animate( { height:"0px" }, { queue:false, duration:500 } )
		});	
	});	

	//DROP SIGNUP WINDOW
	$("#dropsignupbutton").click(function(){
      $("#dropsignup").animate( { height:"320px" }, { queue:false, duration:500 } )
    });
	$("#closesignupbutton").click(function(){
      $("#dropsignup").animate( { height:"0px" }, { queue:false, duration:500 } )
    });
	$("#dropmenu").hide();
	$("#dropsignup").hide();
	

	//BOTTOM NAVIGATION CAROUSEL
	$(function() {
	    $(".navigation").jCarouselLite({
	        btnNext: ".next",
	        btnPrev: ".prev",
			visible: 6,
			start: 0,
			scroll: 1,
			speed: 800,
			beforeStart: function(a) {
				$(".itemOn").hide();
			 	$("#navwrapoff").css({visibility:"visible"});
			},
			afterEnd: function(a) {
				$("#navwrapoff").css({visibility:"hidden"});
			}
	    });
	});


	//BOTTOM NAVIGATION CAROUSEL HOVER
	$(function () {
		$('.rollover').mouseover(function() {
			/* these variables are the coordinates of the button which
			are used to calculate where the rollover must appear */
			var themenu = $(this).attr('menu'); //parses menu attribute to define which rollover to show - #menu+value
			var test = $(this).offset(); //current button offset
			var theleft = parseInt(test.left); //current button left 
			var thetop = parseInt(test.top); //current button top
			var theheight = parseInt($(this).height()); //current button height
			var thebottom = thetop + theheight; //calculates the bottom by adding the height to the top value
			var thewidth = parseInt($(this).width()); //current button width
			var themenuheight = parseInt($("#menu"+themenu).height()); //rollover height
			var themenuwidth = parseInt($("#menu"+themenu).width()); //rollover width
		
			/* since the page is centralised vertically and horizontally
			these values are used for placing the rollover in the correct position */
			var thedocwidth = parseInt($(document).width()); //document width
			var thewrapwidth = parseInt($('#wrap').width()); //page wrap width
			var thedocheight = parseInt($(document).height()); //document height
			var thewrapheight = parseInt($('#wrap').height()); //page wrap height
			var showleft = parseInt(theleft + (thewidth / 2) - (themenuwidth / 2) - ((thedocwidth - thewrapwidth) / 2));	
			var showtop = (thewrapheight / 2) - themenuheight + 314;

			/* this is a hack for internet explorer 7 */
			if ($.browser.msie && $.browser.version.substr(0,1) == 7){
				showtop = showtop - 4;
			}
			
			/* this is a hack for internet explorer 6 */

			
			$(this).unreflect();
			$(this).css({visibility:"hidden", top: "0px"});
			$("#menu" + themenu).css( { "left":+showleft+"px", "top":+showtop+"px", "z-index":50000 } );
			$("#menu" + themenu).show();				
		});	
	});
	$(function() {
		$('.itemOn').mouseleave(function() {
			var themenu = $(this).attr('menu');
			$(".rollover").css({visibility:"visible"});
			$(".rollover").reflect({height:0.6,opacity:0.4});	
			$(this).hide();
		});	
	});
	
	//$(".rollover").css({width:142, height:66, "margin-right":"5px"});
    
	$(".rollover").reflect({height:0.6,opacity:0.4});
	
	$(function() {
		$('.navbot').hover(function() {
        var currentImg = $(this).attr('src');
	       	$(this).attr('src', $(this).attr('hover'));
	        $(this).attr('hover', currentImg);
	    }, function() {
	       var currentImg = $(this).attr('src');
	       	$(this).attr('src', $(this).attr('hover'));
	        $(this).attr('hover', currentImg);
	    });
	});	
});
