function openwindow(winname,breite,hoehe) {
	var links=screen.width/2-breite/2;
	var oben=screen.height/2-hoehe/2;
	NewWin = window.open(winname, "titel", "width="+breite+",height="+hoehe+",top="+oben+",left="+links+", toolbars=no, scrollbars=yes, resizable=yes");
}

function openPicWindow(picurl, picwidth, picheight)
{
	var picleft=screen.width/2-picwidth/2;
	var pictop=screen.height/2-picheight/2;
	
    var newWindow = window.open("Image", "Image", 
        "toolbars=no, scrollbars=no, location=no, directories=no, fullscreen=no, menubar=no, status=no, width=" + picwidth + ", height=" + picheight + ", top="+pictop+",left="+picleft);
    newWindow.document.writeln("<html>");
    newWindow.document.writeln("<body style='margin: 0 0 0 0;'>");
    newWindow.document.writeln("<a href='javascript:window.close();'>");
    newWindow.document.writeln("<img src='" + picurl + "' alt='Click to close' id='bigImage' style='border:0;'/>");
    newWindow.document.writeln("</a>");
    newWindow.document.writeln("</body></html>");
    newWindow.document.close();
}

function toggle( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // standards
	elem = document.getElementById( whichLayer );
  else if( document.all ) // old MS-IE
	  elem = document.all[whichLayer];
  else if( document.layers ) // nn4
	elem = document.layers[whichLayer];
  vis = elem.style;
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

// Hightlight table rows using mootools
var tableHighlighter = new Class({	
	
	options: {
			rowColourClass: 'highlighted',
			rowHoverColourClass: 'hoverHighlighted',
			highlightRow: 'even',
			everyOther: 0
	},
	
	initialize: function( id, options ) {		
		this.setOptions( options );
		
		if( this.options.highlightRow == 'odd' ){
			this.options.everyOther = 1;
		}	
		this.rows = $(id).getElementsByTagName('tr');
		this.rowsLength = this.rows.length;		
		this.addHighlighting();				
	},
	
	addHighlighting: function(){		
		var hoverClass = this.options.rowHoverColourClass;			
		for( var i = 0; i < this.rowsLength; i++ ){
			$( this.rows[i] ).addEvents({
				'mouseover': function(){ this.addClass( hoverClass ); },
				'focus': function(){ this.addClass( hoverClass ); },
				'mouseout': function(){ this.removeClass( hoverClass ); },
				'blur': function(){ this.removeClass( hoverClass ); }
			});		
			if( this.options.everyOther != 0 ){
				this.rows[i].addClass( this.options.rowColourClass );
				this.options.everyOther = -1;
			}			
			this.options.everyOther++;			
		}		
	}	
});
tableHighlighter.implement(new Options);

/*
Function: $get
	This function provides access to the "get" variable scope + the element anchor

Version: 1.3

Arguments:
	key - string; optional; the parameter key to search for in the url's query string (can also be "#" for the element anchor)
	url - url; optional; the url to check for "key" in, location.href is default

Example:
	>$get("foo","http://example.com/?foo=bar"); //returns "bar"
	>$get("foo"); //returns the value of the "foo" variable if it's present in the current url(location.href)
	>$get("#","http://example.com/#moo"); //returns "moo"
	>$get("#"); //returns the element anchor if any, but from the current url (location.href)
	>$get(,"http://example.com/?foo=bar&bar=foo"); //returns {foo:'bar',bar:'foo'}
	>$get(,"http://example.com/?foo=bar&bar=foo#moo"); //returns {foo:'bar',bar:'foo',hash:'moo'}
	>$get(); //returns same as above, but from the current url (location.href)
	>$get("?"); //returns the query string (without ? and element anchor) from the current url (location.href)

Returns:
	Returns the value of the variable form the provided key, or an object with the current GET variables plus the element anchor (if any)
	Returns "" if the variable is not present in the given query string

Credits:
		Regex from [url=http://www.netlobo.com/url_query_string_javascript.html]http://www.netlobo.com/url_query_string_javascript.html[/url]
		Function by Jens Anders Bakke, webfreak.no
*/
function $get(key,url){
	if(arguments.length < 2) url =location.href;
	if(arguments.length > 0 && key != ""){
		if(key == "#"){
			var regex = new RegExp("[#]([^$]*)");
		} else if(key == "?"){
			var regex = new RegExp("[?]([^#$]*)");
		} else {
			var regex = new RegExp("[?&]"+key+"=([^&#]*)");
		}
		var results = regex.exec(url);
		return (results == null )? "" : results[1];
	} else {
		url = url.split("?");
		var results = {};
			if(url.length > 1){
				url = url[1].split("#");
				if(url.length > 1) results["hash"] = url[1];
				url[0].split("&").each(function(item,index){
					item = item.split("=");
					results[item[0]] = item[1];
				});
			}
		return results;
	}
}
