// JavaScript Document   Made by Achim Burkard.   creando@sensaciones.de
var otro;
var x;

function sacaimp(x)
{
document.getElementById("imp").style.visibility = "visible";
document.getElementById("mousefields").style.visibility = "visible";
document.getElementById("imp").style.visibility = "visible";
otro = new Image();
otro.src = document.images["i"+x].scr;
document.imp.src = otro.src; 
}

function quitaimp()
{
document.getElementById("imp").style.visibility = "hidden";
document.getElementById("mousefields").style.visibility = "hidden";
}

var a, b, c, x, y, s, l;                            //contadores en cambiaidi / change / start
//------------------------------start bei seitenaufruf-------------------
function start(x)  //sacar objetos
{
if (x != "solo") checkventana();
y = window.location.search.slice(1,3);    //anhaengende nummer fuer function:change()
if (y < 99  && y != '' ) y=y 
else y = 1;
change(y);
checktext();
} 

//----------------------------------cambio de idioma----------------------------------------
var i = 3;
var idi = 's';
var idicode = new Array ("e","d","s");  //da code de idioma

function idioma(i)  // elegir idioma
{
top.i = top.i+1;
if (top.i > 3) top.i = 1;
document.getElementById("idi"+top.idi).style.visibility = "hidden";   //esconde flag;
top.idi = idicode[top.i-1];            // cambiar code
flag();  // encenar flag
cambiaidi();   // cambiar idioma en todos los documentos
}

function flag()   //Fahne der jeweiligen Sprache zeigen
{
document.getElementById('idi'+top.idi).style.visibility = 'visible';
}

function flagweg()   //Fahnen weg damit gif zum Vorschein kommt
{
document.getElementById('idis').style.visibility = 'hidden';
document.getElementById('idie').style.visibility = 'hidden';
document.getElementById('idid').style.visibility = 'hidden';
}

function cambiaidi()       // cambiar idioma en todos los frames
{
for (var x = 0; x < parent.frames.length; x++)  
parent.frames[x].change(0);
}

//-------------------------------poner y quitar explicaciones de los menus----------------------------

function menuexpli(x)
{ parent.central.document.getElementById("menu" + x + top.idi).style.visibility = "visible" }

function quitamenuexpli(x)
{ parent.central.document.getElementById("menu" + x + top.idi).style.visibility = "hidden"   } 
 
//-------------------------------cambiar contenido visible---------------------------------
var xxx, divid;
var chooseidi = 0;

function change(x) {    // spricht jedes div im document an
                        //  versteckt oder zeigt
				        //  1. Stelle  x > wechsel div ,   y > fuer verschachtelte menus, z > fuer sich isolierende menus
				        //  2. Stelle  x > immer sichtbar, identifizierung egal, ansonsten beliebig fuer parallel erscheinende
				        //  3. Stelle sprache (s,e,d),  x > jede sprache
				        //  4-6. Stelle identifizierung , es muessen nicht alle Stellen belegt sein
				        //        bei verschachtelten menus jede stelle naechste menuebene
						//    1 > am Anfang sichtbar
top.idi = idicode[top.i-1];
bp = x;
if (x != 0) xxx = x +''; 
for (a = 0; a < document.getElementsByTagName("div").length ; a++)
{
divid = document.getElementsByTagName("div")[a].id; 
if (divid.slice(0,1) == "x" || divid.slice(0,1) == "y" || divid.slice(0,1) == "z")          //  wenn wechselobjekt
{ if 
(
( xxx == "i" && divid.slice(1,2) == "i") // impressiones
||
((
  divid.slice(2,3) == top.idi         //  sprache stimmt
  ||	                              //oder
  divid.slice(2,3) == "x"             //  sprachunabhaengig
 )  
&&                                    //und
 (
  divid.slice(1,2) == "x"             //  sprachabhaengig aber immer sichtbar
  ||                                  //oder
  divid.slice(3,6) == xxx             //  objektnummer stimmt
  ||                                  //oder
  (divid.slice(0,1) == "y"            //  menuobjekt, mehrfach in untergeordneten ebenen
   &&        
  (divid.slice(3,5) == xxx || divid.slice(5,7) == xxx || divid.slice(7,9) == xxx))
  ||                                  //oder
  (divid.slice(0,1) == "z"            //  menuobjekt in naechsthoeherer ebene
  &&        
  divid.slice(3,6) == xxx.slice(0, xxx.length - 1) ) 
  ||                                  //oder
  (divid.slice(0,1) == "z"            //  menuobjekt in naechsthoeherer ebene
  &&        
  divid.slice(3,6) == xxx.slice(0, 1) 
   )
)  )  )
{
document.getElementsByTagName("div")[a].style.visibility = "visible";
document.getElementsByTagName("div")[a].style.display = "block";
}
else 
{
document.getElementsByTagName("div")[a].style.visibility = "hidden";
document.getElementsByTagName("div")[a].style.display = "none";
}
}}
}

// textos no existentes-----------

function checktext()          // pone texto estandarisado si encuentra nada mas que letra idicode in Tabellenzelle
{ 
for (y = 0; y < document.getElementsByTagName("p").length; y++) 
{
var z = document.getElementsByTagName("p")[y].firstChild.data;
if (z == "s") document.getElementsByTagName("p")[y].firstChild.data = "este texto todavia no esta disponible en espanol, intenta en otra idioma";
if (z == "e") document.getElementsByTagName("p")[y].firstChild.data = "this text is still not available in english, try in an other language, please";
if (z == "d") document.getElementsByTagName("p")[y].firstChild.data = "dieser Text ist noch nicht in Deutsch verfügbar, versuche es in einer anderen Sprache";
 } }

// herramienta de elaboracion de textos-----------

