// POPUP
function Popup(url,name,width,height,resize,scroll) {
var dialogWin = new Object();
dialogWin.width = width;
dialogWin.height = height;
now = new Date();
var millis=now.getTime();
var mstr=""+millis;
if (navigator.appName == "Netscape") {
dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
} else if (document.all) {
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=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
}
window.open(url,name,attr);
}

var num=Math.floor (Math.random()*1000000);
function popupimprimir(p, l, t, w, h) {
 var windowprops = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no" + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
 var URL = p;
 popup = window.open(URL,"MenuPopup1",windowprops);
}

// VENTANA POPUP MANANTIALES//

var num=Math.floor (Math.random()*1000000);
function popupvivo(p, l, t, w, h) {
 var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no" + ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
 var URL = p;
 popup = window.open(URL,"MenuPopup2",windowprops);
}

//Popup CHAT BAHIADIGITAL

function popUpChat(url){
	window.open(url,"pop","width=640,height=540,toolbars=0,scrollbars=0")
}

	//Popup PRINT NOTICIA
function popUpPrint(url){
	window.open(url,"pop","width=600,height=500,toolbars=0,scrollbars=1")
}

	//Popup SEND ENVIAR A UN AMIGO
function popUpSend(url){
	window.open(url,"pop","width=400,height=250,toolbars=0,scrollbars=0")
}

	//Popup PADRON
function popUpPadron(url){
	window.open(url,"pop","width=800,height=450,toolbars=0,scrollbars=1")
}

	//Popup MAPA RECORRIDO COLECTIVOS
function popUpColectivos(url){
	window.open(url,"pop","width=810,height=610,toolbars=0,scrollbars=0")
}

// DETECCION DE BROWSER
var BrowserName=navigator.appName;
var BrowserVersn = parseInt(navigator.appVersion);

if ((BrowserName == "Microsoft Internet Explorer") && (BrowserVersn >= 4)) {
//do nothing
}
else if ((BrowserName == "Netscape") && (BrowserVersn >= 5)) {
//do nothing
}
else if ((BrowserName == "Opera") && (BrowserVersn >= 5)) {
//do nothing
}
else if ((BrowserName == "Mozilla") && (BrowserVersn >= 4)) {
//do nothing
}
else {
Popup('/img/msg/nocompatible.html','nocompatible',400,350,'no','no');
// window.location.href="/img/msg/nocompatible.html";
}


// que sera //
function GoToUrl(combo){
	window.location=combo.options[combo.selectedIndex].value;
}



// SOLUCION FLASH //

function runSWF(archivo, ancho, alto, version, bgcolor, id,idm, menu, FlashVars, quality, allowScriptAccess) {
  if(version!=""){
  	var version_data=version;
  }else{
  	var version_data="6,0,0,0";
  }
  
  if(menu!=""){
  	menu_data=menu;
  }else{
  	menu_data=false;
  }
  if(bgcolor!=""){
  	var bgcolor_data=bgcolor;
  }else{
  	var bgcolor_data="#FFFFFF";
  }
  if(id!=""){
  	id_data=id;
  }else{
  	id_data="flashMovie";
  }
  if(quality!=""){
  	quality_data=quality;
  }else{
  	quality_data="high";
  }
  if(allowScriptAccess!=""){
  	allowScriptAccess_data=allowScriptAccess;
  }else{
  	allowScriptAccess_data="always";
  }
  
  var quality="high"; 
  
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version_data+'" width='+ancho+' height='+alto+' id='+id_data+'>\n');
  document.write('<param name="movie" value='+archivo+'>\n');
  document.write('<param name="allowScriptAccess" value='+allowScriptAccess_data+'>\n');
  document.write('<param name="quality" value='+quality_data+'>\n');
  document.write('<param name="FlashVars" value='+FlashVars+'>\n');
  document.write('<param name="bgcolor" value='+bgcolor_data+'>\n');
  document.write('<param name="menu" value='+menu_data+' >\n');
  document.write('<param name="wmode" value="transparent" >\n');
  document.write('<embed src='+archivo+' bgcolor='+bgcolor_data+' FlashVars='+FlashVars+' menu='+menu_data+' allowScriptAccess='+allowScriptAccess_data+' quality='+quality_data+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+' swLiveConnect=true id='+idm+' wmode="transparent" ></embed>');
  document.write('</object>\n');
}

//REPRODUCTOR MP3


