var win = null;
var index = 1;
function openDialog(id,w,h) {
    Dialog.alert($(id).innerHTML, {className: "alphacube",  width:w, height:h, id: "d" + index})
    index++;
	document.getElementById('scrollerArea').style.display = 'none';
}

function lastDialog(id) {
    Dialog.confirm($(id).innerHTML, {className: "alphacube",  width:250, okLabel: "Close All", ok: closeAllModalWindows})
}

function closeAllModalWindows() {
    Windows.closeAllModalWindows();
    //return true;
	document.getElementById('scrollerArea').style.display = 'inline';
}


//set video window function
var defaultWidth = 493;
var defaultHeight = 301;

// loads the video player and then changes the text.
// width and height are optional
function OnVideoClick(videoId, width, height)
{
    LoadVideo(videoId, width, height);
}

// loads the video player
// width and height are optional
function LoadVideo(videoId, width, height)
{
    // if the width and height have been specified, we set it.
    // otherwise we use the default width and height that are defined above
    width = (width) ? width : defaultWidth;
    height = (height) ? height : defaultHeight;
    
    // change the video source   
    var videoPlayerContainer = document.getElementById('videoPlayer');
    videoPlayerContainer.innerHTML = '<embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=' + videoId + ',t=1,mt=video,sr=0,primaryColor=0xfafafa,ap=1" width="493" height="294" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent" />';
    
}

function openWindow(URL, windowName, windowFeatures){
newWindow = window.open(URL, windowName, windowFeatures)
}



function SwapOut(videoText){
	var videoDescriptionContainer = document.getElementById('videoTitles');
   	videoDescriptionContainer.innerHTML = videoText;
    return true;
}

function SwapBack(){
	var videoDescriptionContainer = document.getElementById('videoTitles');
    videoDescriptionContainer.innerHTML = "<h1>Go Behind the Scenes of Quantum Of Solace</h1>";
    return true;
}


function swapWallp(paperId){
	openDialog(wallpaperPop, 350, 275);
	var ssContainer = document.getElementById('wpHolder');
    ssContainer.innerHTML = '<div align="center"><img src="http://creative.myspacecdn.com/Client/Sony/QuantumOfSolace/Downloads/wallpaper'+ paperId +'Thumb.jpg" /><br /><a class="wpLink" href="http://creative.myspacecdn.com/Client/Sony/QuantumOfSolace/Downloads/qos-wallpaper-'+ paperId +'-sm.jpg" name="&lid=wallpaper'+ paperId +'800" target="_blank">800 x 600</a>  |  <a class="wpLink" href="http://creative.myspacecdn.com/Client/Sony/QuantumOfSolace/Downloads/qos-wallpaper-'+ paperId +'-md.jpg" name="&lid=wallpaper'+ paperId +'1024" target="_blank">1024 x 768</a>  |  <a class="wpLink" href="http://creative.myspacecdn.com/Client/Sony/QuantumOfSolace/Downloads/qos-wallpaper-'+ paperId +'-lg.jpg" name="&lid=wallpaper'+ paperId +'1280" target="_blank">1280 x 1024</a></div>';
}

             
