function showPromoSlide() {
      var t2 = new Tween(document.getElementById('promo_slide').style,'top',Tween.strongEaseOut,-64,0,1,'px');
      t2.start();
      //document.getElementById("overall").style.display="block";
}

function closePromoSlide() {
    var t2 = new Tween(document.getElementById('promo_slide').style,'top',Tween.strongEaseOut,0,-64,1,'px');
    t2.start();
}

function closeOverall2() {
    document.getElementById("overall").style.display="none";
}

function validEmail(address) {

if (address.length==0) {
  return (true);
}
else
{
if (address.length>=6) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+1)<address.lastIndexOf(".")) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
}
return (false);
}

function checkDate() {
   var plecare = document.getElementById("calatorie").value;
   if (plecare=="dus-intors") {
       document.getElementById("dataintoarcerediv").style.display="block";
   } else {
       document.getElementById("dataintoarcerediv").style.display="none";
   }
}

function checkNewsletterForm() {

   var err="";

   email = document.getElementById("newslettermail").value;

   if (!validEmail(email)) {
       err = "Adresa de email nu este intr-un format valid (ex: nume@domeniu.ro)";
   }

   if (email=='' || email==null || email=='adresa ta de email aici') {
        err = "Te rugam sa completezi adresa ta de email";
   }

   if (err=='') {
      document.activeForm.action.value="add2newsletter";
      document.activeForm.submit();
   } else {
       alert(err);
   }

}

function nlfocus() {
  if (document.getElementById("newslettermail").value=="adresa ta de email aici") {
      document.getElementById("newslettermail").value="";
  }
}

function nlblur() {
  if (document.getElementById("newslettermail").value=="") {
      document.getElementById("newslettermail").value="adresa ta de email aici";
  }
}

function showGreciaMap() {

  SetScrollPosition(0,0);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }
   
  var h = windowHeight();
  
  document.getElementById('divoverall').style.height="1500px";
  document.getElementById('divoverall').style.width=(winW-23)+"px";
  document.getElementById('divoverall').style.display="block";
  opacity('divoverall', 0, 60, 100);
  
   var ch = h/2-150;
   var cl = winW/2-250;
   document.getElementById('pagecontent2').style.display="block";
   var t1 = new Tween(document.getElementById('pagecontent2').style,'top',Tween.strongEaseOut,ch,30,0.5,'px');
   t1.start();
   var t2 = new Tween(document.getElementById('pagecontent2').style,'left',Tween.strongEaseOut,cl,30,0.5,'px');
   t2.start();
   var t3 = new Tween(document.getElementById('pagecontent2').style,'width',Tween.strongEaseOut,0,910,0.5,'px');
   t3.start();
   
   document.getElementById('pagecontent2').innerHTML = "<center><a href='javascript:closeOverall()' border=0 alt='click pentru a inchide'><img src='images/harta_pieria.jpg' alt='click pentru a inchide' border=0></a></center>";

}

function showNeiPoriMap() {

  SetScrollPosition(0,0);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }
   
  var h = windowHeight();
  
  document.getElementById('divoverall').style.height="1500px";
  document.getElementById('divoverall').style.width=(winW-23)+"px";
  document.getElementById('divoverall').style.display="block";
  opacity('divoverall', 0, 60, 100);
  
   var ch = h/2-150;
   var cl = winW/2-250;
   document.getElementById('pagecontent2').style.display="block";
   var t1 = new Tween(document.getElementById('pagecontent2').style,'top',Tween.strongEaseOut,ch,30,0.5,'px');
   t1.start();
   var t2 = new Tween(document.getElementById('pagecontent2').style,'left',Tween.strongEaseOut,cl,30,0.5,'px');
   t2.start();
   var t3 = new Tween(document.getElementById('pagecontent2').style,'width',Tween.strongEaseOut,0,910,0.5,'px');
   t3.start();
   
   document.getElementById('pagecontent2').innerHTML = "<center><a href='javascript:closeOverall()' border=0 alt='click pentru a inchide'><img src='images/harta_nei_pori.jpg' alt='click pentru a inchide' border=0></a></center>";

}

