$(document).ready(function() {
	setLoginIcon();
	checkLoginBox();
});

function switchLoginBox() {
	if ($('#loginBox').css("display") == "none") {
			$('#loginBox').css("display", "block");
			$('#secure').css("background-color", "#F0F0F0");
			$('#secure').css("border-bottom", "3px solid #F0F0F0");
		} else {
			$('#loginBox').css("display", "none");
			$('#secure').css("background-color", "#FFFFFF");
			$('#secure').css("border-bottom", "none");
		}
}

function setLoginIcon() {
	try {
		if (document.getElementById("user") || document.getElementById("login-forgot-pw")) {
			throw true;
		} else {
			throw false;
		}
	} catch (e) {
		if (e == true) {
			// Ändere nichts
			return;
		} else if (e == false) {
			//Change lock Icon
				document.getElementById("switchLoginBox").style.background = 'url("fileadmin/clc/templates/img/login_locked.gif") no-repeat scroll 0 1px transparent';
			return;
		}
	}
}

function checkLoginBox(){
	if (document.getElementById("login-forgot-pw")) {
		$('#loginBox').css("display", "block");
		$('#secure').css("background-color", "#F0F0F0");
		$('#secure').css("border-bottom", "3px solid #F0F0F0");
	}
	if (!(document.getElementById("logout-show") || document.getElementById("user") || document.getElementById("login-forgot-pw"))) {
		$('#loginBox').css("display", "block");
		$('#secure').css("background-color", "#F0F0F0");
		$('#secure').css("border-bottom", "3px solid #F0F0F0");
		//$temp_box = document.getElementById("loginBox");
		//$temp_box.("div").css("display", "block");
		$('div.status-header').css("display", "block");
		$('div.status-message').css("display", "block");
	}
}

function focusEl(el) {
    if(el.value == el.defaultValue) el.value = '';
    if(el.id == "pass") el.type = "password";
}
function blurEl(el) {
	if(!el.value && el.id == "pass") el.type = "text";
	if(!el.value) el.value = el.defaultValue;    
}

//String.prototype.get = function(p){
//    return (match = this.match(new RegExp("[?|[]?" + p + "]=([^&]*)"))) ? match[1] : false;
//}
