var newwindow;

function poptastic(url) {
    newwindow= window.open(url,'','height=380,width=350,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,status=no');
    if (window.focus) {newwindow.focus()}
}

function checkEmail(_email) {
     var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
     return emailReg.test(_email);
  }


function check_special_offers() {
    if (!checkEmail(window.specialoffers.email.value)) {
        alert('Debes introducir un email válido.');
    } else {
        window.specialoffers.submit();
    }
    return 0;
}

function check_send_friend() {
    if (!checkEmail(window.sendfriend.useremail.value) || !checkEmail(window.sendfriend.friendemail.value)) {
        alert('Debes introducir dos emails válidos para poder continuar.');
    } else {
        window.sendfriend.submit();
    }
    return 0;
}

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_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_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 cambiar_vuelos() {
    if (document.f.origen.options[document.f.origen.selectedIndex].value != "0")
        document.location = document.f.origen.options[document.f.origen.selectedIndex].value;
}

function busqueda_vuelos(url,origen) {
    if (document.f.origen.options[document.f.origen.selectedIndex].value != "0" &&
        document.f.dest.options[document.f.dest.selectedIndex].value != "0")
        document.location = url + 'buscador_vacaciones.php?tipo=vuelos&origen=' + origen + '&destino=' + document.f.dest.options[document.f.dest.selectedIndex].value;
}

function cambiar_hoteles() {
    if (document.f.origen.options[document.f.origen.selectedIndex].value != "0")
        document.location = document.f.origen.options[document.f.origen.selectedIndex].value;
}

function busqueda_hoteles(url,origen) {
    if (document.f.origen.options[document.f.origen.selectedIndex].value != "0" &&
        document.f.dest.options[document.f.dest.selectedIndex].value != "0")
        document.location = url + origen + '/' + document.f.dest.options[document.f.dest.selectedIndex].value + '.html';
}