function addFav(){
    var url        = "http://www.pousadamaramar.com.br";
    var title    = "Pousada Mar-A-Mar em Búzios";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}
//..............................................................................................
function mudartexto(title, reset) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
	  if(a.getAttribute("media") == "print") a.disabled = false;
    }
  }
  if (reset == 1) {
  createCookie("wstyle", title, 365);
  }
}

function setStyle() {
	var style = readCookie("wstyle");
	if (style != null) {
		mudartexto(style, 0);
	}
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+escape(value)+expires+"; path=/;";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
  }
  return null;
}

if (window.addEventListener) window.addEventListener("load",setStyle,false);
else if (window.attachEvent) window.attachEvent("onload",setStyle);
//.................................................................................................
 function ValidaCombo()
{
var diaIda = document.sampleform.firstinput.value.substr(0,2);
var mesIda = document.sampleform.firstinput.value.substr(3,2);
var anoIda = document.sampleform.firstinput.value.substr(6,4);

var diaVol = document.sampleform.secondinput.value.substr(0,2);
var mesVol = document.sampleform.secondinput.value.substr(3,2);
var anoVol = document.sampleform.secondinput.value.substr(6,4);

var dataIda = parseInt(anoIda+mesIda+diaIda);
var dataVol = parseInt(anoVol+mesVol+diaVol);

   if (document.sampleform.firstinput.value == "" )
  {
   alert('Data da Ida deve ser preenchida');
   return false
  }

  if ( dataIda <  20061030)

  {
  alert('Data da ida é menor que data de hoje');
  return false;
  }

       if (document.sampleform.secondinput.value == "" )
  		{
   		alert('Data da volta deve ser preenchida');
   		return false;
  		}

  		if ( dataIda > dataVol )
  		{
   		alert('A data da volta deve ser maior que a data da ida');
   		return false;
  		}

   return true;
}
//.............................................................................................
erro=1
function valida(){
if(F1.email.value==""){
erro=0
alert("E-mail está vazio")
return false;
}
if(F1.email.value.length < 12){
erro=0
alert("E-mail inválido")
return false;
}
var EMAIL = F1.email.value;
if (EMAIL.indexOf("@") == -1) {
alert("Digite um e-mail válido.");
F1.email.focus();
return false;
}

else(erro !=0)
F1.submit()
return true;
}
//..................................................................................

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Fechar</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")



