// JavaScript Document

function openWindow(URL, windowName, windowFeatures){ 
	newWindow = window.open(URL, windowName, windowFeatures) 
}
	
var defaultWidth = 456;
var defaultHeight = 370;

// 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://lads.myspace.com/videos/vplayer.swf" flashvars="sr=0&m=' + videoId + '&type=video" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>';
    

}


//for Terms and Conditions Window
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++;
}

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

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



function SubmitTermsAndAgreement()
{
	
	var chkTermsAndConditions = $('chkTermsAndConditions');
	//alert(chkTermsAndConditions.value);
	if (isLoggedIn > 0)
        {    
			
            if (chkTermsAndConditions.value == "off")
            {
                alert('In order to submit your photo, you must check the \'I agree\' button ');
                return false;
            }
            else
			{
                window.open('http://adsupport.myspace.com/index.cfm?fuseaction=advertiser.imagesubmission&submissionid=36', 'newWin', 'toolbar=0,width=610,height=800,scrollbars=yes');
                closeAllModalWindows();        
			}
        }
	else
        {
            alert('You must be logged in');
            closeAllModalWindows();            
        }
}