var texto = 0;
function textoform() 
{
if (texto ==0 || textofenster.closed == true) 
{
textofenster = window.open('../web/texto.htm','textoform','resizable=yes,status=no, location=no, width=295,height=350');
texto = 1 ;
}
else   textofenster.focus();
}

//------------------------------cambiar pagina: change +1 / change -1  ----------------

var ap = 5;
var bp = 1;

function pasarp(x)
{ 
if (x > 1) {ap = x; bp = 1}
else {  bp = bp + x;
if ( bp>=ap ) bp = ap;
if (bp < 2) bp = 2;
change(bp)
}   } 

//---------------------------------ventana--------------------------

function abrirventana(x)  // abre la ventana principal
{ 
var w,h                           //   medir ventana
if (document.all) w = document.body.offsetWidth
else w = window.innerWidth;
if (document.all) h = document.body.offsetHeight
else h = window.innerHeight;
if (w > 1000 && h > 630)         //bastante grande?
{
window.name = "ventanavalle";//endonces renombrar ventana
window.location.href = "./valle" + "-" + x + ".htm" + window.location.search;    // y enlace
}
else     //no: nueva ventana
{
var l = 0;
var t = 0;
w = screen.availWidth;   //medir pantalla
if (w > 1222) {l = (w - 1111) / 2; w = 1111};
h = screen.availHeight;
if (h > 888) {t = (h - 777) / 2; h = 777 };

var ventana = "left=" + l + ",top=" + t + ",toolbar=no,menubar=no,status=no,resizable=yes,width=" + w + ",height=" + h;
if (w < 999 || h < 720) pagina = "./valle800.htm";    //ventana movil?

var vv = window.open("./valle" + "-" + x + ".htm" + window.location.search , "ventanavalle", ventana); 
vv.resizeTo(w,h);  //ajustar para explorer
vv.focus();
}   }
var pag;
function vensens(pag)  // abre la ventana principal
{
var l = (screen.availWidth - 800) / 2;
var t = (screen.availHeight - 580) / 2;
w = 800 //screen.availWidth - 50;   //medir pantalla
h = 580//screen.availHeight - 50;
var ventana = "left=" + l + ",top=" + t + ",locationbar=no,toolbar=no,menubar=no,status=no,resizable=yes,width=" + w + ",height=" + h;
var vv = window.open( pag , "vensens", ventana); 
vv.resizeTo(w,h);  //ajustar para explorer
vv.moveTo(l,t);
vv.focus();
}

function veninfo(pag)  // abre la ventana principal
{
var l = (screen.availWidth - 800) / 1.5;
var t = (screen.availHeight - 580) / 1.5;
w = 800 //screen.availWidth - 50;   //medir pantalla
h = 580//screen.availHeight - 50;
var ventana = "left=" + l + ",top=" + t + ",locationbar=no,toolbar=no,menubar=no,status=no,resizable=yes,width=" + w + ",height=" + h;
var vv = window.open( pag , "veninfo", ventana); 
vv.resizeTo(w,h);  //ajustar para explorer
vv.moveTo(l,t);
vv.focus();
}



//-------------------asegurar que se abren las paginas en su marco

function checkventana()     //  wenn fenstername nicht "ventanavalle" dann indexseite mit pfad als ?-anhang
{
if (top.window.name != "ventanavalle")
{
x = "?" + top.window.location.pathname;
top.window.location.href="http://www.sensaciones.de/index.htm" + x;
}  }

function checkcentral ()      // frame central checked ob search-anhang. wenn ja aber nicht valle_de_sensaciones.htm dann oeffnen der Seite im Frame
{
x = top.window.location.search.slice(2,8);
if (x != '' && x != 'valle_' && x != 'menu/m' && x != 'menu/i' && x != 'menu/d')
window.location.href = "http://www.sensaciones.de" + top.window.location.search.slice(1,50)
}

var pagina = "./valle_de_sensaciones.htm" + window.location.search

//-------------------ventana del formulario de contacto---------------------------
function contacto(x)
{window.open("../web/form/" + x + "form-" +top.idi+ ".htm", "form", "left=300,top=200,width=610,height=435");   }

//--------------------------pagina movil para pantalla pegueña---------------------------

function movepag (Ereignis) {
  if (!Ereignis)
    Ereignis = window.event;
	
var sy = top.window.innerHeight; if (document.all) sy =  top.document.body.offsetHeight;   //offene Fenstergroesse
var sx = top.window.innerWidth; if (document.all) sx =  top.document.body.offsetWidth;
var wy = 640;   						//seitengroesse in iframe
var wx = 1016;
var dy = sy - wy; if (dy > 0) dy = 0;   // differenz
var dx = sx - wx; if (dx > 0) dx = 0;
var factory = dy / (sy - 220) 			//bewegungsfaktor
var factorx = dx / (sx - 200)
var yy =(Ereignis.screenY - 120)* factory ;   //position
var xx =(Ereignis.screenX - 100) * factorx ;
if (xx > 0) xx = 0; if (xx < dx) xx = dx;     //begrenzung am Rand
if (yy > 0) yy = 0; if (yy < dy) yy = dy;

//   top.document.getElementById("pagina").style.left = xx;
 //  top.document.getElementById("pagina").style.top = yy;   
}

var indicetop = 0;

function indicedown(x)
{
indicetop--;
if (indicetop < -600) indicetop = -600;
document.getElementById("indice2").style.top = indicetop;
indice = window.setTimeout("indicedown()", 20);
}

function indiceup(x)
{
indicetop++;
if (indicetop > 0) indicetop = 0;
document.getElementById("indice2").style.top = indicetop;
indice = window.setTimeout("indiceup()", 20);
}

function indicestop()
{window.clearTimeout(indice)}
