var bigvars = {};

function getBigVar($str){
	return bigvars[$str];
};

function setBigVar($str,$value){
	bigvars[$str] = $value;
	return $value;
};

var c = 		xLocation.Search['c'];
var s = 		xLocation.Search['s'];
var l = 		xLocation.Search['l'];
var shellType = xLocation.Search['shellType'];
var fv = "l="+l+"&s="+s+"&c="+c+"&shellType="+shellType;
var stageHeight = 800;
var flashcontent;
var wholepage;
var testPopUpBlocker = true;

function track($obj)
{
	var code = $obj.sectionCode+"~"+$obj.sectionName+"~"+   (($obj.pageCode != "null") ? $obj.pageCode+"~"+$obj.pageName : "");
	if (window.changestate) { changestate (code) }
};

function popRegister()
{
	if(isBlocked() == false) xWindow.openCenterFull("http://www.sonypictures.com/movies/davincicode/registration/","register",475,500);
};

function popWindow($obj)
{
	if($obj.url!="#"){
		if(isBlocked() == false) xWindow.openCenter($obj.url,"newwin",$obj.w,$obj.h);
	}
};

function popTrailer($obj)
{
	if(isBlocked() == false) xWindow.openCenterFull($obj.url,"trailer",xScreen.getWidth(),xScreen.getHeight());
};	

function popWallpapers($obj)
{
	if(isBlocked() == false) xWindow.openCenterScroll("html/popWallpaper.html?img="+$obj.file+"&w="+$obj.w+"&h="+$obj.h,'wallpaper',$obj.w,$obj.h);
};

function isBlocked()
{
	if(testPopUpBlocker == false) return false;
	test_window = window.open('html/popTest.html','test_window','width=1,height=1,left=0,top=0,scrollbars=no');
	var allow = test_window ? true: false;	
	if(!allow) alert("Please Enable Popup Windows.");
//	alert("allow == " + allow + " // Please Enable Popup Windows.");
	return !allow;
};	

function init(){
	flashcontent = new xElementObject("flash");
	wholepage = new xElementObject("wholepage");

	xWindow.addEvent("resize");
	xWindow.addListener("resize", "onWindowResize");
	onWindowResize();		// init
};

function setHeight(h)
{
	var setH = Math.max(h, xWindow.getHeight());
	flashcontent.setHeight(setH);
	stageHeight = h;
//		alert("setHeight: " + h + " vs. " + xWindow.getHeight());
};

function onWindowResize()
{
	setHeight(stageHeight);
};