var so_video=new Array();
function urlencode(str) {
return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function urldecode(str) {
return unescape(str.replace('+', ' '));
}
function mostra_video(url,es_youtube,autoplay,imagen_video,width,height,div_name,video_id,link_detalle,width_parent,height_parent,imatge_youtube)
{
	var margin_left=0;
	var margin_top=0;
	var medidas_imagen;
	if(width_parent)
	{
		margin_left='margin-left:'+Math.round((width_parent-width)/2)+'px;';
		margin_top='margin-top:'+Math.round((height_parent-height)/2)+'px;';
	}
	else
	{
		margin_left='';
		margin_top='';
	}
	
	so_video[div_name+video_id] = new SWFObject(url, "player", width, height, "9", "", false);
	so_video[div_name+video_id].addParam("wmode", "transparent");
		
	if(es_youtube)
	{
		so_video[div_name+video_id].addVariable("autoplay", autoplay);
        so_video[div_name+video_id].addParam("allowFullScreen", "true");
	}
	else
	{
		so_video[div_name+video_id].addVariable("autostart", autoplay);
		so_video[div_name+video_id].addParam("allowfullscreen","true");
	}
	
		if(imatge_youtube) medidas_imagen=" height=\""+height+"\" width=\""+width+"\" ";
		else medidas_imagen="";
		// Reproduim directament el video
		if(!link_detalle)
		{
			if(imagen_video)
			{
                //document.write("<div class='watermark posicion'><div class='text'><img src='http://fiji/escolavalenciana/app/webroot/img/web/marca.png' height='199px' /></div><img src='http://www.webintenta.com/Files/Images/v8/Watermark/tulips.jpg' width='300' height='199' alt='alt imagen' ></div>");
                document.write('<div id="'+div_name+video_id+'" style="'+margin_left+margin_top+'width:'+width+'px;height:'+height+'px;display: table;#position: relative; overflow: hidden;"><div style=" #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;"><a  href="javascript:void(0);" style="#position: relative; #top: -50%; text-align:center;display:block;width:'+width+'px;" onclick="so_video[\''+div_name+video_id+'\'].write(\''+div_name+video_id+'\')"><div class="watermark" style="width:'+width+'px;margin-top:'+(height/6)+'px"><img src="http://www.escolavalenciana.com/app/webroot/img/web/marca.png" height="140px" width="140px" /></div><img src="'+imagen_video+'" '+medidas_imagen+'></a></div></div>');
                


		
			}
			else
			{
				document.write('<div id="'+div_name+video_id+'" style="'+margin_left+margin_top+'width:'+width+'px;height:'+height+'px;"></div>');
				so_video[div_name+video_id].write(div_name+video_id);
			}
		}
		else
		{
			if(imagen_video)
			{
				document.write('<div id="'+div_name+video_id+'" style="'+margin_left+margin_top+'width:'+width+'px;height:'+height+'px;display: table;#position: relative; overflow: hidden;"><div style=" #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;"><a  href="'+urldecode(link_detalle)+'" style="#position: relative; #top: -50%; text-align:center;display:block;width:'+width+'px;" ><div class="watermark" style="width:'+width+'px;margin-top:'+(height/7)+'px"><img src="http://www.escolavalenciana.com/app/webroot/img/web/marca.png" height="75px" width="75px" /></div><img src="'+imagen_video+'" '+medidas_imagen+'></div></a></div>');
		
			}	
		}
	
}

function overvideo(obj)
{
    var isIE = /*@cc_on!@*/false;
    if(isIE)
        obj.style.filter='alpha(opacity=95)';
    else
        obj.style.opacity=90;
}

function outvideo(obj)
{
    var isIE = /*@cc_on!@*/false;
    if(isIE)
        obj.style.filter='alpha(opacity=100)';
    else
        obj.style.opacity=100;
}
