<!--

/* Atribuições e Constantes*/

MM_reloadPage(true);



/* Funções*/



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_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();

}

// Open Browser Window

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function MM_validateForm() { //v4.0

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

  var texto = new Array (20); // Nome dos Campos uma vez que se está limitado caracteres Alfanuméricos

  

	texto ['nome'] 			= 'El campo «Nombre»';
	texto ['morada'] 		= 'El campo «Domicilio»';
	texto ['codpostal']		= 'El campo «Código Postal»';
	texto ['cidade'] 		= 'El campo «Ciudad»';
	texto ['pays'] 			= 'El campo «País»';
	texto ['telefone'] 		= 'El campo «Teléfono»';
	texto ['email']			= 'El campo «E-mail»';
	texto ['dia_entrada'] 	= 'El campo «Día check-in»'; 
	texto ['mes_entrada'] 	= 'El campo «Mes check-in»';
	texto ['ano_entrada']	= 'El campo «Año check-in»';
	texto ['dia_saida']		= 'El campo «Día check-out»';
	texto ['mes_saida'] 	= 'El campo «Mes check-out»'; 
	texto ['ano_saida'] 	= 'El campo «Año check-out»';
	texto ['cartaotipo'] 	= 'El campo «Tipo de tarjeta»';
	texto ['cartaonum']		= 'El campo «Nº de la tarjeta»';
	texto ['cartaoexpano']	= 'El campo «Año Expiración»';
	texto ['cartaoexpmes']	= 'El campo «Mes Expiración»';
	
	texto ['pais'] 			= 'El campo «País»';
	texto ['comentario']	= 'El campo «Comentário»';


		

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);

    if (val) { nm=val.name; 

	if(texto [nm] === undefined) { texto [nm] ='Campo' ;}

	if ((val=val.value)!="") {

      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

        if (p<1 || p==(val.length-1)) errors+='- ' + texto [nm] +' debe ser válido.\n';

      } else if (test!='R') { num = parseFloat(val);

        if (isNaN(val)) errors+='- '+ texto [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+='- '+ texto [nm] +' debe contener un número en medio '+min+' e '+max+'.\n';

    } } } else if (test.charAt(0) == 'R') errors += '- '+ texto [nm] +' se requiere.\n'; }

  } if (errors) alert('Los errores siguientes ocurrieron:\n'+errors);

  document.MM_returnValue = (errors == '');

}



function MM_setTextOfTextfield(objName,x,newText) { //v3.0

  var obj = MM_findObj(objName); if (obj) obj.value = newText;

}



// Auto Scroll

function flvS3(v1){//v1.0

var v2=MM_findObj(v1),v3=0,v4=0,v5=0,v6=0;if (!v2){this.x=this.y=this.h=this.w=0;return;}var v7=(document.layers)?v2:v2.style;v3=v7.left;v4=v7.top;if ((v3==""||v4=="")&&document.all&&!window.opera){if (v3==""){v3=v2.offsetLeft;}if (v4==""){v4=v2.offsetTop;}}if (v2.offsetHeight){v5=v2.offsetHeight;v6=v2.offsetWidth;}else if (document.layers){v5=v7.clip.height;v6=v7.clip.width;}this.x=parseInt(v3);this.y=parseInt(v4);this.h=parseInt(v5);this.w=parseInt(v6);}



function flvS8(v1,v2,v3){//v1.0

var v4=(document.layers)?v1:v1.style;var v5=flvS5();eval("v4.left='"+v2+v5+"'");eval("v4.top='"+v3+v5+"'");}



function flvS5(){//v1.0

var v1=((parseInt(navigator.appVersion)>4||navigator.userAgent.indexOf("MSIE")>-1)&&(!window.opera))?"px":"";return v1;}



function flvXAS1(){

var v1=arguments,v2=v1.length,v3='AutoScrollContainer',v4='AutoScrollContent';var v5=MM_findObj(v3),v6=MM_findObj(v4);if (!v5){return;}if (v5.XAS1!=null){clearTimeout(v5.XAS1);}var v7=(v2>0)?parseInt(v1[0]):1;if (v7){var v8=(v2>1)?parseInt(v1[1]):1,v9=(v2>2)?parseInt(v1[2]):50,v10=(v2>3)?parseInt(v1[3]):1;var v11=new flvS3(v3),v12=new flvS3(v4);var v13=v12.x,v14=v12.y,v15=0,v16=0;if (v10==1){var v17=-1*v12.h;v15=v12.x;if (v14>=v17){v16=v12.y-v8;}else {v16=v11.h;}}else {var v18=-1*v12.w;v16=v12.y;if (v13>=v18){v15=v12.x-v8;}else {v15=v11.w;}}flvS8(v6,v15,v16);v5.XAS1=setTimeout("flvXAS1("+v7+","+v8+","+v9+","+v10+")",v9);}}

// Auto Scroll END



function bh_clean(form,n,text){

	if (form.elements[n].value == text )

	{

		form.elements[n].value = '';

	}

}

