var Confirmation = new function () {
  var confirmHandle = null;
  var ctx;
  return ctx = {
  	reload : function(msg, url) {
  		confirmHandle = confirm(msg);
  		if (confirmHandle) {
  			window.location.href = url;
  			confirmHandle = null;
  		} else {
  			confirmHandle = null;
  		}
  		return false;
  	}
  }
}

function datePickerInit() {
	  $('.calendar').datepicker({
	      showOn: 'button',
	      dateFormat: 'yy-mm-dd',
	      buttonImage: RESOURCES_IMG + '/calendar.gif', 
	      buttonImageOnly: true,
	      onClose: function(dateText, inst) {
	           $(this).trigger('focus');
	           $(this).trigger('blur');
	        }
	    });
	}

function initMCE(selector, height) { 
 if (!height) {
   height = '200px';
 }
 $(selector).tinymce({
    // Location of TinyMCE script
    script_url : RESOURCES_JS + '/tiny_mce/tiny_mce.js',
 
    // General options
    theme : "advanced",
    plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
 
    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,help,code,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,charmap,emotions,iespell,media",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : false,
    relative_urls: false,
    content_css : RESOURCES_CSS + "/tinymce_config.css",
    height: height,
    width: '100%'
 });
}
