$(function() {
	$( ".datepicker" ).datepicker( {  "dateFormat": "dd/mm/yy" }) ;
	
	
	if($("#rte").length>0)
			{
				tinyMCE.init({
					// General options
					mode : "exact",
					elements : "rte,rte2,rte3,rte4,rte5",
					theme : "advanced",
					plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
					
					file_browser_callback : 'tinyBrowser',
			
					// Theme options
					theme_advanced_buttons1 : "code,fullscreen,bold,italic,underline,formatselect,styleselect, pastetext,pasteword,bullist,numlist,link,unlink,image,cleanup",
					theme_advanced_buttons2 : "",
					theme_advanced_buttons3 : "",
					theme_advanced_toolbar_location : "top",
					theme_advanced_toolbar_align : "left",
					document_base_url : "http://"+window.location.hostname,
					remove_script_host : false,
					relative_urls : false,
					width : "660",
					content_css : "/lib/rte.css"
				});
			}
});

function generateSefUrl()
{
	var name = $("#name").val() ;
	var sef_url = $("#sefUrl").val() ;
	if(sef_url =='')
	{
		name = name.replace("&", "and")
		name = name.toLowerCase() ;
		temp = name.replace(/ /g, /\-/);
		temp = temp.replace(/[^a-z0-9\-]+/g,'');
		$("#sefUrl").val(temp); 
	}
}

function makeSure(msg)
{
	if(msg===undefined)msg='Are you sure?' ;
	var answer= confirm (msg) ;
	if (answer)
		return true ;
	else
		return false ;
}
