var check_country = function(){
	if(jQuery('#country').val() == 'US') {
		jQuery('#us_states').show();
		jQuery('#none_us').hide();
	}
	else{
		jQuery('#us_states').hide();
		jQuery('#none_us').show();
	}
};

function doSubmit() {
     		document.login.f_pass.value = MD5(document.login.clearpass.value);
     		document.login.clearpass.value = "";
     		document.login.submit();
}

function fb_popup() {
	var answer = window.confirm("Do you wish to connect to your Facebook account?");
	if(answer)
		top.location.href="http://www.facebook.com/dialog/oauth?client_id=APP_ID&redirect_uri="+escape('http://ipv6.he.net/certification/fb_process.php')+"&scope=publish_stream";
	else
		alert("No Facebook");
}

function validate_regform(fn) {
	var k = $(fn).attr('id');
	var val = jQuery("#"+k).val();
	jQuery.post('register.php?ajax=true', {f: k, v:val},
          	function(res){
			if(res.status == 1)
			{
				jQuery("#error_"+k).css({"color":"blue"});
				jQuery("#error_"+k).html(res.message);
				jQuery("#"+k).css({"background-color": "lightblue"});
				return true;
			}
			else
			{
				jQuery("#error_"+k).css({"color":"red"});
				jQuery("#error_"+k).html(res.message);
				jQuery("#"+k).css({"background-color": "#f86d6d"});
				return false;
			}
            	}, 'json');
}

function validate_acform(fn) {
	var k = $(fn).attr('id');
	var val = jQuery("#"+k).val();
	jQuery.post('account.php?ajax=true', {f: k, v:val},
          	function(res){
			if(res.status == 1)
			{
				jQuery("#error_"+k).css({"color":"blue"});
				jQuery("#error_"+k).html(res.message);
				jQuery("#"+k).css({"background-color": "lightblue"});
				return true;
			}
			else
			{
				jQuery("#error_"+k).css({"color":"red"});
				jQuery("#error_"+k).html(res.message);
				jQuery("#"+k).css({"background-color": "#f86d6d"});
				return false;
			}
            	}, 'json');
}




