// JavaScript Document
////////////////////////////////////////////////////////////////////////////////////////

function mostrarInfoAlojamiento(id_alojamiento){
	if(document.getElementById('caracteristicas_'+id_alojamiento).style.visibility=='hidden'){
		document.getElementById('caracteristicas_'+id_alojamiento).style.visibility='visible';
		document.getElementById('caracteristicas_'+id_alojamiento).style.position='static';
		document.getElementById('info_'+id_alojamiento).innerHTML='<strong>-info</strong>';
	}else{
		document.getElementById('caracteristicas_'+id_alojamiento).style.visibility='hidden';
		document.getElementById('caracteristicas_'+id_alojamiento).style.position='absolute';
		document.getElementById('info_'+id_alojamiento).innerHTML='<strong>+info</strong>';
	}
}

function conmutarRegistro(valor){
	if(valor=='SI'){
		document.getElementById('formulario_acceso').style.visibility='visible';
		document.getElementById('formulario_acceso').style.position='static';
		document.getElementById('formulario_registro').style.visibility='hidden';
		document.getElementById('formulario_registro').style.position='absolute';
		
	}else{
		document.getElementById('formulario_acceso').style.visibility='hidden';
		document.getElementById('formulario_acceso').style.position='absolute';
		document.getElementById('formulario_registro').style.visibility='visible';
		document.getElementById('formulario_registro').style.position='static';
	}
	//alert(valor);
}

function ocultarMostrar(tipo,id){
	if(document.getElementById('tabla_'+tipo+'_'+id).style.visibility=='hidden'){
		document.getElementById('tabla_'+tipo+'_'+id).style.visibility='visible';
		document.getElementById('tabla_'+tipo+'_'+id).style.position='relative';
		document.getElementById('guardar_'+tipo+'2_'+id).style.visibility='visible';
		document.getElementById('guardar_'+tipo+'2_'+id).style.position='relative';
		document.getElementById('flecha_'+tipo+'_'+id).src='img2/flecha_blanca_arriba.gif';
	}else{
		document.getElementById('tabla_'+tipo+'_'+id).style.visibility='hidden';
		document.getElementById('tabla_'+tipo+'_'+id).style.position='absolute';
		document.getElementById('guardar_'+tipo+'2_'+id).style.visibility='hidden';
		document.getElementById('guardar_'+tipo+'2_'+id).style.position='absolute';
		document.getElementById('flecha_'+tipo+'_'+id).src='img2/flecha_blanca_abajo.gif';
	}
}

function empresaParticular(tipo){
	if(tipo=='Empresa'){
		document.getElementById('fila_empresa').style.visibility='visible';
		document.getElementById('fila_empresa').style.position='relative';
	}else{
		document.getElementById('fila_empresa').style.visibility='hidden';
		document.getElementById('fila_empresa').style.position='absolute';
	}
		
}

function moveOver_pais(nombre_formulario) {
   var boxLength = document.getElementById(nombre_formulario).pais_sel.length;
   var selectedItem = document.getElementById(nombre_formulario).pais_c.selectedIndex;
   var selectedText = document.getElementById(nombre_formulario).pais_c.options[selectedItem].text;
   var selectedValue = document.getElementById(nombre_formulario).pais_c.options[selectedItem].value;
   var rayas='------';
   var i;
   var isNew = true;
   if (selectedText==rayas)
	   {
         isNew = false;
       }
   if (selectedValue=='0')
	   {
         isNew = false;
       }
   if (boxLength != 0) 
   {
     for (i = 0; i < boxLength; i++) 
	 {
       thisitem = document.getElementById(nombre_formulario).pais_sel.options[i].text;
       if (thisitem == selectedText) 
	   {
         isNew = false;
         break;
       }
     }
   }
   if (isNew) {
     newoption = new Option(selectedText, selectedValue, false, false);
     document.getElementById(nombre_formulario).pais_sel.options[boxLength] = newoption;
   }
   document.getElementById(nombre_formulario).pais_c.selectedIndex=-1;
}

function removeMe_pais(nombre_formulario) {
   var boxLength = document.getElementById(nombre_formulario).pais_sel.length;
   arrSelected = new Array();
   var count = 0;
   for (i = 0; i < boxLength; i++) {
     if (document.getElementById(nombre_formulario).pais_sel.options[i].selected) {
       arrSelected[count] = document.getElementById(nombre_formulario).pais_sel.options[i].value;
     }
     count++;
   }
   var x;
   for (i = 0; i < boxLength; i++) {
     for (x = 0; x < arrSelected.length; x++) {
       if (document.getElementById(nombre_formulario).pais_sel.options[i].value == arrSelected[x]) {
         document.getElementById(nombre_formulario).pais_sel.options[i] = null;
       }
     }
     boxLength = document.getElementById(nombre_formulario).pais_sel.length;
   }
}

function moveOver_idioma(nombre_formulario) {
   var boxLength = document.getElementById(nombre_formulario).idioma_sel.length;
   var selectedItem = document.getElementById(nombre_formulario).idioma_c.selectedIndex;
   var selectedText = document.getElementById(nombre_formulario).idioma_c.options[selectedItem].text;
   var selectedValue = document.getElementById(nombre_formulario).idioma_c.options[selectedItem].value;
   var rayas='------';
   var i;
   var isNew = true;
   if (selectedText==rayas)
	   {
         isNew = false;
       }
   if (selectedValue=='0')
	   {
         isNew = false;
       }
   if (boxLength != 0) {
     for (i = 0; i < boxLength; i++) {
       thisitem = document.getElementById(nombre_formulario).idioma_sel.options[i].text;
       if (thisitem == selectedText) 
	   {
         isNew = false;
         break;
       }
     }
   }
   if (isNew) {
     newoption = new Option(selectedText, selectedValue, false, false);
     document.getElementById(nombre_formulario).idioma_sel.options[boxLength] = newoption;
   }
   document.getElementById(nombre_formulario).idioma_c.selectedIndex=-1;
}

function removeMe_idioma(nombre_formulario) {
   var boxLength = document.getElementById(nombre_formulario).idioma_sel.length;
   arrSelected = new Array();
   var count = 0;
   for (i = 0; i < boxLength; i++) {
     if (document.getElementById(nombre_formulario).idioma_sel.options[i].selected) {
       arrSelected[count] = document.getElementById(nombre_formulario).idioma_sel.options[i].value;
     }
     count++;
   }
   var x;
   for (i = 0; i < boxLength; i++) {
     for (x = 0; x < arrSelected.length; x++) {
       if (document.getElementById(nombre_formulario).idioma_sel.options[i].value == arrSelected[x]) {
         document.getElementById(nombre_formulario).idioma_sel.options[i] = null;
       }
     }
     boxLength = document.getElementById(nombre_formulario).idioma_sel.length;
   }
}

function allSelect(id_campo)
{
  //List= eval ('document.admin_ofertas_categ.sel_producto');	
  List=document.getElementById(id_campo);
  for (i=0;i<List.length;i++)
  {
     List.options[i].selected = true;
  }
}

function Goto(url,ancho,alto) 
{
	
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  	tamX = (myWidth - 575)/2;
	tamY = (myHeight - 425)/2;
	 if(navigator.appName == "Netscape") {
		window.open(url,'win1','height='+alto+',width='+ancho+',screenX='+tamX+',screenY='+tamY+',scrollbars=yes');
	 } 
	 else if( navigator.appName == "Microsoft Internet Explorer") {
	 	window.open(url,'win1','height='+alto+',width='+ancho+',left='+tamX+',top='+tamY+',scrollbars=yes');
	}
}