$(document).keypress(function(evt) {
	
	var code = evt.keyCode ? evt.keyCode : evt.charCode ? evt.charCode : evt.which;
	
	var counter = $("#cms_loginKeyCounter");
	var count = counter.val();
	
	if (code==96) {
				
		count = parseInt(count) + 1;		
		counter.val(count);
		
		var counter_text = $("#cms_counter_text");
		
		if (counter_text.length < 1) {
			
			$("<div id='cms_counter_text'></div>")
				.css("background-color","black")
				.css("color","white")
				.css("position","absolute")
				.css("padding","5px")
				.css("font-size","11px")
				.css("top",0)
				.css("left",0)
				.css("display","none")
				.appendTo("body",top);
			
		}
		
		
		switch (count) {
			
			case 2 : 
			case 3 :
			case 4 :
			
				$("#cms_counter_text").text("CMS Login Click #"+count).show();
			
			break;
			
			case 5 : 
			
				counter.val(0);
			
				var opened = $("#cmsLoginWindow").length;
							
				if (opened==1) {
					
					cmsOpenLoginWindow();
					
				} else {
					
					$.get(cmsPath+"includes/login/loginWindow.php",function(data, textStatus){
				
						$("body",document).append(data);
						setupLoginWindow();
										
					});
					
				}			
			
				$("#cms_counter_text").text("CMS Login Loading...").show();
			
			break;	
			
		}

	} else {
		
		counter.val(0);
		
		$("#cms_counter_text").text('').hide();
		
	} // end if
	
});

function addslashes(str) {
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');
return str;
};
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\\\/g,'\\');
str=str.replace(/\\0/g,'\0');
return str;
};
/*
License Notice:

The Firebrand CMS Application IS NOT licensed 
under the GPL or MIT Licenses.  For more information
regarding the Firebrand CMS License, please contact
Firebrand by e-mailing info@firebrandmedia.com
***************************************
*/
