$(document).ready(function(){

	$('#login_form, #create_user_form').submit(function(e){
		console.log($(this));
		$('input', $(this)).each(function(){
			if($(this).val() == ''){
				alert('All fields in the form are required');
				$(this).focus();
				e.preventDefault();
				e.stopPropagation();
				return false;
			}
		});
	});

});

function fnctNewWin( url, options ) {
	var new_win = window.open(url, "_new_window", options);
	if (new_win != null) 
	{
		if (new_win.opener == null) 
		{
			new_win.opener = self;
		}
	}
	if (navigator.appVersion.toLowerCase().indexOf("msie") != -1 && parseInt(navigator.appVersion) <= 4 && navigator.appVersion.toLowerCase().indexOf("msie 5.0") == -1) 
	{
		//Older versions of IE can't handle the focus
	}
	else new_win.focus();
}

function setCookie(cookieName,cookieValue) {
	var today = new Date();
	var expire = new Date();
	var nDays=365;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)
				 + ";expires="+expire.toGMTString();
}
function getCookie(name) { // use: getCookie("name");
	var index = document.cookie.indexOf(name + "=");
	if (index == -1) return null;
	index = document.cookie.indexOf("=", index) + 1;
	var endstr = document.cookie.indexOf(";", index);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(index, endstr));
}

//CATCH CONSOLE.LOG FOR NO-FIREBUG
if (typeof console == 'undefined' || typeof console.log == 'undefined') { console = { log : function (text) { return false; } } }
