
function OpenSite (ppid, delay) {
  url = 'flhome.php';
  wname = "invenioHomeWin";
  var delay = delay * 1;
  window.setTimeout("wname=window.open(url,wname,'resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1');wname.focus();", delay);
}


function OpenNewSite(url) {
  NewSiteWin=window.open(url,'NewSiteWin','resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=10,top=10,width=900,height=700');
  NewSiteWin.focus();
}


function GoTitleist(url) {
  TitleistWin=window.open(url,'TitleistWin','resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=10,top=10,width=900,height=700');
  TitleistWin.focus();
}

function OpenPrintWin(url) {
  PrintWin=window.open(url,'PrintWin','resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=10,top=10,screenX=10,screenY=0,width=700,height=700');
  PrintWin.focus();
}


function maxWindow(width,height,position) {
  if (position == "center") {
    intAnchoScreen = screen.availWidth;
    intAltoScreen  = screen.availHeight;
    posX   = (intAnchoScreen - width) / 2;
    posY   = (intAltoScreen - height) / 2;
    window.moveTo(posX,posY);
  }
  else window.moveTo(0,0);
  if (document.all)  {
    top.window.resizeTo(width,height);
  }
  else if (document.layers||document.getElementById) {
    if (top.window.outerHeight<height||top.window.outerWidth<width) {
      top.window.outerHeight = height;
      top.window.outerWidth = width;
    }
  }
}


function Resize(width,height,position) {
  if (position == "center") {
    intAnchoScreen = screen.availWidth;
    intAltoScreen  = screen.availHeight;
    posX   = (intAnchoScreen - width) / 2;
    posY   = (intAltoScreen - height) / 2;
    window.moveTo(posX,posY);
  }
  else window.moveTo(0,0);
  window.resizeTo(width,height);
}


function InitWindow(agent,mode) {
  if (mode=="fullscreen") {
    if (agent=="MSIE")   window.setTimeout("maxWindow(screen.availWidth,screen.availHeight,'center')", 300);
    else                 window.setTimeout("Resize(screen.availWidth,screen.availHeight,'center')", 300);
  }
  else {
    if (agent=="MSIE")       window.setTimeout("maxWindow(700,screen.availHeight,'none')", 300);
    else if (agent=="MSIE7") window.setTimeout("maxWindow(700,screen.availHeight,'none')", 300);
    else                     window.setTimeout("Resize(700,screen.availHeight,'none')", 300);
  }
}


function ChangeStyle(elem,what,value) {
  document.getElementById("skinchoice").style.visibility = value;
}


function ShowHideTopLayer() {
  id="todestag";
  obj = (document.getElementById ? document.getElementById(id) : (document.all ? document.all[id] : (document.layers ? document.layers[id] : null)));
  obj.style.visibility = (obj.style.visibility == 'visible' ? 'hidden' : 'visible');
}


function HideTopLayer() {
  ShowHideTodestag();
  var ablauf = new Date();
  var diff = ablauf.getTime() + (60 * 86400 * 1000);
  ablauf.setTime(diff);
  document.cookie='OnlineDemoGesehen=1;path=/;domain=selfhtml.org;expires=' + ablauf.toGMTString();
}


function SwapMenuLayer(id,mode,cnt,sel,imglang) {
  var topid = "top_"+id;
  var subid = "sub_"+id;
  var imgid = "img_"+id;

  var tmpsel_over = '_mo';
  var tmpsel_out  = '';
  if (sel=="_sel") {
    tmpsel_over = '_sel';
    tmpsel_out  = '_sel';
  }

  if (document.getElementById(topid)) {
    if (mode=="show") {
      if (document.getElementById(topid)) document.getElementById(topid).style.zIndex = 300;
      if (document.getElementById(imgid)) document.getElementById(imgid).src = 'img/layout/menu_'+cnt+imglang+tmpsel_over+'.gif';
    }
    else {
      if (document.getElementById(topid)) document.getElementById(topid).style.zIndex = 1;
      if (document.getElementById(imgid)) document.getElementById(imgid).src = 'img/layout/menu_'+cnt+imglang+tmpsel_out+'.gif';
    }
  }

  if (document.getElementById(subid)) {
    if (mode=="show") {
      document.getElementById(subid).style.display = 'block';
      document.getElementById(subid).style.zIndex  = 300;
    }
    else {
      document.getElementById(subid).style.display = 'none';
      document.getElementById(subid).style.zIndex  = 1;
    }
  }
}


function SwapMap(id,mode,cnt) {
  var imgid  = "img_"+id;
  var flagid = "flag_"+id;

  if (mode=="show") {
    if (document.mapimg) document.mapimg.src = 'img/layout/map_'+id+'.gif';
    if (document.getElementById('top'+id)) document.getElementById('top'+id).className = 'TopMenu_sel';
    if (document.getElementById(imgid)) document.getElementById(imgid).src = 'img/layout/menu_lang_'+cnt+'_sel.gif';
    if (document.getElementById(flagid)) document.getElementById(flagid).src = document.getElementById(flagid).src.split('.gif').join('_sel.gif');
  }
  else {
    if (document.mapimg) document.mapimg.src = 'img/layout/map_0.gif';
    if (document.getElementById('top'+id)) document.getElementById('top'+id).className = 'TopMenu';
    if (document.getElementById(imgid)) document.getElementById(imgid).src = 'img/layout/menu_lang_'+cnt+'.gif';
    if (document.getElementById(flagid)) document.getElementById(flagid).src = document.getElementById(flagid).src.split('_sel.gif').join('.gif');
  }
}


function FixFooter() {
  document.getElementById("page_footer").pageY += document.y;
}

function FormSubmit(formname) {
  document.questform.submit();
}
