

$(document).ready(function() {

	$.ctrl2("L", function() {			
		if($("#ct-incontent-login").is(":visible")) {
			$("#ct-incontent-login").remove();
		} else {
			$("body").append('<div id="ct-incontent-login" style="width: 260px; height: 115px; padding: 20px; position: fixed; z-index: 9999; left: 50%; top: 50%; margin: -120px 0 0 -150px; background-color: #000;">'+
			'<form action="" method="post" style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;">'+
			'<div style="color: #FFF">Anv&atilde;ndarnamn:</div>'+
			'<input id="ct-username-focus" style="width: 260px; height: 22px; margin-bottom: 10px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;" type="text" name="username" value="" />'+
			'<div style="color: #FFF">L&ouml;senord:</div>'+
			'<input style="width: 260px; height: 22px; margin-bottom: 10px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;" type="password" name="password" value="" />'+
			'<input style="font-size: 12px; font-family: Arial, Helvetica, sans-serif; color: #000000; background-color: #CCCCCC; padding: 2px 4px; cursor: pointer;" type="submit" name="ct-in_content-submit" value="Logga in" />'+
			'</form>'+
			'</div>');
			
		}
		$("#ct-username-focus").focus();
		return true;
	});
	
});

$.ctrl2 = function(key, callback, args) {
    var isCtrl = false;
    $(document).keydown(function(e) {
        if(!args) args=[]; // IE barks when args is null

        if(e.ctrlKey) isCtrl = true;
        if(e.keyCode == key.charCodeAt(0) && isCtrl) {
            callback.apply(this, args);
            return false;
        }
    }).keyup(function(e) {
        if(e.ctrlKey) isCtrl = false;
    });
};
