function jumpbox(formulario,selectbox)
{
//formulario=formulario del select box

var openmode=1
var targetframe="_self"
//var destination=eval("window.parent."+targetframe)
var destination=eval("window.self")
//var thebox=eval("document."+formulario)
var thebox=eval("document."+formulario+"."+selectbox)

//if (openmode==2) destination=window.parent
if (openmode==2) destination=window.self
//destination.location=thebox.tabla.options[thebox.tabla.selectedIndex].value
destination.location=thebox.options[thebox.selectedIndex].value
}

function makeWindow(svFile,svName,svParams)
{
var fileWindow = window.open(""+svFile,""+svName,""+svParams); //ATENCIÓN: svName, sin contener espacios en blanco
}

function jump2url(url,target)
{
//url=url a abrir, target=frame de destino

var openmode=1
var targetframe=target//"_self"
var destination=eval("window."+targetframe)
//var destination=eval("window.self")
//var thebox=eval("document."+formulario)

//if (openmode==2) destination=window.parent
if (openmode==2) destination=window.self
destination.location=url//thebox.tabla.options[thebox.tabla.selectedIndex].value
}

function album(url,params,header,footer,script)
{
//url=álbum a abrir, params=parámetros de la ventana
//header=encabezado de la ventana, footer=pie de la ventana, script=script php a ejecutar

/*var s1 = 
"<html><head>"+
"<title>DAME MUSICA - Descarga</title>"+
"</head>"*/
/*var s1 =
"<iframe src='" + script + "' width=\"1\" height=\"1\" frameborder=\"0\" scrolling=\"no\"></iframe>"*/
var s2 =
"<frameset framespacing=\"0\" border=\"0\" rows=\"1,83,*,79\" frameborder=\"0\">"+
"  <frame name=\"script\" src='" + script + "' scrolling=\"no\">"+
"  <frame name=\"superior\" scrolling=\"no\" target=\"intermedio\" src='" + header + "'>"
var s3 =
"  <frame name=\"intermedio\" target=\"inferior\" src='" + url + "' scrolling=\"auto\">"
/*var s3 =
"<iframe src='" + url + "' width=\"720\" height=\"334\" frameborder=\"0\" scrolling=\"auto\"></iframe>"*/
var s4 =
"  <frame name=\"inferior\" src='" + footer + "' scrolling=\"no\">"+
"  <noframes>"+
"  <body>"+
""+
"  <p>Esta página usa marcos, pero su explorador no los admite.</p>"+
""+
"  </body>"+
"  </noframes>"+
"</frameset>"
/*var s5 =
"</html>"*/

popup = window.open("","popDialog",""+params)
//popup.document.writeln(s1)
popup.document.writeln(s2)
popup.document.writeln(s3+s4)
//popup.document.write(s5)
popup.document.close()
}

function mes(indX,lang) {
      if (lang=='eng') monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
	  else if (lang=='cas') monthNames = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
	  else if (lang=='cat') monthNames = new Array("Gener","Febrer","Març","Abril","Maig","Juni","Juliol","Agost","Setembre","Octubre","Novembre","Desembre");
	  else if (lang=='gal') monthNames = new Array("Xaneiro","Febreiro","Marzo","Abril","Maio","Xuño","Xullo","Agosto","Setembro","Outubro","Novembro","Decembro");
      
	  return monthNames[indX];
}
function diaSemana(indX,lang) {
      if (lang=='eng') dias = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	  else if (lang=='cas') dias = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado")
	  else if (lang=='cat') dias = new Array("Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte");
	  else if (lang=='gal') dias = new Array("Domingo","Luns","Martes","Mércores","Xoves","Venres","Sábado");
      
	  return dias[indX];
}

