function popWindow( url, width, height, windowName )
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return 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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popScrollingWindow(url, width, height, windowName)
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return 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";
    return window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}

function downloadFile(theFile)
{
    popWindow("download.html?theFile="+theFile, 300, 100, "downloadWindow");
}

function debug(string)
{
    //to test hitbox just uncomment the following statement:
    //alert(string);
}

function track(trackString)
{
    switch (trackString)
    {
    case "XXXXX":
        debug(trackString);
        break;
    default:
        debug(trackString);
        _hbPageView(trackString, "/Ladykillers");
        break;
    }
}

//*************************
//*************************
//Modificar la url del foro
//*************************
//*************************
function popforo()
{
    openWindow("http://www.terra.es/cine/foro/portada.cfm?IDconversacion=181173&idcanal=85&nivel=2&IDforo=275&idcategoria=75&veresq=1");
}
//*************************
//*************************
//Modificar la url del foro
//*************************
//*************************

function popTrailer()
{
	popWindow("clips/trailer.html", 670, 520, "trailer");
}

function popClips()
{
	popWindow("clips/clips_menu.html", 670, 520, "clips");
}

function popPreviews()
{
	popWindow("clips/previews_menu.html", 670, 520, "all_previews");
}

function popClip(clip, player, size)
{
    player = player.toUpperCase();
    size = size.toLowerCase();

    track("watch+video+" + clip + "+" + player + "_" + size);

    popWindow('clips/clips.html?movie='+clip+'&size='+player+size, 670, 590, "trailer");
}

function popSuperbowlClip(clip, player, size)
{
    popClip(clip, player, size);
}

function popAIM()
{
    track("aim+icons");
    popWindow("aim/aim.html", 500, 416, "aim_icons");
}

function popWallpaper(number, size)
{
	track("wallpaper+"+number+"+"+size);
	openWindow("wallpaper/wallpaper.html?wallpaper=wallpaper_"+number+"_"+size+".jpg");
}

function popEcard(card)
{
	track("ecard+"+card);
	popScrollingWindow("ecards/ecards.html?card="+card+".jpg", 600, 600, "ecards");
}

function enterSite()
{
	window.location.href = "main.html";
}

function deeplinkTrailer()
{
	window.location.href = "main.html?deepLink=thePlan";
}

function popPoster()
{
    track("poster");
    popScrollingWindow('poster/posterconfirm.html?poster=LK-poster',400,560,'Poster');
}

function externalLink(link)
{
    popWindow("http://touchstone.movies.go.com/global/disclaimer/index.html?newURL="+link, 370, 210, "linkWindow");
}

function popBlackJack()
{
	popWindow("blackjack.html", 770, 620, "blackjack");
}

function ssWindows()
{
	downloadFile("screensaver/screensaver_setup.zip");
}
function ssOS9()
{
	downloadFile("screensaver/theladykillers_ss_OSX.sit");
}
function ssOSX()
{
	downloadFile("screensaver/theladykillers_ss_OS9.sit");
}


