var pageRoot = "";

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)
{
    var rand = "_blank";
    win=window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}


function popStageToScreen()
{
	popWindow("stagetoscreen/index.html",840, 550, "stagetoscreen");
}

function popOnLocation()
{
	popWindow("onlocation/index.html",840, 600, "onlocation");
}

function popLoveHurts()
{
	popWindow("lovehurts/index.html",840, 550, "lovehurts");
}

function popFanQuiz()
{
	popWindow("fanquiz/index.html",840, 550, "fanquiz");
}

function popPartners()
{
	popWindow("partners/index.html",450, 580, "partners");
}


function popProductionNotes()
{
	popWindow("production_notes/index.html", 750, 500, "ProductionNotes");
}



function showWallpaper(number)
{
	popWindow(pageRoot + "./content/wallpapers/wallpaper.html?wid="+number+"&size=1024", 544, 589, "wallpapers");
}

function popIcons()
{
	popWindow("im_icons/popup.html", 600, 400, "mmIcons");
}

function popPromotions(){
	popWindow("promotions/index.html", 560, 888, "mmPromo");
}

function popEcard()
{
	popWindow("http://ecard.mammamiamovie.com/generator.html", 500, 500, "ecard");
}
function popQuiz()
{
	popWindow("./quiz.html", 500, 500, "quiz");
}

function popFacebook(){
	openWindow("http://www.facebook.com/apps/application.php?id=18715063551");
}

function popFeaturettePopup(){
	popWindow("http://widgets.clearspring.com/c/widget.bs?wid=483f0274e955e784", 332,315, "popup_featurette");
}

function popSpotPopup(){
	popWindow("http://widgets.clearspring.com/o/4849d0622137f4a7/4849d6fd25ae01b6/4849d0622137f4a7/c1177ca", 332,270, "popup_clip");
}

function popWallpaper(number, size)
{
	if(size==1) {
		var size_num="1280x1024";
	}else if(size==2) {
		var size_num="1600x1200";
	}
	openWindow(pageRoot + "wallpaper/wallpaper.html?wallpaper="+number+"_"+size_num+".jpg");
}

function checkSize(fix)

{

   myHeight = 5;

   minHeight = 856;

   if( typeof( window.innerWidth ) == 'number' )

   {

      //Non-IE

      myHeight = window.innerHeight;

   } 

   else if( document.documentElement && ( document.documentElement.clientHeight ) ) 

   {

      //IE 6+ in 'standards compliant mode'

      myHeight = document.documentElement.clientHeight;

   } 

   else if( document.body && ( document.body.clientHeight ) ) 

   {

      //IE 4 compatible

      myHeight = document.body.clientHeight;

   }



   if( fix )

   {

      document.getElementById('flashcontainer').style.height = minHeight;

   }

   else

   {

      document.getElementById('flashcontainer').style.height = '100%';

   }

}
function popWidget(num)

{
	if(num == 1) {
		popWindow("http://widgets.clearspring.com/c/widget.bs?wid=4833719bded155d3", 332, 270, "widget");
	}else {

		popWindow("http://widgets.clearspring.com/c/widget.bs?wid=477e8b1e933e4f9a", 332, 270, "widget");
	}

}
function popRedBand() {
	popWindow("http://www.mybestfriendsgirlmovie.com/aol/redband.html", 716, 520, "redband");
}
