<!--

// resize functions
function fitArea(target, wid, hei) {
    var originalWid = target.width();
	var originalHei = target.height();
	target.width(wid);
	var scaleRatio = wid/originalWid;
	target.height(Math.round(originalHei*scaleRatio));
	if (target.height() > hei) {
	  scaleRatio = hei/originalHei;
	  target.height(hei);
	  target.width(Math.round(originalWid*scaleRatio));
	}
}

function fillArea(target, wid, hei) {
    var originalWid = target.width();
	var originalHei = target.height();
	target.width(wid);
	var scaleRatio = wid/originalWid;
	target.height(Math.round(originalHei*scaleRatio));
	if (target.height() < hei) {
	  scaleRatio = hei/originalHei;
	  target.height(hei);
	  target.width(Math.round(originalWid*scaleRatio));
	}
} 

function position(target, container, align) {
  
	if (align=="center") {
		//alert(target.width());
	   target.css("left", (container.width()/2)-(target.width()/2));
	   target.css("top", (container.height()/2)-(target.height()/2));
	}
} 
  

function positionStuff(){

  var winWidth = $(window).width();
  var winHeight = $(window).height();

  fillArea($("#openingimg"), winWidth, winHeight);
  position($("#openingimg"), $("#opener"), "center");
	
  $("#enter").css("margin-top", 0);
  $("#enter").css("top", (winHeight/2)-140);
 
}

function myFadeIn(target){
	//
	if ($('#'+target).css("visibility") == "hidden") {
		$('#'+target).css("visibility", "visibile");
	}
	if ($('#'+target).css("display") == "none") {
		$('#'+target).css("display", "block");
	}
	
	$('#'+target).animate(
		{
			opacity: 1
		},
		{
			duration: 500,
			easing: 'easeInOutQuad'
		});
}


/** older functions, could remove? **/

// pumkin set div top value
// gets widths too, just in case
function setDivs() {

  if (document.getElementById) {
  	var winWidth = 0, winHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		winWidth = document.documentElement.clientWidth;
		winHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		winWidth = document.body.clientWidth;
		winHeight = document.body.clientHeight;
	}
	
	// should prevent the site from being shoved partially off-screen, when users have toolbar installed
	if (winHeight < 700) { winHeight = 700; }
	
	var divTop = (winHeight/2) - 320;
	
	if ( document.getElementById("main") ) {
	
		var centreItem = document.getElementById("main");
	}
	else if (document.getElementById("flash")) {
	
		var centreItem = document.getElementById("flash");
	}
	
	centreItem.style.top = divTop+"px";

	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// validate email sign-up form

function validateForm(formName)
{
	if (formName.MERGE1.value == "")
	{
		alert("Please enter your first name");
		formName.MERGE1.focus();
		return false;
	}
	if (formName.MERGE2.value == "")
	{
		alert("Please enter your last name");
		formName.MERGE2.focus();
		return false;
	}
	if (formName.MERGE0.value == "")
	{
		alert("Please enter your email address");
		formName.MERGE0.focus();
		return false;
	}
	if (formName.MERGE0.value != "") 
	{
		// check email syntax
		apos=formName.MERGE0.value.indexOf("@");
		dotpos=formName.MERGE0.value.lastIndexOf(".");
		
		if (apos<1||dotpos-apos<2) 
		{
			alert("This does not appear to be a valid email address, please check and retry.");
			formName.MERGE0.focus();
			return false;
		}
	}
}

-->
