﻿
function fncOpen(strId,h,w,sVideo) {

var strParam = playShow1(sVideo,h,w);

var vleft;
//    try{vleft = (document.body.clientWidth -w )/2;} catch (e) {vleft = (document.body.clientWidth )/2}

var vtop;
//    try {vtop  = (document.body.clientHeight - h )/2;} catch (e) {vtop  = (document.body.clientHeight)/2;}

vtop = (xClientHeight() -h )/2 + xScrollTop();
vleft=(xClientWidth() -w)/2;

var objDiv = document.createElement("DIV");
    objDiv.style.position="absolute";   
    objDiv.style.width=w+"px";
    objDiv.style.height=h+"px";
    objDiv.style.left=vleft+"px";
    objDiv.style.top= vtop+"px";
    objDiv.id=strId;
    document.body.appendChild(objDiv);
var strHTML =""
    strHTML +="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    strHTML +="  <tr>"
    strHTML +="    <td class=\"bgflashencab\" align=\"right\"><table width=\"50\" border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"3\" class=\"alignright\">"
    strHTML +="      <tr>"
    strHTML +="        <td width=\"90%\">Cerrar</td>"
    strHTML +="        <td width=\"10%\" align=\"right\"><a href=\"javascript:; fncObjCierra('"+strId+"');\"><img src=\"/publicador/imagenes/cerrar.png\" alt=\"Cerrar\" width=\"16\" height=\"16\" border=0/></a></td>"
    strHTML +="      </tr>"
    strHTML +="    </table></td>"
    strHTML +="  </tr>"
    strHTML +="  <tr>"
    strHTML +="    <td class=\"bgswf\">"+strParam+"</td>"
    strHTML +="  </tr>"
    strHTML +="</table>"

    objDiv.innerHTML =strHTML;
    objDiv= null;
}

function fncObjCierra(strId) {
    var ObjDiv = document.getElementById(strId);
    ObjDiv.parentNode.removeChild(ObjDiv);
}
function showPopUp(sUrl,sFrame,sProperties)
{
	window.open(sUrl,
				isEmpty(sFrame)?"_blank":sFrame,
				isEmpty(sProperties)?"top=80,left=0;width=775,height=550,scrollbars=auto":sProperties);
}

function fsCommand(command,args)
{
	if ( command.tolowerCase() == "popup" ) 
	{ 
		if (args.length&&args.indexOf(";")!=-1)
		{
			var nargs=args.split(";");
			switch(nargs.length)
			{
				case 1:
					showPopUp(nargs[0]);
					break;
				case 2:
					showPopUp(nargs[0],nargs[1]);
					break;
				case 3:
					showPopUp(nargs[0],nargs[1],nargs[2]);
					break;
				case 0:
				default:
					return;;
			}
		}
	} 
}


function topFlash_DoFSCommand(command, args) 
{ 
	fsCommand(command,args);
}


function bannerFlash_DoFSCommand(command, args) 
{ 
	fsCommand(command,args);
}

function isEmpty(val)
{
	return ((val=="")||(val=="null")||(val==null)||(val=="undefined")||(typeof(val)=="undefined"))
}

function fpopupAuto(url,pos_x,pos_y,tam_x,tam_y,prmCompleta)
{	
	
	var vParametros = "";

	url=isEmpty(url)?"":url;
	pos_x=isEmpty(pos_x)?200:pos_x;
	pos_y=isEmpty(pos_y)?200:pos_y;
	tam_x=isEmpty(tam_x)?300:tam_x;
	tam_y=isEmpty(tam_y)?400:tam_y;
	
	if(prmCompleta.toUpperCase()=="SI")
		vParametros = ",location=1,toolbar=1,menubar=1,resizable=1,status=1,titlebar=1,scrollbars=1";
	var wn=window.open(url,"_blank","left="+pos_x+"px, top="+pos_y+"px, width="+tam_x+"px, height="+tam_y+"px" + vParametros);

	//window.open(url,"_blank","resizable=1,left="+pos_x+"px, top="+pos_y+"px, width="+tam_x+"px, height="+tam_y+"px");

}
