function Popup(url,name,width,height,resize,vp_scroll) {
	var dialogWin = new Object();
	dialogWin.width = width;
	dialogWin.height = height;
	dialogWin.left = (screen.width - dialogWin.width) / 2;
	dialogWin.top = (screen.height - dialogWin.height) / 2;
	var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + vp_scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	ventana = window.open(url,name,attr);
	if (parseInt(navigator.appVersion) >= 4) {ventana.window.focus();}
};

function PopupVideo(titulo,codigo,width,height,mostrar) {
	var popup = document.getElementById("popUpVideo");
	if (mostrar){
	popup.innerHTML ='<div id="barraAdMotion"><a href="javascript:PopupVideo();">[X]</a>&nbsp;</div><br clear="all" />';
	popup.innerHTML += codigo; 
	popup.style.top = Scroll() + 80 + "px";
	popup.style.left = 130 + "px";
	popup.style.display="block"; 	
	}
	else 
	{
		popup.innerHTML = "";
		popup.style.display = "none"; 	
		popup.style.width = "";
	}
	};
	
//arrastrar el video por la pantalla
var dragobject={
z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
initialize:function(){
document.onmousedown=this.dragAdMotion
document.onmouseup=function(){this.dragapproved=0}
},
dragAdMotion:function(e){
var evtobj=window.event? window.event : e
this.targetobj=window.event? event.srcElement : e.target
if (this.targetobj.className=="dragAdMotion"){
this.dragapproved=1
this.offsetx=parseInt(this.targetobj.style.left)
this.offsety=parseInt(this.targetobj.style.top)
this.x=evtobj.clientX
this.y=evtobj.clientY
if (evtobj.preventDefault)
evtobj.preventDefault()
document.onmousemove=dragobject.moveit
}
},
moveit:function(e){
var evtobj=window.event? window.event : e
if (this.dragapproved==1){
if (this.offsetx+evtobj.clientX-this.x>0)
	this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
else
	this.targetobj.style.left=0+"px"
if (this.offsety+evtobj.clientY-this.y>0)
	this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
else
	this.targetobj.style.top=0+"px"

return false
}
}
}
dragobject.initialize()

function limpiarString(str)
{
while (str.indexOf('"')!='-1') //mientras no llegue al final del string
	{
		str = str.replace('"','&quot;'); //reemplazo las comillas por su equivalente html
	}
	return str;
}

function traerObjeto(name)
{
if (navigator.appName.indexOf('Microsoft')!=-1)
	return window[name];
else
	return document.getElementById(name);
}

function Scroll()
{
	if (window.innerHeight)
	{
		  pos = window.pageYOffset
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
		pos = document.documentElement.scrollTop
	}
	else if (document.body)
	{
		  pos = document.body.scrollTop
	}
	return pos
}


function mostrar(id){
	objeto = document.getElementById(id);
	objeto.style.visibility="visible";
	}
	
function ocultar(id){
	objeto = document.getElementById(id);
	objeto.style.visibility="hidden";
}