var wimpySwf = "http://bahiadigital.com.ar/bahiadigital_audioplayer.swf";
function writeWimpyButton(theFile, wimpyWidth, wimpyHeight, wimpyConfigs){
	var myid = Math.round((Math.random()*1000)+1);
	var flashCode = "";
	var newlineChar = "\n";
	flashCode += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" width="'+wimpyWidth+'" height="'+wimpyHeight+'" id="wimpybutton'+myid+'">'+newlineChar;
	flashCode += '<param name="movie" value="'+wimpySwf+'" />'+newlineChar;
	flashCode += '<param name="loop" value="false" />'+newlineChar;
	flashCode += '<param name="menu" value="false" />'+newlineChar;
	flashCode += '<param name="quality" value="high" />'+newlineChar;
	flashCode += '<param name="wmode" value="transparent" />'+newlineChar;
	flashCode += '<param name="flashvars" value="theFile='+theFile+wimpyConfigs+'" />'+newlineChar;
	flashCode += '<embed src="'+wimpySwf+'" width="'+wimpyWidth+'" height="'+wimpyHeight+'" flashvars="theFile='+theFile+wimpyConfigs+'" wmode="transparent" loop="false" menu="false" quality="high" name="wimpybutton'+myid+' align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'+newlineChar;
	//document.write('<br><textarea name="textarea" cols="40" rows="10">'+flashCode+'</textarea><br>')+newlineChar;
	document.write(flashCode);
}

// VENTANA POPUP FUTBOL
function futbol()
{
window.open('http://www.bahiadigital.com/noticias/deportes/futbol/index.html','mywindow','width=490,height=380,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
}

// BANNER EXPANDIBLE ROLLOVER 792x40-300

    function setFlashWidth(divid, newW){
 document.getElementById(divid).style.width = newW+"px";
    }

    function setFlashHeight(divid, newH){
 document.getElementById(divid).style.height = newH+"px";
    }


/* SPRYMENU BAR */

var Spry;
if(!Spry)
{
	Spry = {};
}
if(!Spry.Widget)
{
	Spry.Widget = {};
}

// Constructor for Menu Bar
// element should be an ID of an unordered list (<ul> tag)
// preloadImage1 and preloadImage2 are images for the rollover state of a menu
Spry.Widget.MenuBar = function(element, opts)
{
	this.init(element, opts);
};

Spry.Widget.MenuBar.prototype.init = function(element, opts)
{
	this.element = this.getElement(element);

	// represents the current (sub)menu we are operating on
	this.currMenu = null;

	var isie = (typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE');
	if(typeof document.getElementById == 'undefined' || (navigator.vendor == 'Apple Computer, Inc.' && typeof window.XMLHttpRequest == 'undefined') || (isie && typeof document.uniqueID == 'undefined'))
	{
		// bail on older unsupported browsers
		return;
	}

	// load hover images now
	if(opts)
	{
		for(var k in opts)
		{
			var rollover = new Image;
			rollover.src = opts[k];
		}
	}

	if(this.element)
	{
		this.currMenu = this.element;
		var items = this.element.getElementsByTagName('li');
		for(var i=0; i<items.length; i++)
		{
			this.initialize(items[i], element, isie);
			if(isie)
			{
				this.addClassName(items[i], "MenuBarItemIE");
				items[i].style.position = "static";
			}
		}
		if(isie)
		{
			if(this.hasClassName(this.element, "MenuBarVertical"))
			{
				this.element.style.position = "relative";
			}
			var linkitems = this.element.getElementsByTagName('a');
			for(var i=0; i<linkitems.length; i++)
			{
				linkitems[i].style.position = "relative";
			}
		}
	}
};

Spry.Widget.MenuBar.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
};

Spry.Widget.MenuBar.prototype.hasClassName = function(ele, className)
{
	if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
	{
		return false;
	}
	return true;
};

Spry.Widget.MenuBar.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || this.hasClassName(ele, className))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.MenuBar.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || !this.hasClassName(ele, className))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

// addEventListener for Menu Bar
// attach an event to a tag without creating obtrusive HTML code
Spry.Widget.MenuBar.prototype.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
		{
			element.addEventListener(eventType, handler, capture);
		}
		else if (element.attachEvent)
		{
			element.attachEvent('on' + eventType, handler);
		}
	}
	catch (e) {}
};

// createIframeLayer for Menu Bar
// creates an IFRAME underneath a menu so that it will show above form controls and ActiveX
Spry.Widget.MenuBar.prototype.createIframeLayer = function(menu)
{
	var layer = document.createElement('iframe');
	layer.tabIndex = '-1';
	layer.src = 'javascript:false;';
	menu.parentNode.appendChild(layer);
	
	layer.style.left = menu.offsetLeft + 'px';
	layer.style.top = menu.offsetTop + 'px';
	layer.style.width = menu.offsetWidth + 'px';
	layer.style.height = menu.offsetHeight + 'px';
};

// removeIframeLayer for Menu Bar
// removes an IFRAME underneath a menu to reveal any form controls and ActiveX
Spry.Widget.MenuBar.prototype.removeIframeLayer =  function(menu)
{
	var layers = menu.parentNode.getElementsByTagName('iframe');
	while(layers.length > 0)
	{
		layers[0].parentNode.removeChild(layers[0]);
	}
};

