function OpenShadowbox(Titulo, Pagina, Ancho, Alto){
	Shadowbox.open({
        title:      Titulo,
        type:       'iframe',
        content:    Pagina,
        height:     Alto,
        width:      Ancho
    });
}

function onSubmitForm() {
    var formDOMObj = document.frmSend;
    if (formDOMObj.attach1.value == "" && formDOMObj.attach2.value == "" && formDOMObj.attach3.value == "" && formDOMObj.attach4.value == "" )
		{
			alert("Por favor ingrese al menos un archivo...")
		}
    else
		{
			document.getElementsByTagName("body")[0].style.cursor="wait";
			document.getElementById('wait').style.visibility='visible';
			return true;
		}
    return false;
}

function CambiarValorBIT(objCheckbox) {
	if (objCheckbox.value == '1') {
		objCheckbox.value = '0';
	} else	{
		objCheckbox.value = '1';			
	}
}

function cambiar_estilo(objeto, nombre_estilo, estilo_restaurar) {
	if (objeto) {
		if (document.getElementById(objeto).className == nombre_estilo) {
				document.getElementById(objeto).className = estilo_restaurar;
			}
		else {
				document.getElementById(objeto).className = nombre_estilo;
		}
	}
}

function seleccionarTodos(objeto) {
	var i;
	var f = document.form;
	for(i=0;i<f.elements.length;i++)
	{
		e = f.elements[i];

		if (e.type == 'checkbox' && e.name == objeto) {
			e.checked =f.chkTodos.checked;
		}

	}
}

function seleccionarTodosTR(objeto, tr_prefijo, tr_estilo, tr_estilo_restaurar) {
	var i;
	var f = document.form;
	for(i=0;i<f.elements.length;i++)
	{
		e = f.elements[i];

		if (e.type == 'checkbox' && e.name == objeto) {
			e.checked = f.chkTodos.checked;

			if (e.checked) {
				document.getElementById(tr_prefijo + e.value).className = tr_estilo;
			} else {
				document.getElementById(tr_prefijo + e.value).className = tr_estilo_restaurar;
			}
		}

	}
}

function marqueeStop(){
	document.getElementById("marq").stop();
}

function radioonline() {
	javascript:ow('/contenidos/radio.asp','radio','280','270');	
}

function marqueePlay(){
	document.getElementById("marq").start();
}

function ocultar_todos(mascara) {
	document.getElementById('menu_socios').className = 'menu01';
	document.getElementById(obj + '_links').style.display = 'block';
}

function flash_banners(movie, w, h, flashvars, transparent) {
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">');
	document.write ('	<param name="movie" value="'+ movie +'">');
	document.write ('	<param name="quality" value="high">');
	document.write ('	<param name="flashvars" value="'+ flashvars +'">');
	document.write ('	<param name="scale" value="exactfit">');
	document.write ('	<param name="menu" value="0">');
	document.write ('	<param name="wmode" value="'+ transparent +'">');
	document.write ('	<embed src="'+ movie +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ w +'" height="'+ h +'"></embed>');
	document.write ('</object>');
}

function flash(movie, w, h, flashvars, transparent) {
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">');
	document.write ('	<param name="movie" value="'+ movie +'">');
	document.write ('	<param name="quality" value="high">');
	document.write ('	<param name="flashvars" value="'+ flashvars +'">');
	document.write ('	<param name="menu" value="0">');
	document.write ('	<param name="scale" value="noscale">');
	document.write ('	<param name="wmode" value="'+ transparent +'">');
	document.write ('	<embed src="'+ movie +'" flashvars="'+ flashvars +'" wmode="'+ transparent +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ w +'" height="'+ h +'"></embed>');
	document.write ('</object>');
}

