var Index = {
	validate: function(f) {
		if(f.sltCoutry.value=='------------------------' || f.sltCoutry.value=='0')
			return display_error('Please choose a country', f.sltCoutry);
		if(f.month.value=='0')
			return display_error('Please select month', f.month);
		if(f.day.value=='0')
			return display_error('Please select month', f.day);
		if(f.year.value=='0')
			return display_error('Please select month', f.year);
		if(!f.accept.checked)
			return display_error('Please accept the agreement', null);
		f.submit();
		return true;
	}
};

var Event = {
	init: function() {
		this.popup_fra = new PopUp(),
		this.popup_fra.Init('popup_fra');
		this.popup_fra.maxHeight=250;
		this.popup_fra.minHeight=10;
	},
	
	show: function(obj, content) {
		this.popup_fra.Show(obj,'top',content, 7, -5, 5, 5);
	},
	
	hide: function() {
		this.popup_fra.Hide()
	},

	count: function(f) {
		var count = 0;
		for (var i=0; i<20; i++)
			if(f.elements['song'+i] && f.elements['song'+i].checked)
				count++;
		return count;
	},
	
	validate: function(e,mp3) {
		if (this.count(e.form)>3) {
			alert('Sorry - only three tracks per playa');
			e.checked=false;
			return false;
		}
//		if (e.checked)
//			play(mp3);
		return true;
	}
};

var Register = {
	confirm: function() {
		var f = document.forms["register"];
		if (!f.name.value) {
			alert("Please enter your name");
			f.name.focus();
		} else if (!f.email.value) {
			alert("Please enter your e-mail");
			f.email.focus();
		} else if (!f.email.value.match(/^\w[\w\.\-\_]*\@[\w\.\-\_]+\w$/)) {
			alert("Please enter correct e-mail");
			f.email.focus();
		} else if (!f.zip.value) {
			alert("Please specify your zip code");
			f.zip.focus();
		} else if (f.id.value!="999" && Event.count(f)==0) {
			alert("Please select the three tracks you most want to hear at the event");
		} else
			return true;
		return false;
	}
};