jQuery(document).ready(function($){			
	
	//initiate the drag functionality of the jQuery UI
	$('#draggable').draggable({ handle: '.dragBtn', containment: "#supperWrapper", scroll: false });
	//drag ends

	//initiate the toggle functionality of the contents
	$(".contentTrigger").addClass("active");
	//Switch the "Open" and "Close" state per click
	$(".contentTrigger").toggle(function(){
		$(this).removeClass("active");
		}, function () {
		$(this).addClass("active");
	});
	//Slide up and down on click
	$(".contentTrigger").click(function(){
		$(".contents").slideToggle("slow");
	});
	//toggle ends
	
	//initiate the toggle functionality of the availability checker
	$("#availability-checker").toggle('slide');
	//Switch the "Open" and "Close" state per click
	$(".availabilityTrigger").toggle(function(){
		$(this).addClass("active");
		$("#availability-checker").toggle('slide');
		}, function () {
		$(this).removeClass("active");
		$("#availability-checker").toggle('slide');
	});
	//toggle ends
	
	var rightContentsHeight;
	var bannerMargin;
	
	rightContentsHeight = $("#supperWrapper").height() - $("#header").height() - $("#footer").height() -$(".row2").height();
	$(".row1 .column2").css("height", rightContentsHeight+"px");
	
	//margin for buttom banners
	bannerMargin = ($("#supperWrapper").width() - $("#newsletter_container").width() - $(".offersBanner").width() - $("#lowest_price").width() - $("#digi").width() - 72)/3;
	$(".offersBanner").css("margin","0 "+bannerMargin+"px 0 0"+bannerMargin+"px");
	$("#lowest_price").css("margin","0 "+bannerMargin+"px 0 0");
	
	$(window).bind('resize', function(){
									  
		rightContentsHeight = $("#supperWrapper").height() - $("#header").height() - $("#footer").height() -$(".row2").height();
		$(".row1 .column2").css("height", rightContentsHeight+"px");
		
		
	bannerMargin = ($("#supperWrapper").width() - $("#newsletter_container").width() - $(".offersBanner").width() - $("#lowest_price").width() - $("#digi").width() - 72)/3;
	$(".offersBanner").css("margin","0 "+bannerMargin+"px 0 0"+bannerMargin+"px");
	$("#lowest_price").css("margin","0 "+bannerMargin+"px 0 0");
	
	});

});
