/*
  Hilfsfunktion für Navigation für Content-Navigation mit URLs, die von den 
  *_url-Templates aus _cms_content_link_ink.xsl zurückgegeben werden.
  Besonderheit bei diesen ist, dass optional in Window Target und
  Window Features durch ein | angehängt in der URL mit vorkommen.
*/
function cms_content_link_url_navigate(pURL) {
  if (pURL==null || pURL.toString().length==0)
    return;
  var intPos1 = pURL.indexOf("|");
  var intPos2 = pURL.indexOf("|", intPos1+1);
  var strURL = null;
  var strTarget = null;
  var strWindowFeatures = null;
  if (intPos1 >= 0) {
    strURL = pURL.substring(0, intPos1);
    if (intPos2 >= 0) {
      strTarget = pURL.substring(intPos1+1, intPos2);
      strWindowFeatures = pURL.substring(intPos2+1);
    }
    else {
      strTarget = pURL.substring(intPos1+1);
    }
  }
  else {
    strURL = pURL.toString();
  }
  if (strTarget!=null && strWindowFeatures!=null) {
    wnd = window.open(strURL, strTarget, strWindowFeatures);
    wnd.focus();
  }
  else if (strTarget!=null) {
    wnd = window.open(strURL, strTarget);
    wnd.focus();
  }
  else {
    window.location = strURL;
  }
}


/* opens a window with scrollbar */
function openWinScroll(pURL, pWidth, pHeight) {
  wnd = window.open(pURL, "wnd_popup", 
    "width=" + pWidth + ",height=" + pHeight + ",toolbar=0,status=0,scrollbars=1,resizable=no");
  wnd.focus();
}

/* opens a window without scrollbar */
function openWin(pURL, pWidth, pHeight){
  wnd = window.open(pURL, "wnd_popup",
    "width=" + pWidth + ",height=" + pHeight + ",toolbar=0,status=0,scrollbars=0,resizable=no");
  wnd.focus();
}

//Visibility +
function show(name) {
  document.getElementById(name).style.visibility = "visible";
}
		
//Visibility -	
function hide(name) {	
  document.getElementById(name).style.visibility = "hidden";
}




// showTooltip/hideTooltip
var showTooltip_tipTimer;

function locateObject(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document); return x;
}

function hideTooltip(object) {
  if (document.all) {
    locateObject(object).style.visibility="hidden";
    locateObject(object).style.left = 1;
    locateObject(object).style.top = 1;
    return false;
  }
  else if (document.layers) {
    locateObject(object).visibility="hide";
    locateObject(object).left = 1;
    locateObject(object).top = 1;
    return false;
  }
  else {
    return true;
  }
}
function showTooltip(object,e, tipContent, backcolor, bordercolor, textcolor, displaytime) {
  window.clearTimeout(showTooltip_tipTimer)

  if (document.all) {
    locateObject(object).innerHTML='<table style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" width="10" border="0" cellspacing="1" cellpadding="1"><tr><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table> '
    
    // Die Breite sichtbar machen
    if ((e.x + 15 + locateObject(object).clientWidth) > (document.body.clientWidth + document.body.scrollLeft)) {
      locateObject(object).style.left = e.x + document.body.scrollLeft - locateObject(object).clientWidth-10;
    }
    else {
      locateObject(object).style.left=document.body.scrollLeft+event.clientX + 15
    }

    // Scrolltop abh. von IE6/IE5 korrekt ermitteln
    var scrolltop = 0;
    if (document.documentElement && document.documentElement.scrollTop) {
      scrolltop = document.documentElement.scrollTop;
    }
    else {
      scrolltop = document.body.scrollTop;
    }
	
    // Die H�he sichtbar machen
    if ((e.y + locateObject(object).clientHeight) > (document.body.clientHeight)) {
      locateObject(object).style.top = document.body.clientHeight- locateObject(object).clientHeight + scrolltop;
    }
    else {
      locateObject(object).style.top=scrolltop+event.clientY;
    }
    locateObject(object).style.visibility="visible"
    showTooltip_tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);

    return true;
  }
  else if (document.layers) {
    locateObject(object).document.write('<table width="10" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="10" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table></td></tr></table>');
    locateObject(object).document.close();
    locateObject(object).top=e.y+20;
    if ((e.x + 30 + locateObject(object).clip.width) > (window.pageXOffset + window.innerWidth)) {
      locateObject(object).left = e.x - locateObject(object).clip.width-15;
    }
    else {
      locateObject(object).left=e.x + 15;
    }
    // Die H�he sichtbar machen
    if ((e.y + locateObject(object).clip.height) > (window.pageYOffset + window.innerHeight) ) {
      locateObject(object).top = window.innerHeight - locateObject(object).clip.height + window.pageYOffset - 15;
    }
    else {
      locateObject(object).top= e.y;
    }
    // Positionierung
    locateObject(object).visibility="show";
    showTooltip_tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
    return true;
  }
  else {
    return true;
  }
}
