/* scrolly navigation */
var name = "#locationC";
var menuYloc = null;
$(document).ready(function(){
	menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
	$(window).scroll(function () { 
		offset = menuYloc+$(document).scrollTop()+"px";
		$(name).animate({top:offset},{duration:1000,queue:false});
	});
});

$(document).ready(function(){
	$('#regForm').submit(function(e) {
		register();
		e.preventDefault();
	});
});

function register(){
	hideshow('loading',1);
	error(0);
	$.ajax({
		type: "POST",
		url: "submit.php",
		data: $('#regForm').serialize(),
		dataType: "json",
		success: function(msg){
			
			if(parseInt(msg.status)==1){
				window.location=msg.txt;
			}
			else if(parseInt(msg.status)==0){
				error(1,msg.txt);
			}
			
			hideshow('loading',0);
		}
	});
}

function hideshow(el,act){
	if(act) $('#'+el).css('visibility','visible');
	else $('#'+el).css('visibility','hidden');
}

function error(act,txt){
	hideshow('error',act);
	if(txt) $('#error').html(txt);
}


