
$(document).ready(function()
{
	//get last releases
	$("#txt_band").autocomplete("aj_search.php", {
		width: 260,
		selectFirst: false
		});
	$("#txt_band").result(function(event, data, formatted)
	{
		data=data+"";   
		id=data.split(",")[1];
		$("#band_id").val(data.split(",")[0]+"#"+id+"|");
	}
	);
}
);
Shadowbox.init({
	players: ["iframe"]
	});	
var timer;

function chk_me()
{
	clearTimeout(timer);
	$("#artists").html("Loading...")
		timer=setTimeout("check_bands()",1100);
}

function add_band()
{
	if($("#band_id").val()!="")
	{
		if($("#hidden_bands").val().indexOf($("#band_id").val())>=0)
			alert("You have chose this band")
			else
		{
			$("#hidden_bands").val($("#hidden_bands").val()+$("#band_id").val());
			$("#band_list").append($("#band_id").val().split("#")[0]+", ");
		}
		}else
	alert("Please, select an artist. Always select the artist name from the list");
}

function valid()
{
	if($("#hidden_bands").val()=="")
	{
		alert("Select at least one band to follow");
		return false;
	}
	if(($("#email").val()!=$("#email_c").val()) || ($("#email").val()==""))
	{
		alert("Email are wrong");
		return false;
	}
	if(($("#pass").val()!=$("#pass_c").val()) || ($("#pass").val()==""))
	{
		alert("Verify your password");
		return false;
	}
	if($("#city").val()=="")
	{
		alert("Indicate a city");
		return false;
	}
	if($("#countries").val()=="")
	{
		alert("Indicate a country");
		return false;
	}
	return true;
}
