function verifMail(email){
  var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
  if ( email.search( maReg ) == -1 )
    return false;
  else
    return true;
}

function checkForm(){
  var error=0;
  $('contact').getElements('input.obl').each(function(item){if(item.get('value')==''){item.addClass('error');error++;}else{if(item.get('id')=='mail' && !verifMail(item.get('value'))){item.addClass('error');error++;}else if(item.hasClass('error')){item.removeClass('error');}}});
  $('contact').getElements('textarea.obl').each(function(item){if(item.get('value')==''){item.addClass('error');error++;}else{if(item.hasClass('error')){item.removeClass('error');}}});
  if(error!=0)
  {
    alert('Veuillez remplir tous les champs correctement. Merci.');
    return false;
  }
  else
    return true;
}


function blink(){
  var delay;
  var myFx = new Fx.Tween(this);
  if(this.getStyle('opacity')=='0')
    delay=3000;
  else
    delay=1000;
  this.fade('toggle');
  blink.delay(delay,this);
}
function resize(){
  var size=$(document).getSize();
  
  if(size.x<parseInt($('conteneur').getStyle('width')))
  {
    $(document.body).setStyle('overflow-x','scroll');
    $(document.body).setStyle('width','1024px');
    var vLeft=(parseInt($('conteneur').getStyle('width'))-1280)/2;          
    $(document.body).setStyle('background-position', vLeft+'px top');
  }
  else
  {
    $(document.body).setStyle('overflow-x','hidden');
    $(document.body).setStyle('width','100%');
    $(document.body).setStyle('background-position','top center');
  }
  if(size.y<620+parseInt($('conteneur').getStyle('top'))||size.y<parseInt($('conteneur').getStyle('top'))+parseInt($('conteneur').getStyle('height'))+40)
  {
    $(document.body).setStyle('overflow-y','scroll');
    $(document.body).setStyle('height','800px');
  }
  else
  {
    $(document.body).setStyle('overflow-y','hidden');
    $(document.body).setStyle('height','100%');
    $(document.body).scrollTo(0,0);
  }
}
function initialize(){
  var latlng = new google.maps.LatLng(43.002102,-0.102842);
  var center = new google.maps.LatLng(20.002102,-0.102842);
  var myOptions = {
    zoom: 15,
    center: center,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("map"), myOptions);
  var contentString = '<div id="content">'+
    '<div id="siteNotice">'+
    '</div>'+
    '<h1 id="firstHeading" class="firstHeading">Hotel Les Cîmes **</h1>'+
    '<div id="bodyContent">'+
    '<p>1 Place d\'Ourout</p><p>65400 Argelès-Gazost</p><p>Tél. : +33 (0)5 62 97 00 10</p><p>Fax : +33 (0)5 62 97 10 19 </p>'+
    '</div>'+
    '</div>';
  var infowindow = new google.maps.InfoWindow({content: contentString});
  infowindow.setPosition(latlng);
  infowindow.open(map);
}

window.addEvent('domready', function() {
  $$('.coin').each(function(item){var bindBlink = blink.bind(item);bindBlink();});
});

window.onresize=resize;
