/*



*/

//ADDED BY SDM, automatically do this
document.observe("dom:loaded", function() {
	
	$$('.sort').each(function(item) {
		//if ( (typeof(window['wishesSort']) == "undefined") ) {
		if ( item.id )
			newSort = new TableSorter(item.id,true);
	});
	
	$$('.ckeditor').each(function(item) {
		var oFCKeditor = new FCKeditor( item.id ) ;
		oFCKeditor.ToolbarSet = "Grace";
		oFCKeditor.Height = 300;
		oFCKeditor.Config["CustomConfigurationsPath"] = "/FCKeditor/grace2.js";
		oFCKeditor.ReplaceTextarea();
	});
	
	//Allow a print button to automatically print on page load
	if ( $('autoprint') ) {
		window.print();
		$('autoprint').hide();
	}
	$$('.calpopup').each(function(item) {

		item.parentNode.appendChild(
			new Element('img',{src: '/images/calendarapp/calendar.jpg', width: '16', height: '15', border: '0', hspace: '2', id: item.id+'_trigger', alt: 'show calendar', style: 'cursor: pointer'})
			//new Element('input',{type: 'button', id: item.id+'_trigger', value: 'show calendar'})
		);
		Calendar.setup(
    {
      dateField  : item.id,         // ID of the input field
			dateFormat : "%m/%d/%Y",
			triggerElement : item.id+'_trigger'       // ID of the button    
    });

	});
	
	//alert("welcome to the g_common");
	
});

