// MySpace Useful Javascript Functions - Written by Richard Francis (UK)
// Email rfrancis@myspace.com for any assistance

// Create objects and vars
var videoVars = new Object();


// ========= VIDEO FUNCTIONS ==========

// Create MySpace video player
function vid(divid, vidid, autoPlay) {
	// Check that the name does not conflict
		if(autoPlay==true){
			aplay='1';
		}else{
			aplay='0';
		}
		// Create the code
		vidcode='<div id="videoright" class="pad15"><img src="http://creative.myspacecdn.com/fr/myspacefrance/images/fleche.gif" height="14" width="7" />'+divid+'<div id="video"><embed type="application/x-shockwave-flash" src="http://mediaservices.myspace.com/services/media/embed.aspx/m='+vidid+',t=1,mt=video,ap='+aplay+'" bgcolor="#000000" quality="high" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" flashvars="e=http%3A//vids.myspace.com/&primaryColor=0xFFFFFF&secondaryColor=0xFFFFFF&sr=0" height="277" width="535"></div></div>';
		document.write(vidcode);
	}
/*<div id="videoright" class="pad15">
            	<img src="images/fleche.gif" height="14" width="7" />Comment customiser ta page d'accueil
                <div id="video"><object width="535px" height="277px" ><param name="allowFullScreen" value="true"/><param name="wmode" value="transparent"/><param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m=56278451,t=1,mt=video"/><embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=56278451,t=1,mt=video" width="535" height="277" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed></object></div>
            </div>*/
// Change video in existing player
function changeVid(divid, newvidid, autoPlay){
	// Check that the target exists
		if(autoPlay==true){
			aplay='1';
		}else{
			aplay='0';
		}
		// Create the code
		document.getElementById("videoright").innerHTML = '<img src="http://creative.myspacecdn.com/fr/myspacefrance/images/fleche.gif" height="14" width="7" />'+divid+'<div id="video"><embed type="application/x-shockwave-flash" src="http://mediaservices.myspace.com/services/media/embed.aspx/m='+newvidid+',t=1,mt=video,ap='+aplay+'" bgcolor="#000000" quality="high" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" flashvars="e=http%3A//vids.myspace.com/&primaryColor=0xFFFFFF&secondaryColor=0xFFFFFF&sr=0" height="277" width="535"></div>';

}



// Add the current video to profile
function addVid(target) {
	// Check that the target exists
	var newdivid = "myspacevidcontainer_"+target;
	if(!document.getElementById(newdivid)){
		alert("ERROR ENCOUNTERED BY addVid():\nThe target video does not exist");
	}else{
		window.location.href = "http://vids.myspace.com/index.cfm?fuseaction=vids.addToProfileConfirm&videoid="+videoVars[target].vidid;
	}
}


