//	QUERY SEARCH BEGIN
function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = unescape(window.location.search.substring(1) );
    
	var pairs = query.split("&");
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}
}

QueryString_Parse();

var feature = unescape(QueryString("feature") );
//	QUERY SEARCH END

function openWindow(url)
{
    var rand = "rand";
    win=window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}

//	GENERIC OPEN WINDOW
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

if (feature == "sweepstakes"){
				picWindow = window.open('comingsoon_sweeps.html','sweeps','width=243,height=140,resizable=0,scrollbars=0')
				picWindow.focus()
}
if (feature == "memory"){
				picWindow = window.open('memorygame.html','memory','width=640,height=420,resizable=0,scrollbars=0')
				picWindow.focus()
}
if (feature == "turtle"){
				picWindow = window.open('turtlegame.html','turtle','width=480,height=270,resizable=0,scrollbars=0')
				picWindow.focus()
}


//	AUTOMATICALLY POP WINDOWS IF THERE IS A VARIABLE. INDEX.HTML?______
var pageLoc = document.location;
pageLoc = pageLoc + " ";

var charNum = pageLoc.indexOf("?");
	if(charNum != -1) {
		var page = pageLoc.substring(charNum+1,pageLoc.length-1);
		if (page == "sweepstakes")	{
				picWindow = window.open('http://disney.go.com/disneyvideos/animateadfilms/findingnemo/sweeps/index.html','sweeps','width=243,height=140,resizable=0,scrollbars=0')
				picWindow.focus()
		} else if (page == "turtle") {
				picWindow = window.open('http://disney.go.com/disneyvideos/animateadfilms/findingnemo/turtlegame.html','turtle','width=480,height=270,resizable=0,scrollbars=0')
				picWindow.focus()
		} else if (page == "memory") {
				picWindow = window.open('http://disney.go.com/disneyvideos/animateadfilms/findingnemo/memorygame.html','memory','width=640,height=420,resizable=0,scrollbars=0')
				picWindow.focus()
		} 
	}


function openWindow(url)
{
    var rand = "rand";
    win=window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}

//	---------------------- track and launch clips ------------------------------
function debug(string)
{
    //to test hitbox just uncomment the following statement:
//alert(string);
}

function popClip1() // i like nemo
{
debug('trackTrailer()');
	hitbox.Set_hbLink(exitLinkArray[3]);
	//hitbox.Set_hbPageView("clip1","/finding+nemo/generate+awareness/multimedia/clips;/generate+awareness/multimedia/animation/finding+nemo/clips");
	picWindow = window.open('http://www.totaleclips.com/disney/monsters/splash.asp?clipid=e18394','clips','width=340,height=480,resizable=0,scrollbars=0')
	picWindow.focus()
}

function popClip2() // in and out
{
debug('trackTrailer()');
	hitbox.Set_hbLink(exitLinkArray[4]);
	//hitbox.Set_hbPageView("clip2","/finding+nemo/generate+awareness/multimedia/clips;/generate+awareness/multimedia/animation/finding+nemo/clips");
	picWindow = window.open('http://www.totaleclips.com/disney/monsters/splash.asp?clipid=e18395','clips','width=340,height=480,resizable=0,scrollbars=0')
	picWindow.focus()
}

//	SESSION COOKIE FOR PRESS RELEASE -- START
function poppup(pop_url, windowWidth, windowHeight) {
	window.open(pop_url,"vidclip","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+windowWidth+",height="+windowHeight);
}