// clearMenus for Menu Bar
// root is the top level unordered list (<ul> tag)
Spry.Widget.MenuBar.prototype.clearMenus = function(root)
{
	var menus = root.getElementsByTagName('ul');
	for(var i=0; i<menus.length; i++)
	{
		this.hideSubmenu(menus[i]);
	}
	this.removeClassName(this.element, "MenuBarActive");
};

// bubbledTextEvent for Menu Bar
// identify bubbled up text events in Safari so we can ignore them
Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
{
	return (navigator.vendor == 'Apple Computer, Inc.' && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget)));
};

// showSubmenu for Menu Bar
// set the proper CSS class on this menu to show it
Spry.Widget.MenuBar.prototype.showSubmenu = function(menu)
{
	if(this.currMenu)
	{
		this.clearMenus(this.currMenu);
		this.currMenu = null;
	}
	
	if(menu)
	{
		this.addClassName(menu, "MenuBarSubmenuVisible");
		if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
		{
			if(!this.hasClassName(this.element, "MenuBarHorizontal") || menu.parentNode.parentNode != this.element)
			{
				menu.style.top = menu.parentNode.offsetTop + 'px';
			}
		}
		if(typeof document.uniqueID != "undefined")
		{
			this.createIframeLayer(menu);
		}
	}
	this.addClassName(this.element, "MenuBarActive");
};

// hideSubmenu for Menu Bar
// remove the proper CSS class on this menu to hide it
Spry.Widget.MenuBar.prototype.hideSubmenu = function(menu)
{
	if(menu)
	{
		this.removeClassName(menu, "MenuBarSubmenuVisible");
		if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
		{
			menu.style.top = '';
			menu.style.left = '';
		}
		this.removeIframeLayer(menu);
	}
};

// initialize for Menu Bar
// create event listeners for the Menu Bar widget so we can properly
// show and hide submenus
Spry.Widget.MenuBar.prototype.initialize = function(listitem, element, isie)
{
	var opentime, closetime;
	var link = listitem.getElementsByTagName('a')[0];
	var submenus = listitem.getElementsByTagName('ul');
	var menu = (submenus.length > 0 ? submenus[0] : null);

	var hasSubMenu = false;
	if(menu)
	{
		this.addClassName(link, "MenuBarItemSubmenu");
		hasSubMenu = true;
	}

	if(!isie)
	{
		// define a simple function that comes standard in IE to determine
		// if a node is within another node
		listitem.contains = function(testNode)
		{
			// this refers to the list item
			if(testNode == null)
			{
				return false;
			}
			if(testNode == this)
			{
				return true;
			}
			else
			{
				return this.contains(testNode.parentNode);
			}
		};
	}
	
	// need to save this for scope further down
	var self = this;

	this.addEventListener(listitem, 'mouseover', function(e)
	{
		if(self.bubbledTextEvent())
		{
			// ignore bubbled text events
			return;
		}
		clearTimeout(closetime);
		if(self.currMenu == listitem)
		{
			self.currMenu = null;
		}
		// show menu highlighting
		self.addClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
		if(menu && !self.hasClassName(menu, "MenuBarSubmenuVisible"))
		{
			opentime = window.setTimeout(function(){self.showSubmenu(menu);}, 250);
		}
	}, false);

	this.addEventListener(listitem, 'mouseout', function(e)
	{
		if(self.bubbledTextEvent())
		{
			// ignore bubbled text events
			return;
		}

		var related = (typeof e.relatedTarget != 'undefined' ? e.relatedTarget : e.toElement);
		if(!listitem.contains(related))
		{
			clearTimeout(opentime);
			self.currMenu = listitem;

			// remove menu highlighting
			self.removeClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
			if(menu)
			{
				closetime = window.setTimeout(function(){self.hideSubmenu(menu);}, 600);
			}
		}
	}, false);
};


/* TAMAŅO FUENTES 2 */

function changeSize(number,number) { if (document.all) { element = document.all['textbody']; }else{ element = document.getElementById('textbody'); } var startSize = 12; var rateSize = 3; var numRate = 5; var startSizeLine = 15; var rateSizeLine = 3; var numRateLine = 5; var strActual = element.style.fontSize; var strLineActual = element.style.lineHeight; var intActual = parseInt(strActual.substring(0, strActual.indexOf("px"))); var intLineActual = parseInt(strLineActual.substring(0, strLineActual.indexOf("px"))); intActual += number; intLineActual += number; if (intActual < (startSize + ( (numRate + 1) * rateSize) ) && intActual > startSize-1){ element.style.fontSize = intActual + "px"; } if (intLineActual < (startSizeLine + ( (numRateLine + 1) * rateSizeLine) ) && intLineActual > startSizeLine-1){ element.style.lineHeight = intLineActual + "px"; } } function normalSize(){ var strActual = element.style.fontSize; var strLineActual = element.style.lineHeight; var intActual = 12; var intLineActual = 15; element.style.fontSize = intActual + "px"; element.style.lineHeight = intLineActual + "px"; } 
