$(function(){
	init();
});
init=function(){
	$(".lightbox").lightbox();
	$(".nav").hover(
        function(){ $(this).animate({"backgroundColor":"#f2f2f2"}).children(".a").animate({"marginLeft":"5px"}).children("a").animate({"color":"#0000ff"}); },
        function(){ $(this).animate({"backgroundColor":"#cccccc"}).children(".a").animate({"marginLeft":"0px"}).children("a").animate({"color":"#000033"}); }
	);
	if($.browser.name!="msie"){
		$(".round_tab").cornerz({radius:7,corners:"tl tr",background:"#ffffff"});
		$(".round_tab_b").cornerz({radius:7,corners:"br bl",background:"#ffffff"});
	}
}
function sTab(tab,showonly){
	$(".tab").hide();
	$("#"+showonly).show();
	$(tab).parent().parent("div.tab_header").children("div.tab_child,div.tab_child_sel").removeClass("tab_child").addClass("tab_child_sel");
	$(tab).parent().removeClass("tab_child_sel").addClass("tab_child");
}
tinyMCE_init=function(){
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "editor",
		theme : "advanced",
		skin : "o2k7",
		skin_variant : "silver",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		// Example content CSS (should be your site CSS)
		content_css : "css_mce.css",
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",
		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "editor2",
		theme : "advanced",
		skin : "o2k7",
		skin_variant : "silver",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		// Example content CSS (should be your site CSS)
		content_css : "css_mce.css",
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",
		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
}
var lastpage;
var lastobj;
var load_html="";
prepares=function(url, obj, fn, fx){
	prepare(url, obj, fn, fx, load_html);
}
prepare=function(url, obj, fn, fx, loader){
	lastpage=url;
	if(!obj){obj="content"};
	lastobj=obj;
	if(!loader){
		load_gif_=load_html;
	}else{
		load_gif_=loader;
	}
	if(fx!=null){
		$.get(url,function(res_data){
			$("#"+obj).html(res_data);
			init();
			if(fn!=null){fn();}
		})
	}else{
		if($("#"+obj).html()==""){
			$("#"+obj).html(load_gif_).fadeIn("normal",function(){
				$.get(url,function(res_data){
					$("#"+obj).fadeOut("fast",function(){
						$("#"+obj).html(res_data).fadeIn("normal",function(){
							init();
							if(fn!=null){fn();}
						});
					});
				});
			});
		}else{
			$("#"+obj).fadeOut("fast",function(){
				$("#"+obj).html("");
				$("#"+obj).html(load_gif_).fadeIn("normal",function(){
					$.get(url,function(res_data){
						$("#"+obj).fadeOut("fast",function(){
							$("#"+obj).html(res_data).fadeIn("normal",function(){
								init();
								if(fn!=null){fn();}
							});
						});
					});
				});
			});
		}
	}
}
setForm=function(form,target,fn,loadfx){
	if(loadfx!=null){
		loader=loadfx;
	}else{
		loader=load_html;
	}
	$("#"+form).ajaxForm({
		target:"#"+target,
		beforeSubmit:function(){
			$("#"+target).html(loader);
		},
		success:function(){
			$("#"+target).fadeIn("slow");
			init();
			if(fn!=null){fn();}
		}
	});
}

