function popupVideoPlayer(page,width,height){
	var features = 'width=' + width + ',height=' + height + ',scrollbars=0,resizable=0';
	//alert(features);
	
	window.open(page,"videoplayer",features);
	return false;
}

/*Cannabis only*/
function CentreCannabisFlash(){
	//Vertically centre Flash
	var browserHeight = window.innerHeight;
	
	if( browserHeight > 680 ){
		//Calculate the space the blank regions have
		var flashHeight = $("body.cannabis div#flashOuter #flashInner").attr("height");
		var navBars = 110;
		var marginSpace = browserHeight - navBars - flashHeight;
		
		moveCentre = marginSpace / 2;
		$("body.cannabis div#flashOuter").attr("style", "margin:" + moveCentre + "px 0px " + moveCentre + "px 0px;");
	}
	else{
		$("body.cannabis div#flashOuter").removeAttr("style");
	}
}

//Add background for Flash
$(function(){
	//Add background for Flash in HTML
	$("body.cannabis div#flashOuter").addClass("flashBackground");
	
	//Centre the Flash vertically on load
	CentreCannabisFlash();
	
	//When the window is resized
	$(window).resize(function(){
		CentreCannabisFlash();
	});
});



/***************/
//Cocaine sizing only
/***************/
function checkObject(){
	var oCheck = $("body.cocaine div#flashInner"); // if flashInner is a div, we want to leave it alone, because there's no Flash in it.
	//alert(oCheck.length);
	
	if(oCheck.length == 0){ // flashInner is not a div, it's either an embed or an object, so do the tweaks.
		calcSize();
		$("body.cocaine div#contentContainer").removeClass("wrapper");
	}
}

function calcSize(){
	// jQuery resizing script by Clive for Profero
	var minW = 1000;
	var minH = 523;
	
	var wW = $(window).width();
	var wH = $(window).height();
	var hH = $("body.cocaine div#header").outerHeight({margin: true});
	var fH = $("body.cocaine div#bottom").outerHeight({margin: true});
	var mH = wH-hH-fH;
	
	//alert(mH);
	if(mH < minH){
		mH = minH;
	}
	
	var mW = ( wW < minW ) ? minW : wW;
	
	//alert(wW+"x"+wH+"\nhH="+hH+"\nfH="+fH+"\n\nmovie height should be "+mH);
	//$("body").append("<p style='position: absolute; left: 0px; top: 0px'>"+wW+"x"+wH+"<br />mH="+mH+"<br />mW="+mW+"<br /><br />movie height should be "+mH+"</p>");
	
	$("body.cocaine div#flashOuter").height(mH-3).width(mW);
}

$(window).resize(function(){
	var oCheck = $("body.cocaine div#flashInner"); // if flashInner is a div, we want to leave it alone, because there's no Flash in it.
	//alert(oCheck.length);
	
	if(oCheck.length == 0){ // flashInner is not a div, it's either an embed or an object, so do the tweaks.
		calcSize();
	}
});

/***************/
//End Cocaine sizing only
/***************/