function g(id) {
	if (document.getElementById) var returnVar = document.getElementById(id);
	else if (document.all) var returnVar = document.all[id];
	else if (document.layers) var returnVar = document.layers[id];
	return returnVar;
}

function cambiarTransparencia(objeto, valor) {
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5) objeto.style.MozOpacity=valor/100;
	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4) objeto.filters.alpha.opacity=valor;
	if (objeto.style.opacity) objeto.style.opacity=valor/100;
}

function playVideo(id,w,h) { // Monta un vídeo de youtube en la capa del lightview
	g("imageContainerVideo").innerHTML=arregarVideoIE6('<object width="'+w+'" height="'+h+'"><param name="movie" value="http://www.youtube.com/v/'+id+'&hl=es&fs=1&rel=0&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+id+'&hl=es&fs=1&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+w+'" height="'+h+'"></embed></object>');
}

function quitaVideo() { // Quita la capa del vídeo
	g("imageContainerVideo").innerHTML='';
}

function arregarVideoIE6(embedCode) {
	if(embedCode && embedCode.toLowerCase().indexOf('classid') == -1) {
		var objPos = embedCode.toLowerCase().indexOf('object ') + 'object '.length;
		return embedCode.substr(0, objPos) + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' + embedCode.substr(objPos);
	} else return embedCode;
}
