$(document).ready(function() {
	$('#username').focus(function(e){
		if(this.value == 'Benutzername') {
			this.value = '';
		}
	});
	$('#username').blur(function(e){
		if(this.value == '') {
			this.value = 'Benutzername';
		}
	});
	$('#userpassword').focus(function(e){
		if(this.value == 'Passwort') {
			this.value = '';
			this.type = 'password';
		}
	});
	$('#userpassword').blur(function(e){
		if(this.value == '') {
			this.value = 'Passwort';
			this.type = 'text';
		}
	});
});

$(function() {
	$('a.imgLink').lightBox({
		imageLoading: js_href + 'lightbox/images/lightbox-ico-loading.gif',
		imageBtnPrev: js_href + 'lightbox/images/lightbox-btn-prev.gif',
		imageBtnNext: js_href + 'lightbox/images/lightbox-btn-next.gif',
		imageBtnClose: js_href + 'lightbox/images/lightbox-btn-close.gif',
		imageBlank: js_href + 'lightbox/images/lightbox-blank.gif',
		txtImage: 'Bild',
		txtOf: 'von'
	});
});

var hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");

//Function to convert hex format to a rgb color
function rgb2hex(rgb) {
	rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
	return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
function hex(x) {
	return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
}
function getHeadlineColor() {
	var c = $('h1').css('color');
	return (c.substr(0,1) == '#') ? c : rgb2hex(c);
}
