// Windows Media Player

function wmpCreate(divId, url) {
	var width = 418;
	var height = 354;
    var str = "";
    if (esIE()) {
		//alert('Internet Explorer');
         // create the WMP for IE
         str = '<object id="contentPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+width+'" height="'+height+'">';
    } else {
		//alert('Navegador de verdad');
         // create it for FF.
         str = '<object id="contentPlayer" type="application/x-ms-wmp" data="'+url+'" width="'+width+'" height="'+height+'">';
    }
    str += '<param name="URL" value="'+url+'" />';
	str += '<param name="autostart" value="1" />';
    str += '<param name="uiMode" value="none">';
    str += '</object>';
    document.getElementById(divId).innerHTML = str;
}

// Uso: document.getElementById('wmpPlayer').innerHTML = wmpCreate('./videos/my_video.wmv');

// This function will run every time the Media changes in Windows Media Player
function wmpMediaChange(item) {

     // get a handle to the Windows Media Player
     var wmp = document.getElementById('contentPlayer');

     // alert the data for convenience
     //alert ( wmp.currentMedia.name );
     //alert ( wmp.currentMedia.sourceURL );

}

function toggleMute(){
	if(!$('contentPlayer').settings.mute){
		$('contentPlayer').settings.mute = true;
	} else {
		$('contentPlayer').settings.mute = false;
	}	
}

function bajarVolumen(){
	var actual = $('contentPlayer').settings.volume;
	$('contentPlayer').settings.volume = actual-20;
}

function subirVolumen(){
	var actual = $('contentPlayer').settings.volume;
	$('contentPlayer').settings.volume = actual+20;
}

function fullscreen(){
	$('contentPlayer').fullScreen = true;
}

var playstateValues = new Array("Undefined","Stopped","Paused","Playing","Scan Forward","Scan Reverse","Buffering","Waiting","Media Ended","Transitioning","Ready","Reconnecting");

// This function will run every time the Play State changes in Windows Media Player
function wmpPlayStateChange(newState) {
     // alert the play state value in plain text for convenience
     //alert ( playstateValues[newState] );
}