window.onload = function() {
    setMainImageSize();
}

window.onresize = function() {
    setMainImageSize();
}

var type = "";
if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";
if (document.all) type="IE";
if (document.layers) type="NN";
if (!document.all && document.getElementById) type="MO";

function setMainImageSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
		 myWidth = window.innerWidth;
		 myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
	}
	
	//var new_image_width = (myWidth - 100);
	//var new_image_height = (myHeight - 100);
	
	var newWidth = (myWidth-50);
	var newHeight = (myHeight-50);
	
	var new_image_width = newWidth;
    var new_image_height = new_image_width*(1196/1596);

     var background = document.getElementById('background');
    
    if(new_image_height < newHeight) { 
        new_image_height = newHeight;
        new_image_width = new_image_height*(1596/1196);
    	background.style.top = "0px";
        
    } else {
    	var top = (newHeight - new_image_height) / 2;
        background.style.top = top + "px";
        background.style.left = "0px";
    }
    
   
    background.style.height = new_image_height + "px";
	background.style.width = new_image_width + "px";
	
	var container = document.getElementById('container');
	
	container.style.height = (myHeight-50) + "px";
    container.style.width = (myWidth-50) + "px";

	// try and fit it all on the page
	
	var total_elements_height = 172 + 47 + 47 + 47 + 60;
	
	var initital_margins = 100 + 50 + 50 + 50 + 50;
	
	var gap = newHeight - total_elements_height - 100;
		
		var new_margins = gap / 4;
		
		//alert(new_margins);
		
		document.getElementById('vamp_logo').style.marginBottom = new_margins + "px";
		document.getElementById('horc').style.marginBottom = new_margins + "px";
		document.getElementById('player').style.marginBottom = new_margins + "px";
		document.getElementById('download').style.marginBottom = new_margins + "px";

	
	if(newHeight < (total_elements_height+initital_margins)) {
		
				
	}
	
}

function fieldFocus(element, text)
{
	if(text == element.value) {
		element.value = "";
	}
}
function fieldBlur(element, text)
{
	if("" == element.value) {
		element.value = text;
	}
}

var player = null; 
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}

function checkForm()
{
    emailaddress = document.getElementById('email_input');
    if("your@email.com" == emailaddress.value) {
        alert("Please enter a valid email address");
        return false;
    } else {
        document.subscribeform.submit();
    }
}
