var screenx = 0;
var oldScreenx = 0;
var menContent="";
var winXSize = VentanaX();
function showgrafic(pageurl,winwidth,winheight) {
         graficshow=window.open (
             "showgrafic.html?pic="+pageurl,
             "OttYachtImage",
             "toolbar=no,"
            +"scrollbars=no,"
            +"location=no,"
            +"resizable=no,"
            +"width="+winwidth
            +",height="+winheight
         );
}
function VentanaX() {
         if (window.innerWidth) {
            return window.innerWidth;
         } else if (document.body && document.body.offsetWidth) {
            return document.body.offsetWidth;
         } else {
            return screen.width;
         }
}
function VentanaY() {
         if (window.innerHeight) {
            return window.innerHeight;
         } else if (document.body && document.body.offsetHeight) {
            return document.body.offsetHeight;
         } else {
            return screen.Height;
         }
}
function init() {
         screenx = VentanaX()-20;
         if (screenx < 800) screenx=800;
         if (screenx != oldScreenx) {
            widthsaver.location.href = "guardarsize.html?size=" + VentanaX();
            oldScreenx = screenx;
         }
         document.getElementById("ott-yacht-head").style.left = screenx/2 - 400 + "px";
         document.getElementById("ott-yacht-content").style.left = screenx/2 - 400 + "px";
         document.getElementById("ott-yacht-pulldown").style.left = screenx/2 - 400 + "px";
         document.getElementById("ott-yacht-smallinks").style.left = screenx/2 - 400 + "px";
         document.getElementById("ott-yacht-MenuMain").style.left = screenx/2 - 401 + "px";
         document.getElementById("ott-yacht-MenuProducts").style.left = screenx/2 - 353 + "px";
         document.getElementById("ott-yacht-MenuProductsSub").style.left = screenx/2 - 199 + "px";
         document.getElementById("ott-yacht-Menu2ndHand").style.left = screenx/2 - 250 + "px";
         document.getElementById("ott-yacht-MenuService").style.left = screenx/2 - 145 + "px";
         document.getElementById("ott-yacht-MenuShop").style.left = screenx/2 - 82 + "px";
         document.getElementById("ott-yacht-MenuContact").style.left = screenx/2 + 16 + "px";
         window.setTimeout("init()",333);
}
function closeMenus() {
         closeProductsSub();
         document.getElementById("closer").style.width = "1px";
         document.getElementById("closer").style.height = "1px";
         document.getElementById("ott-yacht-MenuMain").style.top="-500px";
         document.getElementById("ott-yacht-MenuProducts").style.top="-500px";
         document.getElementById("ott-yacht-MenuService").style.top="-500px";
         document.getElementById("ott-yacht-Menu2ndHand").style.top="-500px";
         document.getElementById("ott-yacht-MenuShop").style.top="-500px";
         document.getElementById("ott-yacht-MenuContact").style.top="-500px";
}
function closeProductsSub() {
         document.getElementById("ott-yacht-MenuProductsSub").style.top = "-500px";
}
function showCloser() {
         document.getElementById("closer").style.width = VentanaX() - 50 + "px";
         document.getElementById("closer").style.height = VentanaY() - 215 + "px";
}
function showMain() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-MenuMain").style.top="164px";
}
function showProducts() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-MenuProducts").style.top="164px";
}
function showProductsSub(boatName,boatDir,verticalPos) {
         menContent  = "<a class='menuPulldown' style='width:180px' href='../" + boatDir + "/'><b>Sobre " + boatName + "</b></a><br>";
         menContent += "<a class='menuPulldown' style='width:180px' href='../" + boatDir + "/segeln.html'>A la hora de navegar</a><br>";
         menContent += "<a class='menuPulldown' style='width:180px' href='../" + boatDir + "/interior.html'>Bajo cubierta / camarote</a><br>";
         menContent += "<a class='menuPulldown' style='width:180px' href='../" + boatDir + "/riss.html'>Diseño / datos técnicos</a><br>";
         menContent += "<a class='menuPulldown' style='width:180px' href='../main/fotogalerie.html?source=";
         menContent += boatDir + "&titel=" + boatName.replace("/ /","%20") + "'>Galeria de fotos</a><br>";
         menContent += "<a class='menuPulldown' style='width:180px' href='../" + boatDir + "/preis.html'>Precio / contacto</a><br>";
         document.getElementById("ott-yacht-MenuProductsSub").innerHTML = menContent;
         document.getElementById("ott-yacht-MenuProductsSub").style.top = verticalPos + "px";
}
function showService() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-MenuService").style.top="164px";
}
function show2ndHand() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-Menu2ndHand").style.top="164px";
}
function showShop() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-MenuShop").style.top="164px";
}
function showContact() {
         closeMenus();
         showCloser();
         document.getElementById("ott-yacht-MenuContact").style.top="164px";
}
function ChkKontaktform() {
         if (document.kontaktform.absender.value == "") {
            alert("¡Por favor introduzca su nombre!");
            document.kontaktform.absender.focus();
            return false;
         }
         if (  (document.kontaktform.email.value.indexOf('@') == -1)
             ||(document.kontaktform.email.value.indexOf('.') == -1)  ) {
            alert("¡No ha indicado ninguna dirección\nde e-mail o ésta es errónea!");
            document.kontaktform.email.focus();
            return false;
         }
         if (document.kontaktform.message.value == "") {
            alert("¡Ha olvidado escribir su mensaje!");
            document.kontaktform.message.focus();
            return false;
         }
}
function takeinbasket (artnumber,artgroup1,size) {
         basketshow=window.open (
             "takeinbasket.html?artnumber="+artnumber+"&artgroup1="+artgroup1+"&size="+size,
             "Warenkorb",
             "toolbar=no,"
            +"scrollbars=yes,"
            +"location=no,"
            +"resizable=no,"
            +"width=400,height=300"
         );
}
