function isNumeric(val) {
	if (isNaN(parseFloat(val))) {
		return false;
	}
	return true;
}

function isEmail(val) {
	filter = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	if (!filter.test(val)) {
		return false;
	}
	return true;
}

function loadWYSIWYG() {
	tinyMCE.init({
		entity_encoding : "raw",
		theme : "advanced",
		mode : "textareas",
		editor_selector : "editor",
		plugins : "save,contextmenu,paste,fullscreen,table,imagemanager,media",
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,"
			+ "justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,"
			+ "bullist,numlist,outdent,indent,separator,fullscreen",
		theme_advanced_buttons2 : "link,unlink,anchor,separator,image,insertimage,media,separator,"
			+"undo,redo,cleanup,separator,tablecontrols,separator,code,separator,charmap,forecolor",
		theme_advanced_buttons3 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		height : "305px",
		width : "645px",
		extended_valid_elements : "iframe[src|width|height|name|align]",
		external_link_list_url : "/inc/pageListJS.php"
	});
}



$(function(){

	$('ul.dropdownmenu').hover(function() {
		$('#submenu').stop(true, true);
		$('#submenu').slideDown();
	},
	function() {
		$('#submenu').slideUp(300, function () {
			$(this).hide();
		});

	});

});

// Get the lastest event
function lastest_event(){
	$.ajax({
		url: "../ajax/lastest_event.php",
		success: function(eventId){
			$(event_content(eventId));
		}
	});
}

function event_content(id){
	$.ajax({
		url: "../ajax/getCatelogText.php?id="+ id,
		success: function(data){
			$("#event_content").html(data);
			$("#recent_events img").hide();
			$("#img_arrowevent_"+id).show();
		}
	});
}


