//programmed deeplinks: catreturns, nausicaa, porcorosso
//deeplink variable: movie

//find query attached
var pageLoc = String(document.location);
var queryPos = pageLoc.indexOf("?");
var queryString = (queryPos < 0) ? "" : pageLoc.substring(queryPos);

function popWindow( url, width, height, windowName )
{
	//get center coords
	var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    win=window.open(url, windowName, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function popScrollingWindow(url, width, height, windowName)
{
	//get center coords
	var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    win=window.open(url, windowName, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function openWindow(url)
{
    win=window.open(url,"new","directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}
function pop800(){
	popWindow('http://disneyvideos.disney.go.com/moviefinder/calltoorder.html', 390, 300, 'calltoorder');
}

//wave 1 links
function popSpiritedAbout()
{
    popWindow("spiritstory.html",400,400,"spiritstory");
}
function popSpiritedDVD()
{
    popWindow("spiritdvd.html",400,400,"spiritdvd");
}
function popSpiritedMiyazaki()
{
    popWindow("spiritmiyazaki.html",400,400,"miyazaki");
}
function popSpiritedAcclaim()
{
    popWindow("spiritacclaim.html",400,400,"spiritacclaim");
}
function popBuySpirited()
{
    trackSpiritOrder();
    openWindow("http://go-disneystore.com/spiritedawaydvd");
}

function popKikiAbout()
{
    popWindow("kikistory.html",400,400,"kikistory");
}
function popKikiDVD()
{
    popWindow("kikidvd.html",400,400,"kikidvd");
}
function popKikiAcclaim()
{
    popWindow("kikiacclaim.html",400,400,"kikiacclaim");
}
function popBuyKiki()
{
    trackKikiOrder();
   openWindow("http://go-disneystore.com/kikisdeliveryservicedvd");
}

function popCastleAbout()
{
    popWindow("castlestory.html",400,400,"castlestory");
}
function popCastleDVD()
{
    popWindow("castledvd.html",400,400,"castledvd");
}
function popCastleAcclaim()
{
    popWindow("castleacclaim.html",400,400,"castleacclaim");
}
function popBuyCastle()
{
    trackCastleOrder();
    openWindow("http://go-disneystore.com/castleintheskydvd");
}

function popRegularMiyazaki()
{
    popWindow("miyazaki.html",400,400,"miyazaki");
}

function popTrailerSpirit()
{
    trackSpiritTrailer();
    popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e16573",340,470,"spirittrailer");
}

function popTrailerKiki()
{
    trackKikiTrailer();
    popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e16575",340,470,"kikitrailer");
}

function popTrailerCastle()
{
    trackCastleTrailer();
    popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e16574",340,470,"castletrailer");
}

function popNews()
{
    popWindow("news.html",400,400,"news");
}

function popMultimedia()
{
    trackMultimedia();
    popWindow("trailers.html",400,400,"trailer");
}
//end wave 1

//wave 2 links
function popCatAbout()
{
	popWindow("catstory.html",400,400,"Catstory");
}
function popCatDVD()
{
	popWindow("catdvd.html",400,400,"Catdvd");
}
function popBuyCat()
{
	trackCatOrder();
	//pop800();
	openWindow("http://www.go-disneydirect.com/miyazakithecatreturns2discdvd");
}

function popNausicaaAbout()
{
	popWindow("nausicaastory.html",400,400,"Nausicaastory");
}
function popNausicaaDVD()
{
	popWindow("nausicaadvd.html",400,400,"Nausicaadvd");
}
function popBuyNausicaa()
{
	trackNausicaaOrder();
	//pop800();
	openWindow("http://www.go-disneydirect.com/miyazakinausicaaofthevalleyofthewind2discdvd");
}

function popPorcoAbout()
{
	popWindow("porcostory.html",400,400,"Porcostory");
}
function popPorcoDVD()
{
	popWindow("porcodvd.html",400,400,"Porcodvd");
}
function popBuyPorco()
{
	trackPorcoOrder();
	//pop800();
	openWindow("http://www.go-disneydirect.com/miyazakiporcorosso2discdvd");
}

function popTrailerCat()
{
	trackCatTrailer();
	popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e23246",340,470,"cattrailer");
}

function popTrailerNausicaa()
{
	trackNausicaaTrailer();
	popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e23246",340,470,"nausicaatrailer");
}

function popTrailerPorco()
{
	trackPorcoTrailer();
	popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid=e23246",340,470,"porcotrailer");
}

function popNews2()
{
    popWindow("news2.html",400,400,"news");
}

function popStudioGhibli()
{
    popWindow("studio_ghibli.html",400,365,"miyazaki");
}
//end wave 2

function moreMiyazaki(wave)
{
    switch(wave){
		case 1: //wave 1
			location.href = "more_miyazaki.html";
			trackWaveOne();
			break;
		case 2: //wave 2
			location.href = "index2.html";
			break;
		default:
			break;
	}
}