/*------------------------

  Initial Variables
 
------------------------*/

var siteTitle       = "Kate Voegele Lift Me Up Tour";
var clientPath      = "http://creative.myspacecdn.com/design/myspace/kateOnTour/"
var liveProfileID   = "262561052";


function loadVideo(videoId, width, height, tabId) {
    // 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('player');
    videoPlayerContainer.innerHTML = '<embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=' + videoId +',t=1,mt=video,sr=0,ap=1" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" width="372" height="317" wmode="transparent"/>';

    showRow(tabId);

}

/*-------------------------
    Photo Slideshow
--------------------------*/

var flashvars_slideshow = {};    

var params_slideshow = {
  wmode: "transparent",
  allowScriptAccess: "always"          
};

var attributes_slideshow = {
  id: "photoSWF",
  name: "photoSWF"
};

swfobject.embedSWF("http://creative.myspacecdn.com/Client/UniversityOfPhoenix/LiftMeUp/swf/photoslider.swf", "photoFlash", "501", "227", "9.0.0","http://creative.myspace.com/CodeLibrary/Global/Flash/expressInstall.swf", flashvars_slideshow, params_slideshow, attributes_slideshow);

/*------------------------

  PWC Functions
 
------------------------*/
var win = null;
var index = 6000;

function openDialog(id,w,h) {
    
    //initialize pwc
    Dialog.alert($(id).innerHTML, {width:w, height:h, okLabel: "Close", ok:closeAllModalWindows, id: "d" + index})
    index++;
}

function openIframe(id,w,h,urlPath) {
    
    //initialize pwc
    Dialog.alert($(id).innerHTML, {width:w, height:h, okLabel: "Close", ok:closeAllModalWindows, id: "d" + index})
    index++;
    
    //dynamically swap out src of iframe
    $("iframeContent").width = w;
    $("iframeContent").height = h;
    $("iframeContent").src = urlPath;
}

function openIframeLoggedIn(id,w,h,urlPath) {
    
    if (isLoggedIn < 0) {
         window.alert("You Must Be Logged In");
    }  else {        
        //initialize pwc
        Dialog.alert($(id).innerHTML, {width:w, height:h, okLabel: "Close", ok:closeAllModalWindows, id: "d" + index})
        index++;
        
        //dynamically swap out src of iframe
        $("iframeContent").width = w;
        $("iframeContent").height = h;
        $("iframeContent").src = urlPath;
    }
}

function openWallpaper(id,w,h, wallpaperFilename) {
    //initialize pwc
    Dialog.alert($(id).innerHTML, {width:w, height:h, okLabel: "Close", ok:closeAllModalWindows, id: "d" + index})
    index++;
    
    //displays the thumbnail of the wallpaper
     $("wallpaperHolder").innerHTML = '<img src="http://stage-creative.myspacecdn.com/design/myspace/kateOnTour/downloads/Wallpapers/pwc/' + wallpaperFilename + '_thm.jpg" />';
     
     //insert wallpaper links
     $("wallpaperLinks").innerHTML = '<h3>Download Kate Voegele Lift Me Up Tour Wallpaper</h3>' +
        '<a href="' + clientPath + 'downloads/Wallpapers/1024x768/' + wallpaperFilename + '_1024x768.jpg" target="_blank" name="&lid='+ wallpaperFilename +'_1024x768" id="'+ wallpaperFilename +'_1024x768" title="Download the 1024x768 ' + siteTitle + ' Wallpaper" target="_blank">1024x768</a> |' +
        '<a href="' + clientPath + 'downloads/Wallpapers/1280x800/' + wallpaperFilename + '_1280x800.jpg" target="_blank" name="&lid='+ wallpaperFilename +'_1280x800" id="'+ wallpaperFilename +'_1280x1024" title="Download the 1280x800 ' + siteTitle + ' Wallpaper" target="_blank">1280x800</a> |' +
        '<a href="' + clientPath + 'downloads/Wallpapers/1280x1024/' + wallpaperFilename + '_1280x1024.jpg" target="_blank" name="&lid='+ wallpaperFilename +'_1280x1024" id="'+ wallpaperFilename +'" title="Download the 1280x1024 ' + siteTitle + ' Wallpaper" target="_blank">1280x1024</a> |'  + 
        '<a href="' + clientPath + 'downloads/Wallpapers/1440x900/' + wallpaperFilename + '_1440x990.jpg" target="_blank" name="&lid='+ wallpaperFilename +'_1440x900" id="'+ wallpaperFilename +'_1440x900" title="Download the 1440x900 ' + siteTitle + ' Wallpaper" target="_blank">1440x900</a> | ' + 
        '<a href="' + clientPath + 'downloads/Wallpapers/1600x1200/' + wallpaperFilename + '_1600x1200.jpg" target="_blank" name="&lid='+ wallpaperFilename +'_1600x1200" id="'+ wallpaperFilename +'_1600x1200" title="Download the 1600x1200 ' + siteTitle + ' Wallpaper" target="_blank">1600x1200</a>';
}

