// **************************************************************************************
// MIcrosite.js
//
// Funciones que abren una ventan con los parametros especificos
// **************************************************************************************


var win;

//==============================================================
// Función genrica que abre una ventana con los parametros 
// especificos que se le pasan.
//==============================================================
function abrirWindows(sName,sUrl,sWidth,sHeight,sLeft,sTop,sSettings)
{
	if(sWidth=='') sWidth=200;
	if(sHeight=='') sHeight=200;
	if(sLeft=='') sLeft=10;
	if(sTop=='') sTop=10;	
	
	settings = "width="+sWidth+",height="+sHeight+",left="+sLeft+",top="+sTop;
	if(sSettings!='')
		settings = ","+settings;
	if(win)
		win.close();
	window.focus();
	win	= window.open(sUrl,sName,settings);
}

//==============================================================
// Función que carga una url 
//==============================================================

//==============================================================
// Función que carga una url en la ventana padre si existe 
// la ventana 
//==============================================================
function abrirEnOpener2(path) {
	cargarPath(path);
}

//==============================================================
// Función que carga una url en la ventana padre si existe 
// la ventana 
//==============================================================
function abrirEnOpener(sUrl) {
	if (window.opener && !window.opener.closed){
		window.opener.location.href = sUrl;
		window.opener.focus();
	}
	else if (parent.opener && !parent.opener.closed){
		parent.opener.location.href = sUrl;
		parent.opener.focus();
	}
	else{
		abrirWindows(sm_opener,sUrl,'','','','','');		
	}
}





//==================================================
// Función que abre un microsite
//==================================================
function abrirMicrosite(sUrl) {
	var width	= 795;
	var TopP	= 0;
	var height	= (screen.width<=800)?330:550;
	var LeftP 	= (screen.width)? (screen.width-width)/2 : 0;
	var Settings	= "fullscreen=no,toolbar=yes,location=yes,directories=no,"+
			  "status=no,menubar=no,scrollbars=yes,resizable=yes,"+
			  "width="+width+",height="+height+",left="+LeftP+",top="+TopP+""; 

	abrirWindows('',sUrl,width,height,LeftP,TopP,Settings);			  
}

function microsite(url){
	abrirMicrosite(url);
}

//==================================================
// Abre un banner 
//==================================================
function abrirBanner(nombre, sUrl) {	
	var width	= 795;
	var height	= 500;
	var TopP	= 0;
	var LeftP 	= (screen.width) ? (screen.width-width)/2 : 0;
	var Settings	= "fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,"+
			  "scrollbars=no,resizable=no,width="+width+",height="+height+",left="+LeftP+",top="+TopP;
	abrirWindows(nombre,sUrl,width,height,LeftP,TopP,Settings);			  		
}

//==================================================
// Abre un Popup
//==================================================
function abrirPopup(sUrl){
	var width	= 380;
	var height	= 350;
	var TopP	= 250;
	var LeftP 	= 250;
	var Settings	= "width="+width+",height="+height+",left="+LeftP+",top="+TopP+",scrollbars=no";
	abrirWindows('',sUrl,width,height,LeftP,TopP,Settings);
}


 //==================================================
// Abre un Popup II
//==================================================

 function abrirPopup2(url)
 {
 	var width = 560;
 	var height = 475;
 	var left = 250;
 	var top = 250;
 	var name = "";
 
 	var settings = "width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=no";
 
 	window.open(url,name,settings);
 }
