//fuer Monuments
var rcwidth=430;

var clickedstr=""; var clickedx, clickedy;

window.onload = loadQueryString;

function getRealLeft() {
  xPos = this.offsetLeft;
  tempEl = this.offsetParent;
  while (tempEl != null) {xPos += tempEl.offsetLeft;tempEl = tempEl.offsetParent};
  return xPos}

function bk() {
    frames['rcframe'].history.back();
    scrollTo(0,0);
    spot_r_out(); spot_g_out();  //Markierungen loeschen
    if(clickedstr != "") {list_out(clickedstr)};
}

function iframe_ld() { //wenn mit history.back init.html geladen wird, iframe unsichtbar machen
  var init=rcframe.location.href.search(/init.html/);
  if (init != -1) {document.getElementById("framecontainer").style.visibility="hidden"};
}

function back () {
  if (clickedstr=="") {location.reload(); return};
  rcframe.location.href = clickedstr + ".html";
  parent.scrollTo(0,0);
}

function hotelback () {
  if (clickedstr=="") {location.reload(); return};
  rcframe.location.href = "../"+ clickedstr + ".html";
  parent.scrollTo(0,0);
}


function spot_r_out() {
  document.getElementById("spot1").style.visibility = 'hidden';
  document.getElementById("spot2").style.visibility = 'hidden';
}

function spot_g_out() {
  document.getElementById("spot3").style.visibility = 'hidden';
  document.getElementById("spot4").style.visibility = 'hidden';
}

function list_out(str) {
  document.getElementById(str).style.backgroundColor = "transparent";
}

function list_out_courses(str) {
  document.getElementById(str).style.backgroundColor = "transparent";
}

function list_out_sevilla(str) {
  document.getElementById(str).style.backgroundColor = "transparent";
}

function spot_r_on(x,y) {
  if(x<150) {document.getElementById("spot1").style.left = x; document.getElementById("spot1").style.top = y; document.getElementById("spot1").style.visibility = 'visible'}
  else      {document.getElementById("spot2").style.left = x; document.getElementById("spot2").style.top = y; document.getElementById("spot2").style.visibility = 'visible'}
}

function spot_g_on(x,y) {
  if(x<150) {document.getElementById("spot3").style.left = x; document.getElementById("spot3").style.top = y; document.getElementById("spot3").style.visibility = 'visible'}
  else      {document.getElementById("spot4").style.left = x; document.getElementById("spot4").style.top = y; document.getElementById("spot4").style.visibility = 'visible'}
}

function list_on(str,color) {
  document.getElementById(str).style.backgroundColor = color;
}

function list_on_sevilla(str,color) {
  document.getElementById(str).style.backgroundColor = color;
}

function msover(str,x,y) {
  if (str==clickedstr) {return};
  if (msover.arguments.length > 1) { list_on(str,'#ff9900'); spot_r_on(x,y) }
  else { document.getElementById(str).style.backgroundColor = '#ff9900' }}

function msout(str,x,y) {
  if (str==clickedstr) {return};
  if (msout.arguments.length > 1) { list_out(str); spot_r_out() }
  else { list_out_courses(str) };}

function oncl (str,x,y) {
  document.getElementById("framecontainer").style.visibility = 'visible';
  rcframe.location.href= (str+".html");
  spot_r_out();
  spot_g_out();
  if (clickedstr != "") { list_out(clickedstr) };
  clickedstr=str;
  list_on(str,'#999999');
  if (oncl.arguments.length == 3) { //More-1/2-br haben nur ein (1) Argument
    spot_g_on(x,y);
    clickedx=x; clickedy=y;
  }
  parent.scrollTo(0,0);
}


function oncl1 (str) {  //nur ein (1) argument und keine id
  document.getElementById("framecontainer").style.visibility = 'visible';
  rcframe.location.href= (str+".html");
  spot_r_out();
  spot_g_out();
  if (clickedstr != "") { list_out(clickedstr) };
  parent.scrollTo(0,0);
}


// Apartments/Hotels
function ioncl (str1,str2,str3) {
  if (ioncl.arguments.length == 3)
      { rcframe.location.href= ("../" + str1 + "/" + str2 + ".html" + str3) } 
      else { rcframe.location.href= ("../" + str1 + "/" + str2 + ".html") }
  parent.scrollTo(0,0)
}


// Apartment buchen Englisch
function book (str) {
  if (book.arguments.length == 0) {rcframe.location.href="information.html"}
  else {rcframe.location.href= ("information.html?" + str)}
  parent.scrollTo(0,0);
}


// Apartment Popup
function pop(th){
  window.open(th.href,'','dependent=yes,width=700,height=700,resizable,scrollbars=1');
}


// Apartment scrollen - statt Anker Link
function scrTo(str) {
  scrollTo(0,frames[0].document.getElementById(str).offsetTop+250);
}


// Activities
function cl(str) {
  document.getElementById("framecontainer").style.visibility = 'visible';
  if (str == "") { location.reload() };  
  var substr=str.split(" ");
  if (substr.length == 1)
     { rcframe.location.href = (substr[0] + ".html") }
     else { rcframe.location.href = (substr[0] + ".html?" + substr[1]) }
  if (clickedstr != "") { document.getElementById(clickedstr).style.backgroundColor = "transparent" };
  document.getElementById(substr[0]).style.backgroundColor = "#c0c0c0";
  clickedstr=substr[0];
}


// Sevilla Info
function toncl (str1,str2,str3) {
  document.getElementById("framecontainer").style.visibility = 'visible';
  rcframe.location.href= ("../" + str1 + "/" + str2.substr(0,str2.length-1) + ".html" + str3);
  if (clickedstr != "") { list_out_sevilla(clickedstr) };
  list_on_sevilla(str2,'#c0c0c0');
  clickedstr=str2;
}




// Activities
function initActivityFrame() {
  document.images["leftIm"].getRealLeft = getRealLeft;
  document.images["rightIm"].getRealLeft = getRealLeft;
  rcwidth = document.images["rightIm"].getRealLeft() - document.images["leftIm"].getRealLeft() + 0;
  var Breite = document.createAttribute("width");
  Breite.nodeValue = rcwidth;
  document.getElementsByTagName("iframe")[0].setAttributeNode(Breite);
}


// Querystring in Frame laden falls kein "=" enthalten
function loadQueryString() {
  str=location.search;
  str1=str.substring(1,str.length);
  isID=str.search(/=.+/);
  if ((str != "") && (isID == -1)) {  
    if (document.getElementById(str1)) {             // id vorhanden
      document.getElementById(str1).onclick();
      } else {                                       // keine id vorhanden
      document.getElementById("framecontainer").style.visibility = 'visible';
      rcframe.location.href=(str1 + ".html");
    }
  }
}





