newPopUp({
	name:"credits",
	url:"pops/credits/",
	width:993, height:314, scroll:"no", resizable:"no"});
newPopUp({
	name:"fan",
	url:"pops/fan/",
	width:316, height:575, scroll:"no", resizable:"no"});	
newPopUp({
	name:"register",
	url:"pops/register/",
	width:466, height:559, scroll:"no", resizable:"no"});	
newPopUp({
	name:"tos",
	url:"http://www.paramountmovies.com/legal/termsofuse.php?bgcolor=000000&linkcolor=3c3c3c&fontcolor=3c3c3c",
	width:466, height:559, scroll:"yes", resizable:"no"});
newPopUp({
	name:"privacy",
	url:"http://www.paramountmovies.com/legal/privacypolicy.php?bgcolor=000000&linkcolor=3c3c3c&fontcolor=3c3c3c",
	width:466, height:559, scroll:"yes", resizable:"no"});	
newPopUp({
	name:"intl",
	url:"http://www.paranormalmovie.com/intl/releasedates/release-dates.html",
	width:550, height:600, scroll:"yes", resizable:"yes"});		

/*
newPopUp({
	name:"credits",
	url:"pops/credits/index.html",
	width:888, height:120, scroll:"no", resizable:"no"});
*/
	
//EXAMPLE to find days between now and release date (don't forget month is zero based)
/*var d1 = new Date(2008,5,1);
var d2 = new Date();

alert(daysDiff(d1,d2));	
*/
function rkdmsEvent(movieName,eventName){
	var d = new Date();
	var t = d.getTime();
	var tracking = "<img src=\"https://www.rkdms.com/order.gif?mid="+ movieName +"&oid="+ t +"&lid=1&cid=&iid="+ eventName +"&ts=&icent=0&iqty=1&iname="+ eventName +"\" height=\"1\" width=\"1\" />";
	//document.write(tracking);	
	
	document.getElementById("bounceTracking").innerHTML = tracking;
	
	//alert(tracking);
}

function getDeeplinkHash(){

	var q = document.location.search||document.location.hash;
	if (q.length > 1) {
		var toReturn = q.substr(2);
		return toReturn
	} else {
		return ""
	}
}

//Hide footer
function showFooter(){
	FadeOpacity("footpanel",0,100,1500,12);	
	document.getElementById("footpanel").style.visibility = "visible";
}

//Show footer
function hideFooter(hideTime){
	hideTime = typeof(hideTime) != 'undefined' ? hideTime : 1500;
	FadeOpacity("footpanel",100,0,hideTime,12);	
}














//POPUP STUFF
//-----------------------------------------------
//**** TEST MOSAIC
var mosaicArray = new Array();
var paranormalPops = new Array();
var mosaicHasStarted = false;
var numWins = 6;
var mosaicCols = 3;
var numImagesPer = 3;
var totalImages = 38;
var hasClosed = false;

//Counter vars
var curImage = 0;
var curWindowIndex = 0;
var curImageInCycle = 0;

//Starter vars
var mosaicStartWindow;
var mosaic6Window;

//Browser vars
var netscape = (document.layers && true);

var iWidth = 0;
var iHeight = 0;
var iLeft = 0;
var iTop = 0;

browserConfig();


//startMosaic();




function browserConfig(){
	iWidth = (netscape) ? top.innerWidth:parseInt(top.document.body.clientWidth);
	iHeight = (netscape) ? top.innerHeight:parseInt(top.document.body.clientHeight);
	iLeft = (netscape) ? top.screenX:parseInt(top.screenLeft);
	iTop = (netscape) ? top.screenY:parseInt(top.screenTop);
	
	if (!iWidth) {iWidth = screen.width;}
	if (!iLeft) {iLeft = 0;}
	if (!iHeight) {iHeight = screen.height;}
	if (!iTop) {iTop = 0;}
}
		
