var isReady;
var version = navigator.appVersion;
var vArray = new Array();
vArray = version.split(";")
var msInfo = vArray[1]
var msArray = new Array();
msArray = msInfo.split(" ");
var isFlash = false;
var firstTime = true;

function bodyResize()
{
	// if(isReady==true){
	// 		setFlashHeight('flashid', $("flashid").height());
	// }
}

function setFlashWidth()
{
	$("#flashid").width("100%");
}

function checkURI()
{
	$('body').css({ width: 'auto' });
	if(!/#/.test(href))
	{
		// If the address is NOT a returning bookmarked URI (i.e. hashed)
		// then split the URI and add the hash where appropriate for long URIs
		var dir = href.substring(href.indexOf(root) + root.length);
		if(dir.length)
		{
			window.location.href = href.replace(dir, "#/" + dir);
		}
	}
	/*
	if ( /#/.test(href) )
	{
		// If the address is a returning bookmarked URI (i.e. hashed)
		// then remove the hash for non-Flash code to handle normally
		var dir = href.replace('#/', '');					
		if (dir.length)	{
			window.location.href = dir;
		}
	}*/
	
	firstTime = false;
}


function setFlashHeight(divid, newH)
{
	
		//if(firstTime) {checkURI();}
		isFlash = true;
		
		var divid, newH;
		var ext = "px";		
		if(msArray[1] == "MSIE" && msArray[2] < 8)
		{
			if(newH<document.body.clientHeight)
			{ 
				newH = document.body.clientHeight + 1;
				//alert("newH is less than window height: " + newH)
			}
		}
		else
		{	
			if(newH<window.innerHeight)
			{ 
				newH = window.innerHeight +1;
			}
		}
		$("#flashid").height(newH);
		$("#startcreative").height(newH);
		
}
function setFlashSize(divid, newW, newH){

	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById )
	{
		if(opera == -1) 
		{
			return (true);
		} 
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) 
		{
			return(true);
		}
	}
	return (false);
}

function setBackground(){
	//document.body.style.backgroundImage = "url('img/bg/bkg.jpg')";
}

$(document).ready(function()
{
	isReady = true;
	setFlashWidth();
	var newHeight;
	if($.browser.msie && $.browser.version < 8)
	{
		newH = document.body.clientHeight + 1;
	}
	else
	{
		newHeight = window.innerHeight + 1;
	}
	//alert("window innerheight: "+ window.innerHeight);
	$("#flashid").height(newHeight)
	//document.getElementById("flashid").style.height =  newHeight+"px";
});