// Sitewide Admin scripts using jquery
$(document).ready(function() {
//jquery Datepicker
	Date.firstDayOfWeek = 7; //show sunday through saturday
	Date.format = 'mm/dd/yyyy'; //show desired date format
	$('.form_date').datePicker({startDate:'01/01/1996'});
	//validate date using validate_date.js
	$(".form_date").blur(function() {
		checkdate(this);
	});
	
//jquery tablesorter
    $(".tablesorter").tablesorter({widgets: ['zebra']});
	$(".tablesorter tbody tr").hover(function() {$(this).addClass("over");}, function() {$(this).removeClass("over");});
	
//multiple fileupload
	$(".multifile").multifile();	
	
//upload window for fileupload
	$('#upload_window a').click(function() {
		window.open(this.href,'Upload','width=550,height=200,scrollbars=1,resizable=1,status=0,toolbar=0');
		return false;
	});
	
//show upload graphic
	$("#upload").submit(function() {
		$("#progress").show();
	});
	
//Confirm Delete
	$(".delete_item").click(function() {
		var answer = confirm('Are you sure you want to delete?');
		return answer // answer is a boolean
	});
	
//add tooltip to files to show preview
	$("a.preview").filetip();
	
//WYSIWYG Rich Text Editor using HtmlBox
	if ($("textarea").hasClass("form_rte")) {
		$(".form_rte").htmlbox({
			toolbars:[
				 [
				  // Bold, Italic, Underline
				  "bold","italic","underline","strike",
				  // Left, Right, Center, Justify
				  "separator","left","center","right","justify",
				  // Ordered List, Unordered List, Indent, Outdent
				  "separator","ol","ul","indent","outdent",
				  // Hyperlink, unlink, Image
				  "separator","link","unlink","image",
				  //remove format, strip tags, HTML code view
				  "separator","removeformat","striptags","code"
				  ]
			],
			idir:"images/htmlbox/",
			icons:"silk",
			skin:"blue",
			about:false,
			css: "body{background:#F9F9F9}"
		});
	}
	
});