function startMosaic(){

	browserConfig();

	if (!mosaicHasStarted){
	
		openMosaicWindows();

		//Start window
		winX = iLeft + 100;
		
		//alert(winX);
		winY = 100;
		wopts  = "width=225,height=225,screenX=" + winX + ",screenY=" + winY + ",left=" + winX + ",top=" + winY + ",dependent=1,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,toolbar=0,alwaysRaised=0";
		mosaicStartWindow = window.open('pops/mosaic/mosaic_start.php', 'startmosaic', wopts);
		if (mosaicStartWindow != null) {		
			if(mosaicStartWindow.opener == null){ 
				mosaicStartWindow.opener = this.window; 
				//mosaicStartWindow.blur();
			}	
		}
		
		
		//6 Window
		winX = iLeft + 500;
		winY = 100;
		wopts  = "width=225,height=225,screenX=" + winX + ",screenY=" + winY + ",left=" + winX + ",top=" + winY + ",dependent=1,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,toolbar=0,alwaysRaised=0";
		mosaic6Window = window.open('pops/mosaic/mosaic_6.php', 'mosaic6', wopts);
		if (mosaic6Window != null) {		
			if(mosaic6Window.opener == null){ 
				mosaic6Window.opener = this.window; 
				//mosaic6Window.blur();
			}	
		}	
		
		
		//Make sure main window has focus
		window.focus();	
	}
}

function mosaicCloseTrigger(){
	//browserConfig();

	if (!mosaicHasStarted && !hasClosed){
		hasClosed = true;
		
		mosaicArray[5].mosaicCloseTrigger();
		
		//startMosaicTimer();
	}	
}

function openMosaicWindows(){

	var curCol = 0;
	var curRow = 0;		
	
	//Open children
	for (var i=0; i < numWins; i++) {
		curCol++;			
		
		winX = iLeft + 302*(curCol-1);
		winY = 370*curRow;
		
		if (mosaicCols == curCol){
			curRow++;
			curCol = 0;
		}				
	
		wopts  = "width=300,height=300,screenX=" + winX + ",screenY=" + winY + ",left=" + winX + ",top=" + winY + ",dependent=1,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,toolbar=0,alwaysRaised=0";
	
		mosaicArray.push(window.open('pops/mosaic/mosaic.php?i=' + (i+1) + "&t=" + numWins, 'mosaic' + i, wopts));
		if (mosaicArray[i] != null) {		
			if(mosaicArray[i].opener == null){ 
				mosaicArray[i].opener = this.window; 
				mosaicArray[i].blur();
			}	
		}else{
			//alert("Failed to open child window");
		}	
		window.focus();
	}
}


function startMosaicTimer(){
	/*
	for (var i=0; i < numWins; i++) {
			if (mosaicArray[i] != null) {		
				mosaicArray[i].focus();
			}	
	}


	if (!mosaicHasStarted){
		mosaicHasStarted = true;
		mosaicTimer = setInterval( "nextMosaic()", 750 );
	}
	*/
	mosaicArray[i].mosaicCloseTrigger();
	
}
function nextMosaic(){
	var curWindow;
	
	curImage++;
	curImageInCycle++;
	
	//See what to do based on count
	if (curImage > totalImages){
		curImage = 2;
		curWindowIndex = 1;
		curImageInCycle = 0;	
	}else{
		if (curImageInCycle > numImagesPer){
			setNextWindowIndex();
		}
	}
	
	//Get window
	curWindow = mosaicArray[curWindowIndex];	
	
	//Set image in window if window exists
	if (curWindow != null) {
		if (curWindow.document != null) {
			targetImg = curWindow.document.getElementById("mosaic");
			//alert(targetImg);
			targetImg.src = "images/"+ curImage +".jpg";
		}
	}
	
	//Force next window if it's first image
	if (curImage == 1){setNextWindowIndex();}	
	
}

function setNextWindowIndex(){
	curWindowIndex++;
	curImageInCycle = 0;
	//alert(curWindowIndex + ":" + numWins);
	if (curWindowIndex >= numWins) {
		curWindowIndex = 1;
	}
}
