//Ancho de la imagen del banner, en pixeles.
var imgAncho = 110 

//este es el mensaje a visualizar,esta permitido incluir etiquetas html.
var message=""
var message2=""

var src_width=window.screen.width;
if(src_width >=1024){
	/*message='<table cellspacing="0" cellpadding="0" width="'+imgAncho+'" border="0" id="tabla" >'
	message+='<tr>'
	message+='<td align="left"><img src="themes/default/img/publicidad.jpg" alt="Publicidad Movil" id="logo" width="110px"></td>'
	message+='</tr></table>'*/
	
	message =""
	message2=""
}
else
{
	message1=""
	message2=""
}
	

//color en Hexa, que es usado de fondo para el mensaje.
var backgroundcolor=""

//Ingrese 1 para desplegar siempre, 2 mostrar 1 vez por session
var displaymode=1

//Minutos de duraccion en que se muestra el mensaje, en segundos (10000=10 segundos, 0=permanente)
var displayduration=0

//Ingrese 0 para mensaje no-parpadeante, 1 para parpadear.
var flashmode=0

//Si selecciono mensaje parpadeante, seleccione el color.
var flashtocolor="lightblue"

///////////No edite estas lineas, a menos que sepa muy bien lo que esta haciendo//////////////
var ie=document.all
var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1

function regenerate(){
window.location.reload()
}

function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",400)
}

var which=0

function flash(){
if (which==0){
if (document.layers)
topmsg_obj.bgColor=flashtocolor
else
topmsg_obj.style.backgroundColor=flashtocolor
which=1
}
else{
if (document.layers)
topmsg_obj.bgColor=backgroundcolor
else
topmsg_obj.style.backgroundColor=backgroundcolor
which=0
}
}

if (ie||document.getElementById)
document.write('<div id="topmsg" style="position:absolute;visibility:hidden">'+message+'</div>')
document.write('<div id="topmsg2" style="position:absolute;visibility:hidden">'+message2+'</div>')

var topmsg_obj=ie? document.all.topmsg : document.getElementById? document.getElementById("topmsg") : document.topmsg
var topmsg_obj2=ie? document.all.topmsg2 : document.getElementById? document.getElementById("topmsg2") : document.topmsg2

function positionit(){
var dsocleft=ie? document.body.scrollLeft : pageXOffset
var dsoctop=ie? document.body.scrollTop : pageYOffset 
var window_width=ieNOTopera? document.body.clientWidth : window.innerWidth-20
var window_height=ieNOTopera? document.body.clientHeight : window.innerHeight


if (ie||document.getElementById){
	//Obtener el top y left del DIV topmeg en IE
//topmsg_obj.style.left=parseInt(dsocleft)+window_width/2-topmsg_obj.offsetWidth/2
//topmsg_obj.style.top=parseInt(dsoctop)+parseInt(window_height)-topmsg_obj.offsetHeight-4
topmsg_obj.style.left=window_width-imgAncho
topmsg_obj.style.top=parseInt(dsoctop)

topmsg_obj2.style.left=0
topmsg_obj2.style.top=parseInt(dsoctop)
}
else if (document.layers){
		//Obtener el top y left del DIV topmeg en Browser No IE
//topmsg_obj.left=dsocleft+window_width/2-topmsg_obj.document.width/2
//topmsg_obj.top=dsoctop+window_height-topmsg_obj.document.height-5
topmsg_obj.left=window_width-imgAncho
topmsg_obj.top=dsoctop

topmsg_obj2.left=0
topmsg_obj2.top=dsoctop
}
}

function setmessage(){
	
//Rutinas Para Menu Vertical Drop Down
if (document.all&&document.getElementById) {
var menus= new Array(1);
menus[0]='navh';
menus[1]='navv';


for(x=0;x<menus.length;x++){
	//Recorrer los menus
	try{
		navRoot = document.getElementById(menus[x]);

		//===========cargar eventos================
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			node.onmouseover=function() {
				try {
					this.lastChild.style.visibility = 'visible';
				}
				catch (ex)
				{
					//alert(ex.description);
				}				
			}
			node.onmouseout=function() {
				try {
					this.lastChild.style.visibility = 'hidden';
				}
				catch (ex)
				{
					//alert(ex.description);
				}
		   }
		   }
		  } //End for
		
		//===========fin cargar eventos============
	}
	catch(ex)
	{
		//alert(ex.description);
	}
		
} //End for


 } //End if
 
//Fin Rutionas Menu.

//Resolcuion de pantalla
var screen_width=window.screen.width;
	
//Si la pantalla es igual o Mayor a 1024px
if(screen_width>1024||screen_width==1024){
	//Desplegamos el Banner.
if (displaymode==2&&(!display_msg_or_not()))
return
if (document.layers){
topmsg_obj=new Layer(window.innerWidth)
topmsg_obj.bgColor=backgroundcolor

topmsg_obj2=new Layer(window.innerWidth)
topmsg_obj2.bgColor=backgroundcolor

regenerate2()
topmsg_obj.document.write(message)
topmsg_obj.document.close()

topmsg_obj2.document.write(message2)
topmsg_obj2.document.close()

positionit()
topmsg_obj.visibility="show"
topmsg_obj2.visibility="show"

if (displayduration!=0)
setTimeout("topmsg_obj.visibility='hide'",displayduration)
setTimeout("topmsg_obj2.visibility='hide'",displayduration)
}
else{
positionit()
topmsg_obj.style.backgroundColor=backgroundcolor
topmsg_obj.style.visibility="visible"

topmsg_obj2.style.backgroundColor=backgroundcolor
topmsg_obj2.style.visibility="visible"

if (displayduration!=0)
setTimeout("topmsg_obj.style.visibility='hidden'",displayduration)

setTimeout("topmsg_obj2.style.visibility='visible'",displayduration)

}
setInterval("positionit()",100)
if (flashmode==1)
setInterval("flash()",1000)
} //End if Resolucion pantalla.
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function display_msg_or_not(){
if (get_cookie("displaymsg")==""){
document.cookie="displaymsg=yes"
return true
}
else
return false
}

if (document.layers||ie||document.getElementById)
window.onload=setmessage;
