﻿/**
  * 
  *  Javasfript functions
  *  @author: Matthias Pieroth
  */


/**
  * Open an external window on centered screen position
  */
function OpenCenteredWindow(s_url, s_caption, w, h)
{
    var nwl = (screen.width-w)/2;
    var nwh = (screen.height-h)/2;
    popUp=window.open(s_url, s_caption, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',left='+nwl+',top='+nwh+'');
    popUp.focus();
}

var myWindow;

/**
  * Open an extarnal window on a special position
  */
function OpenWindow( url, caption, x, y, w, h )
{
	myWindow = window.open(url, caption, "top=" + x + ",left=" + y + ",width=" + w + ",height=" + h + ",scrollbars=no");
	myWindow.focus();
	
}

/**
  *  check in the Event e for the enter-key
  *
  *  @param e is event object passed from function invocation
  */
function checkEnter(e){ 
    
    if(e && e.which){
    
        characterCode = e.which;
    }
    else{
        e = event;
        characterCode = e.keyCode;
    }

    //if generated character code is equal to ascii 13 (if enter key)
    if(characterCode == 13){ 
    
        return true;
    }
    else{
        return false; 
    }

}

var offsetx = 12;
var offsety =  8;


var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e)
{
    if(document.getElementById)
    {
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('idFriendImage');
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
    }
}