/* VisualizarFecha(year=2003,month_number=02,day_of_month=04,lang='cas',upper_case=1,format='%w, %d de %m de %y'); //Ejemplo! */
function VisualizarFecha(year,month_number,day_of_month,lang,upper_case,format){
//upper_case=1, mayús.; upper_case=0, minús.
//format='%w, %d de %m de %y'; %w=day_of_week, %d=day_of_month, %m=month, %y=year
	if (year && month_number && day_of_month) date = new Date(year,month_number-1,day_of_month) //fecha por parámetro
	else date = new Date();
	var day_of_week_number = date.getDay();
	/*if (!day_of_month) */var day_of_month = date.getDate();
	/*if (!month_number) */var month_number = date.getMonth();
	/*if (!year) */var year = date.getYear();
	if (year<200) year += 1900;
	var day_of_week = '';
	var month = '' 
	var hours = date.getHours();
	var message = '';
	var date_to_show = '';

	if (hours >= 6) { time_of_day = 'Buenos Días'; message='Morning Message';}
	if ((hours >= 14) && (hours < 21)) { time_of_day = 'Buenas Tardes'; message='Afternoon Message'}
	if (hours >= 21) { time_of_day = 'Buenas Noches'; message='Evening Message';}
	if ((hours >= 0) && (hours < 6)){ time_of_day = 'Buenas Noches'; message='Night Message';}

	/*if(month_number == 0){month = 'enero';}
	if(month_number == 1){month = 'febrero';}
	if(month_number == 2){month = 'marzo';}
	if(month_number == 3){month = 'abril';}
	if(month_number == 4){month = 'mayo';}
	if(month_number == 5){month = 'junio';}
	if(month_number == 6){month = 'julio';}
	if(month_number == 7){month = 'agosto';}
	if(month_number == 8){month = 'septiembre';}
	if(month_number == 9){month = 'octubre';}
	if(month_number == 10){month = 'noviembre';}
	if(month_number == 11){month ='diciembre';}*/
	month = mes(month_number,lang);	
	
	/*if(day_of_week_number == 0){day_of_week = 'Domingo';}
	if(day_of_week_number == 1){day_of_week = 'Lunes';}
	if(day_of_week_number == 2){day_of_week = 'Martes';}
	if(day_of_week_number == 3){day_of_week = 'Miércoles';}
	if(day_of_week_number == 4){day_of_week = 'Jueves';}
	if(day_of_week_number == 5){day_of_week = 'Viernes';}
	if(day_of_week_number == 6){day_of_week = 'Sábado';} */
	day_of_week = diaSemana(day_of_week_number,lang);
	
	format=format.replace('%w',day_of_week); format=format.replace('%d',day_of_month); format=format.replace('%m',month); format=format.replace('%y',year);
	if(format) date_to_show=format
	else
	  if (lang=='cas' || lang=='cat' || lang=='gal') date_to_show=day_of_week+', '+day_of_month+' de '+month+' de '+year
	  else if (lang=='eng') date_to_show=day_of_week+', '+month+' '+day_of_month+', '+year;

	if (upper_case) document.write(date_to_show.toUpperCase())
	else document.write(date_to_show);
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}
function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' debe contener un número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es obligatorio.\n'; }
  } if (errors) alert('Han ocurrido los siguientes errores:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateCheckBox(f, c){
	var thecheck=eval("document."+f+"."+c)
	if (thecheck.checked == false ) {
		alert('- '+thecheck.name+' debe estar marcado.\n'); return false;
	} else return true;
}

/* <BODY OnLoad="javascript:pantallacompleta('http://www.grupo5.com')"> //Ejemplo 1! */
/* <a href="javascript:pantallacompleta('http://www.grupo5.com')">Ver en pantalla completa</a> //Ejemplo 2! */
function pantallacompleta (pagina) 
{
//pagina=página a abrir

var opciones=("toolbar=no, location=no, directories=no, status=no, menubar=no ,scrollbars=no, resizable=no, fullscreen=yes"); 

window.open(pagina,"",opciones);
}

function confirmbox(url)
{
//url=url a abrir

var destination=eval("window.self")

var x=window.confirm("Are you sure you are ok?")
if (x)
destination.location=url//window.alert("Good!")
/*else
window.alert("Too bad")*/
}

function ftpWindow(ftp)
{
//ftp=ftp a abrir

var ancho=470, alto=470;
var obj, estilo='scrollbars=1,menubar=1,toolbar=1,resizable=1,status=1,width='+ancho+',height='+alto+',top=10,left=10';

//alert(ftp);
obj=window.open(ftp,'ftpWindow',estilo);
obj.focus();
}
