/* Written by Jacob White 2010 - let me know if you have any questions/problems please. */

/* Set these as your box and link id's in the shop record */
/* the link that launches the video container  */
	var poplink = "#popdetails";
/* the styled video container */ 
	var popbox = "#popbox";

	
	
var popped = false;
var closebtn = '<a href="#" id="closebtn" class="close"><span>x</span> close</a>';
var closecover = '<a href="#" id="closecover" class="close">close</a>';




$(document).ready(function(){
	$(popbox).append(closebtn);
	$("body").append(closecover);
		
	function resizr(win) {
		if($(window).height() > $("body").height()){
			$(win).height($(window).height());
		} else {
			$(win).height($("body").height());
		};
		if($(window).width() > $("body").width()){
			$(win).width($(window).width());
		} else {
			$(win).width($("body").width());
		};
	};
	
	   
    $(poplink).click(function(){
		$(popbox).fadeIn();
		$("#closecover").fadeIn();
		popped = true;
		return false;
	});
			
	$(".close").click(function(){
		$(popbox).fadeOut();
		$("#closecover").fadeOut();	
		popped = false;
		return false;
	});		
		
	resizr("#closecover");

	$(window).resize(function(){
		if (popped) {
			resizr("#closecover", popbox);
		}
	});
	
});
