var defaultXPos = 30;
var defaultYPos = 30;

var xPos = defaultXPos;
var yPos = defaultYPos;

var hochPrintWidth = 595;
var querPrintWidth = 820;
var defaultPrintHeight = 710;

var defaultCartWidth = 810;
var defaultCartHeight = 520;

var defaultHistorieWidth = 785;
var defaultHistorieHeight = 410;

var defaultFwdWidth = 620;
var defaultFwdHeight = 450;

var defaultTsWidth = 880;
var defaultTsHeight = 710;

var defaultGsWidth = 900;
var defaultGsHeight = 760;

var defaultBook2CWidth = 390;
var defaultBook2CHeight = 393;

var defaultBilderbuchWidth = 614;
var defaultBilderbuchHeight = 500;

function openHochPrintWindow(url){
    openPrintWindow(url, "druckversion", hochPrintWidth, defaultPrintHeight, true);
    return false;
}

function openBook2CWindow(url, name){
    xPos = 180;
    yPos = 310;
    openPopup(url, name, defaultBook2CWidth, defaultBook2CHeight, false);
    xPos = defaultXPos;
    yPos = defaultYPos;
    return false;
}

function openQuerPrintWindow(url){
    openPrintWindow(url, "druckversion", querPrintWidth, defaultPrintHeight, true);
    return false;
}

function openCartWindow(url){
    openPrintWindow(url, "warenkorb", defaultCartWidth, defaultCartHeight, true);
    return false;
}

function openHistorieWindow(url){
    openPopup(url, "historie", defaultHistorieWidth, defaultHistorieHeight, true);
    return false;
}

function openFwdWindow(url){
    openPopup(url, "weiterempfehlung", defaultFwdWidth, defaultFwdHeight, true);
    return false;
}

function openTsWindow(url){
    openPopup(url, "themenschaufenster", defaultTsWidth, defaultTsHeight, true);
    return false;
}

function openGsWindow(url){
    openPopup(url, "gewinnspiel", defaultGsWidth, defaultGsHeight, true);
    return false;
}

function openBilderbuchWindow(url){
    openPopup(url, "bilderbuch", defaultBilderbuchWidth, defaultBilderbuchHeight, false);
    return false;
}

function openPopup(url, name, width, height, scroll) {
    if(scroll == true){
        scroll = "1";
    }
    else{
        scroll = "0";
    }
    var description = "width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",status=no,menubar=no,locationbar=no,dependent=no,resizable=yes,left=" + xPos + ",top=" + yPos;
    var w = open (url, name, description);
    if(w)
    w.focus();
    return w;
}

function tt_Popup(url, name, width, height, scroll) {
    if(scroll == true){
        scroll = "1";
    }
    else{
        scroll = "0";
    }
    var description = "width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",status=no,menubar=no,locationbar=no,dependent=no,resizable=yes,top=300,left=300";
    var w = open (url, name, description);
}

function openPrintWindow(url, name, width, height, scroll) {
    if(scroll == true){
        scroll = "1";
    }
    else{
        scroll = "0";
    }
    var description = "width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",menubar=yes,locationbar=no,dependent=no,resizable=yes,screenX=30,screenY=30";
    var w = open (url, name, description);
    w.focus();
    return w;
}

function callQuickfinder(quick) {
    var quickhref = quick.options[quick.selectedIndex].value;
    if(quickhref.length > 0){
        location.href = quickhref;
    }
}

function resetTerminForm(){
	var thisForm = document.terminform;
	thisForm._muster.value="";
	thisForm._ort.value="";
	thisForm._plz.selectedIndex = 0;
}

function resetProfiForm(){
	var thisForm = document.profiform;
	thisForm._autor.value="";
	thisForm._titel.value="";
	thisForm._isbn.value="";
	thisForm._volltext.value="";
	thisForm._verlag.selectedIndex = 0;
	thisForm._sparte.selectedIndex = 0;
}

function openTheaterPdf(pdfhref){
  var winny= openPopup("about:blank", "ttpdf", 600, 400, 1);
  if(winny){
    winny.location.href=pdfhref;
  }
}

/** NAVI Rollouts **/

var openRoller = "";
var toggleRoller = "";
var rollerTimeOut = "";
function openRollOver(rollOver)
{
  
  if(roller = document.getElementById("sub" + rollOver))
  {
    if(rollerTimeOut)
    { window.clearTimeout(rollerTimeOut); }
    if(openRoller != roller)
    {
      roller.style.left = document.getElementById("navi" + rollOver).offsetLeft;
      if(openRoller)
      { openRoller.style.display = "none"; }
      roller.style.display = "block";
      openRoller = roller;
    }
    if(toggleRoller && toggleRoller != roller)
    { toggleRoller.style.display = "none"; }
  }
  return false;
}

function closeRollOver(rollOver)
{
  if(roller = document.getElementById("sub" + rollOver))
  {
    if(roller == openRoller && roller != toggleRoller)
    {
      rollerTimeOut = window.setTimeout("_closeRollOver('"+rollOver+"')", 200);
    }
  }
  return false;
}

function _closeRollOver(rollOver)
{
  if(roller = document.getElementById("sub" + rollOver))
  {
    openRoller = "";
    roller.style.display = "none";
  }
  if(toggleRoller)
  { toggleRoller.style.display = "block"; }
}