function openBadge(id,w,h,badgeFilename) {
    //initialize pwc
    Dialog.alert($(id).innerHTML, {width:w, height:h, okLabel: "Close", ok:closeAllModalWindows, id: "d" + index})
    index++;
    
    //displays the badge image
    $("badgeHolder").innerHTML = '<img src="' + clientPath + 'downloads/Badges/thumbnails/' + badgeFilename + '.jpg" />' + 
                                      '<br /><br /><center><a href="' + clientPath + 'downloads/Badges/full/' + badgeFilename + '.jpg" target="_blank">view full image</a></center>';
    
    //insert embed code for users badge
    $("badgeCode").innerHTML = '<form name="badge"><textarea name="badgeCode" id="badgeCode" cols="40" rows="7" onClick="this.select();"><a href="http://www.myspace.com/' + liveProfileID + '" name="&lid=badge'+ badgeFilename +'" id="badge'+ badgeFilename +'" target="_blank"><img border="0" src="' + clientPath + 'downloads/Badges/full/' + badgeFilename + '.jpg" alt="' + siteTitle + ' -  Profile Badge"></a></textarea></form>'
}

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

function closeAllModalWindows() {
    Windows.closeAllModalWindows();
    return true;
}

function Enter() {
        closeAllModalWindows();
		document.getElementById('b').style.display = 'block';
		document.getElementById('c').style.display = 'block';
		document.getElementById('header').style.display = 'block';
		document.getElementById('topnav').style.display = 'block';
}

/*-------------------------
   Wallpaper Flash
--------------------------*/


var flashvars_wallpapers = {
  xmlPath: "http://stage-creative.myspacecdn.com/design/myspace/kateOnTour/xml/wallpapers.xml",
  keepSelected: "t",
  selectedWindow: "0",
  imageWidth: "230",
  imageHeight: "120",
  sWidth: "370",
  sHeight: "120"
};

var params_wallpapers = {
  wmode: "transparent",
  allowScriptAccess: "always",
  allowFullScreen: "true",
  swLiveConnect: "true"    
};

var attributes_wallpapers = {
  id: "wallpaperSWF",
  name: "wallpaperSWF"
};

swfobject.embedSWF("http://creative.myspacecdn.com/design/myspace/kateOnTour/flash/accordion_wallpapers.swf", "wallpaperFlash", "370", "120", "9.0.0","http://creative.myspace.com/CodeLibrary/Global/Flash/expressInstall.swf", flashvars_wallpapers, params_wallpapers, attributes_wallpapers);

/*-------------------------
   Badge Flash
--------------------------*/


var flashvars_badges = {
  xmlPath: "http://stage-creative.myspacecdn.com/design/myspace/kateOnTour/xml/badges.xml",
  keepSelected: "t",
  selectedWindow: "0",
  imageWidth: "230",
  imageHeight: "120",
  sWidth: "370",
  sHeight: "120"
};

var params_badges = {
  wmode: "transparent",
  allowScriptAccess: "always",
  allowFullScreen: "true",
  swLiveConnect: "true"    
};

var attributes_badges = {
  id: "badgeSWF",
  name: "badgeSWF"
};

swfobject.embedSWF("http://creative.myspacecdn.com/design/myspace/kateOnTour/flash/accordion_badges.swf", "badgesFlash", "370", "120", "9.0.0","http://creative.myspace.com/CodeLibrary/Global/Flash/expressInstall.swf", flashvars_badges, params_badges, attributes_badges);


/*-------------------------
Video Journal Toggle
--------------------------*/

function doClick(obj){
	var ids = ["item0","item1","item2","item3","item4","item5","item6","item7","item8","item9","item10","item11","item12","item13","item14","item15","item16","item17","item18","item19","item20","item21","item22","item23","item24","item25","item26","item27","item28","item29","item30","item31","item32","item33","item34","item35","item36","item37","item38","item39","item40","item41","item42","item43","item44","item45","item46","item47","item48","item49","item50","item51","item52","item53","item54","item55","item56","item57","item58","item59","item60","item61","item62","item63","item64","item65","item66","item67","item68","item69","item70","item71","item72","item73","item74","item75","item76", "item77", "item78", "item79", "item80", "item81", "item82"];
	for(i=0;i<ids.length;i++){
		document.getElementById(ids[i]).className = "notClicked";
	}
	obj.className = obj.className == "clicked" ? "notClicked" : "clicked";
}