//------------------------------------------------------------
// collection of convinience
// js function
//
// last changed : Wed Nov 17 10:50:37 CET 2004
//------------------------------------------------------------

//------------------------------------------------------------
// function : openPopUp
// purpose  : caller for openSmalllWin
// params   : String url, Integer width,
//            Integer height
// return   : nothing
//
//------------------------------------------------------------

function openPopUp(url, w, h)
{
  var posx = 10;
  var posy = 10;
  name = getRandomNum();
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,top='+posy+',left='+posx+',width='+w+',height='+h);");
}

//------------------------------------------------------------
// function : getRandomNum
// purpose  : get a random number a s string
// params   : none
// return   : String randomnumber
//
//------------------------------------------------------------

function getRandomNum ()
{
    var rnd = Math.random().toString();
    var crnd = rnd.replace(/\./, "");
    return crnd;
}


//------------------------------------------------------------
// function : getNoCacheUrl
// purpose  : get a randomnumber decorated url
// params   : url to decorate
// return   : randomnumber decorated url
//
//------------------------------------------------------------

function getNoCacheUrl(url)
{
    var rnd = getRandomNum();
    var cmpdurl=url+"&nd="+rnd;

    return cmpdurl;
}

//------------------------------------------------------------
// function : goNoCacheUrl
// purpose  : get a randomnumber decorated url
// params   : url to decorate
// return   : randomnumber decorated url
//
//------------------------------------------------------------

function goNoCacheUrl(url)
{
    var nocacheurl = getNoCacheUrl(url);

    location.href=nocacheurl;
}

//------------------------------------------------------------
// function : preLoadSomeImages 
// purpose  : preload some images
// params   : images to preload
// return   : 
//
//------------------------------------------------------------

function preLoadSomeImages() 
{ 
	var d=document; 
	if(d.images)
	{ 
		if(!d.MM_p) 
		{
			d.MM_p=new Array();
		}
    	var i,j=d.MM_p.length,a=preLoadSomeImages.arguments; 
		for(i=0; i<a.length; i++)
		{
    		if (a[i].indexOf("#")!=0)
			{ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
		}
	}
}

//------------------------------------------------------------
// function : shoDate
// purpose  : show actual date in page
// params   : none
// return   : actual date
//
//------------------------------------------------------------

function showDate() 
{
  now = new Date();
  tag = new Array("So","Mo","Di","Mi","Do","Fr","Sa");
  return tag[now.getDay()]+". "+now.getDate()+"."+(now.getMonth()+1)+"."+now.getFullYear();
}


//------------------------------------------------------------
// function : pageXWidth
// purpose  : show actual date in page
// params   : none
// return   : actual date
//
//------------------------------------------------------------

function pageXWidth(m) 
{	
	var w = (pageWidth()-998)*0.5+6;
	return w;
} 

function pageWidth() 
	{return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
function pageHeight() 
	{return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null?  document.body.clientHeight : null;} 
function posLeft() 
	{return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} 
function posTop() 
	{return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} 
function posRight() 
	{return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}



//------------------------------------------------------------
// function :
// purpose  :
// params   :
// return   :
//
//------------------------------------------------------------

function absLeft(el) {
	return (el.offsetParent)? 
    el.offsetLeft+absLeft(el.offsetParent) : el.offsetLeft;
}

function absTop(el) {
    return (el.offsetParent)? 
    el.offsetTop+absTop(el.offsetParent) : el.offsetTop;
}

function absMTop(el) {
	var lh=20;
    return (el.offsetParent)? 
    el.offsetTop+absTop(el.offsetParent)+lh : el.offsetTop+lh;
}