// Efectua a mudança de cor no highlight de um form element

function mark(face,field_color,text_color){

	if (document.documentElement){//if browser is IE5+ or NS6+

		face.style.backgroundColor=field_color;

		face.style.color=text_color;

	}

}





/**

 * This array is used to remember mark status of rows in browse mode

 */

var marked_row = new Array;

/**

 * Sets/unsets the pointer and marker in browse mode

 *

 * @param   object    the table row

 * @param   interger  the row number

 * @param   string    the action calling this script (over, out or click)

 * @param   string    the default background color

 * @param   string    the color to use for mouseover

 * @param   string    the color to use for marking a row

 *

 * @return  boolean  whether pointer is set or not

 */

function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)

{

    var theCells = null;



    // 1. Pointer and mark feature are disabled or the browser can't get the

    //    row -> exits

    if ((thePointerColor == '' && theMarkColor == '')

        || typeof(theRow.style) == 'undefined') {

        return false;

    }



    // 2. Gets the current row and exits if the browser can't get it

    if (typeof(document.getElementsByTagName) != 'undefined') {

        theCells = theRow.getElementsByTagName('td');

    }

    else if (typeof(theRow.cells) != 'undefined') {

        theCells = theRow.cells;

    }

    else {

        return false;

    }



    // 3. Gets the current color...

    var rowCellsCnt  = theCells.length;

    var domDetect    = null;

    var currentColor = null;

    var newColor     = null;

    // 3.1 ... with DOM compatible browsers except Opera that does not return

    //         valid values with "getAttribute"

    if (typeof(window.opera) == 'undefined'

        && typeof(theCells[0].getAttribute) != 'undefined') {

        currentColor = theCells[0].getAttribute('bgcolor');

        domDetect    = true;

    }

    // 3.2 ... with other browsers

    else {

        currentColor = theCells[0].style.backgroundColor;

        domDetect    = false;

    } // end 3



    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it

    if (currentColor.indexOf("rgb") >= 0) 

    {

        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,

                                     currentColor.indexOf(')'));

        var rgbValues = rgbStr.split(",");

        currentColor = "#";

        var hexChars = "0123456789ABCDEF";

        for (var i = 0; i < 3; i++)

        {

            var v = rgbValues[i].valueOf();

            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);

        }

    }



    // 4. Defines the new color

    // 4.1 Current color is the default one

    if (currentColor == ''

        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {

        if (theAction == 'over' && thePointerColor != '') {

            newColor              = thePointerColor;

        }

        else if (theAction == 'click' && theMarkColor != '') {

            newColor              = theMarkColor;

            marked_row[theRowNum] = true;

            // Garvin: deactivated onclick marking of the checkbox because it's also executed

            // when an action (like edit/delete) on a single item is performed. Then the checkbox

            // would get deactived, even though we need it activated. Maybe there is a way

            // to detect if the row was clicked, and not an item therein...

            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;

        }

    }

    // 4.1.2 Current color is the pointer one

    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()

             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {

        if (theAction == 'out') {

            newColor              = theDefaultColor;

        }

        else if (theAction == 'click' && theMarkColor != '') {

            newColor              = theMarkColor;

            marked_row[theRowNum] = true;

            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;

        }

    }

    // 4.1.3 Current color is the marker one

    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {

        if (theAction == 'click') {

            newColor              = (thePointerColor != '')

                                  ? thePointerColor

                                  : theDefaultColor;

            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])

                                  ? true

                                  : null;

            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;

        }

    } // end 4



    // 5. Sets the new color...

    if (newColor) {

        var c = null;

        // 5.1 ... with DOM compatible browsers except Opera

        if (domDetect) {

            for (c = 0; c < rowCellsCnt; c++) {

                theCells[c].setAttribute('bgcolor', newColor, 0);

            } // end for

        }

        // 5.2 ... with other browsers

        else {

            for (c = 0; c < rowCellsCnt; c++) {

                theCells[c].style.backgroundColor = newColor;

            }

        }

    } // end 5



    return true;

} // end of the 'setPointer()' function

// -->



// Efeito onMouserver das tabelas

function bh_cell(face,field_color){

	if (document.documentElement){//if browser is IE5+ or NS6+

		face.style.backgroundColor=field_color;

	}

}



// Adicionar oas Favoritos

function AddToFaves_hp(){

	var is_4up = parseInt(navigator.appVersion);

	var is_mac   = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;

	var is_ie   = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;

	var thePage = location.href;

	if (thePage.lastIndexOf('#')!=-1)

		thePage = thePage.substring(0,thePage.lastIndexOf('#'));

	if (is_ie && is_4up && !is_mac) 

		window.external.AddFavorite(thePage,document.title);

	else if (is_ie || document.images)

		booker_hp = window.open(thePage,'booker_','menubar,width=325,height=100,left=140,top=60');

	//booker_hp.focus();

	}

function MM_goToURL() { //v3.0

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}