function video(valor, imagen) {
	document.write ('<OBJECT width="320" height="270" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
	document.write ('<PARAM NAME="FileName" VALUE="'+ valor +'">');
	document.write ('<PARAM NAME="ShowControls" VALUE="1">');
	document.write ('<PARAM NAME="ShowDisplay" VALUE="0">');
	document.write ('<PARAM NAME="ShowStatusBar" VALUE="1">');
	document.write ('<PARAM NAME="AutoSize" VALUE="0">');
	document.write ('<Embed type="application/x-mplayer2" name="NSPLay" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="'+ valor +'" src="'+ imagen +'"></embed>');
	document.write ('</OBJECT>');
}

function radio(valor) {
	document.write ('<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" name=MC1 id=MC1 height=70 width=280 bbclient=1>');
	document.write ('<param name="FileName" value="'+ valor +'">');
	document.write ('<param name="AutoStart" value="True">');
	document.write ('<param name="ShowStatusBar" value="True">');
	document.write ('<param name="ShowGotoBar" value="False">');
	document.write ('<param name="TransparentAtStart" value="True">');
	document.write ('<embed type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/windows/windowsmedia/en/Download/default.asp?tcode=9#location2"');
	document.write ('src="'+ valor +'"');
	document.write ('name="MC1"');
	document.write ('height=45');
	document.write ('width=284');
	document.write ('autostart=True');
	document.write ('showstatusbar=True');
	document.write ('showgotobar=False');
	document.write ('transparentatstart=True');
	document.write ('bbclient=0>');
	document.write ('<noembed></noembed>');
	document.write ('</embed>');
	document.write ('</object>');
}

function o(td) {
	td.style.backgroundColor='';
}
function h(td) {
	td.style.backgroundColor='F0F0F0'; td.style.cursor="pointer";
}

function hrf(url) {
	document.location.href = url;
}

function ow(page, name, w, h) {
  window.open(page,name,"resizable=0,width="+w+",height="+h+",left=10,top=10,scrollbars=no");
}

function ows(page, name, w, h) {
  window.open(page,name,"resizable=0,width="+w+",height="+h+",left=50,top=50,scrollbars=yes");
}

function hrf(url) {
	document.location.href = url;
}

function foco(obj) {
	if (obj) { obj.focus(); }
}

function confirmar(url, mensaje) {
	if ( confirm(mensaje) )
	document.location.href = url;
}

function clock() {
if (!document.layers && !document.all) return;
var digital = new Date();
	var hours = digital.getHours();
	var minutes = digital.getMinutes();
	var seconds = digital.getSeconds();
	var amOrPm = "AM";
	if (hours > 11) amOrPm = "PM";
	if (hours > 12) hours = hours - 12;
	if (hours == 0) hours = 12;
	if (minutes <= 9) minutes = "0" + minutes;
	if (seconds <= 9) seconds = "0" + seconds;
	dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;

var months = new Array(13);
	months[1]="Enero";
	months[2]="Febrero";
	months[3]="Marzo";
	months[4]="Abril";
	months[5]="Mayo";
	months[6]="Junio";
	months[7]="Julio";
	months[8]="Augosto";
	months[9]="Septiembre";
	months[10]="Octubre";
	months[11]="Noviembre";
	months[12]="Diciembre";

var time = new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)    
	year = year + 1900;

if (document.layers) {
	document.layers.pendule.document.write(dispTime);
	document.layers.pendule.document.close();
}
else
if (document.getElementById('pendule'))
	document.getElementById('pendule').innerHTML = date + " de " + lmonth + " de " + year + " - " + dispTime;
	setTimeout("clock()", 1000);
}

function cargar_combo(file, sql, name, value, cid, cnm, rq, sel, nuevo){
	var scriptTag = document.getElementById('loadScript');
	var head = document.getElementsByTagName('head').item(0);
	script		= document.createElement('script');
	script.src	= file+'?cid='+cid+'&cnm='+cnm+'&sql='+sql+'&sel='+sel+'&vl='+value+'&rq='+rq+'&name='+name+'&nuevo='+nuevo;
	script.type = 'text/javascript';
	script.id	= 'loadScript';
	head.appendChild(script);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function cargar_submenu(valor) {
	cargar_combo('/includes/rs.asp', 'sp_submenu', 'submenu', valor, 'id', 'name', '', 'Selecciones uno...', '');
}

function resize() {
	if (document.images[0]) window.resizeTo(document.images[0].width +10, document.images[0].height+35);
		self.focus();
	}


function background_change() {
	var speed = 1000
	var Pic	= new Array()
		Pic[0] = '/images/home_top_central01.jpg'
		Pic[1] = '/images/home_top_central02.jpg'
		Pic[2] = '/images/home_top_central03.jpg'
	
		var t
		var j = 0
		var p = Pic.length
		
		var preLoad = new Array()
		for (i = 0; i < p; i++){
		   preLoad[i] = new Image()
		   preLoad[i].src = Pic[i]
		}
	
		function runBGSlideShow(){
		   if (document.all.topfondo){
				document.all.topfondo.background = Pic[j];
				j = j + 1
		   if (j > (p-1)) j=0
			   t = setTimeout('runBGSlideShow()', speed)
		   }
		}
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	else
		countfield.value = maxlimit - field.value.length;
}