function showParaliaMap() {

  SetScrollPosition(0,0);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }
   
  var h = windowHeight();
  
  document.getElementById('divoverall').style.height="1500px";
  document.getElementById('divoverall').style.width=(winW-23)+"px";
  document.getElementById('divoverall').style.display="block";
  opacity('divoverall', 0, 60, 100);
  
   var ch = h/2-150;
   var cl = winW/2-250;
   document.getElementById('pagecontent2').style.display="block";
   var t1 = new Tween(document.getElementById('pagecontent2').style,'top',Tween.strongEaseOut,ch,30,0.5,'px');
   t1.start();
   var t2 = new Tween(document.getElementById('pagecontent2').style,'left',Tween.strongEaseOut,cl,30,0.5,'px');
   t2.start();
   var t3 = new Tween(document.getElementById('pagecontent2').style,'width',Tween.strongEaseOut,0,910,0.5,'px');
   t3.start();
   
   document.getElementById('pagecontent2').innerHTML = "<center><a href='javascript:closeOverall()' border=0 alt='click pentru a inchide'><img src='images/harta_paralia.jpg' alt='click pentru a inchide' border=0></a></center>";

}

function showOlympicMap() {

  SetScrollPosition(0,0);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }
   
  var h = windowHeight();
  
  document.getElementById('divoverall').style.height="1500px";
  document.getElementById('divoverall').style.width=(winW-23)+"px";
  document.getElementById('divoverall').style.display="block";
  opacity('divoverall', 0, 60, 100);
  
   var ch = h/2-150;
   var cl = winW/2-250;
   document.getElementById('pagecontent2').style.display="block";
   var t1 = new Tween(document.getElementById('pagecontent2').style,'top',Tween.strongEaseOut,ch,30,0.5,'px');
   t1.start();
   var t2 = new Tween(document.getElementById('pagecontent2').style,'left',Tween.strongEaseOut,cl,30,0.5,'px');
   t2.start();
   var t3 = new Tween(document.getElementById('pagecontent2').style,'width',Tween.strongEaseOut,0,600,0.5,'px');
   t3.start();
   
   document.getElementById('pagecontent2').innerHTML = "<center><a href='javascript:closeOverall()' border=0 alt='click pentru a inchide'><img src='images/harta_olympic.jpg' alt='click pentru a inchide' border=0></a></center>";

}

function OpenGalerieCrystal() {
  
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }

  window.open('images/crystal/galerie.html', '_blank', 'width='+winW+',height='+winH+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}

function OpenGalerieSofi() {
  
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }

  window.open('images/sofi/galerie.html', '_blank', 'width='+winW+',height='+winH+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}

function OpenGalerieVarbenis() {
  
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }

  window.open('images/varbenis/galerie.html', '_blank', 'width='+winW+',height='+winH+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}

function OpenGalerieSavas() {
  
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }

  window.open('images/savas/galerie.html', '_blank', 'width='+winW+',height='+winH+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}

function OpenGalerieAdonia() {
  
   var isIE = (navigator.appVersion.indexOf("MSIE") != -1);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }

  window.open('images/adonia/galerie.html', '_blank', 'width='+winW+',height='+winH+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}

function showAutocar(x) {

  SetScrollPosition(0,0);

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
         winW = window.innerWidth;
         winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
     }
   }
   
  var h = windowHeight();
  
  document.getElementById('divoverall').style.height="1500px";
  document.getElementById('divoverall').style.width=(winW-23)+"px";
  document.getElementById('divoverall').style.display="block";
  opacity('divoverall', 0, 60, 100);
  
   var ch = h/2-150;
   var cl = winW/2-250;
   document.getElementById('pagecontent2').style.display="block";
   var t1 = new Tween(document.getElementById('pagecontent2').style,'top',Tween.strongEaseOut,ch,30,0.5,'px');
   t1.start();
   var t2 = new Tween(document.getElementById('pagecontent2').style,'left',Tween.strongEaseOut,cl,30,0.5,'px');
   t2.start();
   var t3 = new Tween(document.getElementById('pagecontent2').style,'width',Tween.strongEaseOut,0,910,0.5,'px');
   t3.start();
   
   document.getElementById('pagecontent2').innerHTML = "<center><a href='javascript:closeOverall()' border=0 alt='click pentru a inchide'><img src='../images/autocar"+x+".jpg' alt='click pentru a inchide' border=0></a></center>";

}

function closeOverall() {
  document.getElementById('pagecontent2').style.display="none";
  document.getElementById('divoverall').style.display="none";
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++;
        } 
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}


function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 60, millisec);
    } else {
        opacity(id, 60, 0, millisec);
    }
}

function windowWidth() {
  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;
  }
  return myWidth;
}

function windowHeight() {
  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;
  }
  return myHeight;
}

function getScrollX() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfX;
}

function getScrollY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY;
  }

function SetScrollPosition(x,y) {
     window.scrollTo(x, y);
     /*var sy = getScrollY();
     if (sy>y) {
       window.scrollBy(y,-35);
       setTimeout('SetScrollPosition(0,'+y+')',10);
     }
     */

}


