//
// Site loader frontend
//
function __FK_siteloader(page) {
  __FK_siteloader_print(page);
}

//
// Site loader output
//
function __FK_siteloader_print(page) {
  var screenX = 800;
  if (screen.width) screenX = screen.width;

  if (screenX > 800) {
    document.writeln('<frameset rows="*" cols="182,610,*" framespacing="0" frameborder="0" border="0">');
    document.writeln('<frame src="/site/navigation.html" name="leftFrame" scrolling="no" noresize>');
    document.writeln('<frame src="'+page+'" name="mainFrame" scrolling="auto">');
    document.writeln('<frame src="/site/ads.html" name="rightFrame" scrolling="no" noresize>');
    document.writeln('</frameset>');
  } else {
    document.writeln('<frameset rows="*" cols="202,*" framespacing="0" frameborder="0" border="0">');
    document.writeln('<frame src="/site/navigation.html" name="leftFrame" scrolling="auto" noresize>');
    document.writeln('<frame src="'+page+'" name="mainFrame" scrolling="auto">');
    document.writeln('</frameset>');
  }
}

//
// Checks if current URL is hosted in a frameset
//
function __FK_top(urlTarget) {
  if (top == window) {
    top.location.replace('http://www.ferienknaller.de/index.html?page='+urlTarget);
  }
}

//
// Dynamically resizes an IFrame
//
function __FK_adjustIFrameSize(iframeWindow) {
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
  } else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') {
      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
    } else {
      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 5 + 'px';
    }
  }
  parent.scrollTo(0,0);
}

//
// Sets an IFrames height
//
function __FK_setIFrameSize(iframeWindow, iframeHeight) {
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeHeight + 'px';
  } else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') {
      iframeElement.style.height = iframeHeight + 5 + 'px';
    } else {
      iframeElement.style.height = iframeHeight + 5 + 'px';
    }
  }
}

//
// Opens a popup window
//
function __FK_popup(windowTop, windowLeft, windowWidth, windowHeight, urlString, windowTitle, windowOptions) {
  var win   = window.open(urlString, windowTitle, windowOptions+",width="+windowWidth+",height="+windowHeight+",top="+windowTop+",left="+windowLeft);
  if (win.window) {
    win.window.focus();
    return win;
  } else {
    win.focus();
    return win;
  }
}
