//TINY MCE
$().ready(function() {
					$('#editor').hide();
					
					$('.tinyMCE').tinymce({
						// Location of TinyMCE script
						script_url : '/inc/jquery/tinyMCE/tiny_mce.js',
			
						// General options
						theme : "advanced",
						height:500,
						width:400,
						theme_advanced_blockformats : "Paragraph=p,Block=div,Definition List=dl,Definition Term=dt,Definition Data=dd,Page Title=h1,Section Title=h2,Sub Heading=h3,Sub Heading 2=h4,Sub Heading 3=h5,Sub Heading 4=h6",
						template_templates : [
							{
								title : "Two Columns",
								src : "/dyna/templates/two_columns.html",
								description : "Have information displayed side by side, handy for pictures and slide shows."
							}							
						],
						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",
						valid_elements : "*[*]",
						extended_valid_elements : "*[*]",			
						// Theme options
						theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect",
						theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
						theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,|,print,|,ltr,rtl,|,fullscreen",
						theme_advanced_buttons4 : "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 : "/inc/css/cs.css,/inc/css/editor.css"						
									
					});
					$('#editor').fadeIn(4000);
					
				});
 
$(document).ready( function(){
		
		
	   	  //$('fieldset').corners('10px');
		  $(".autogrow").autogrow(); //TEXT AREAS
		  //$('.rounded').corners();
		  $('.validate').validate(); //FORM VALIDATION
		
		  //Calendar
		  $('.calendar').datepicker();
		  
		  //Even and Odd
		  $('p:even').addClass('p_even');
		  $('p:odd').addClass('p_odd');
		  
		  $('tr:even').addClass('td_even');
		  $('tr:odd').addClass('td_odd');
		  
		  $('.sectionContent:even').addClass('sectionContentEven');
		  
		  $('li:even').addClass('li_even');
		  $('li:odd').addClass('li_odd');
		  
		  $('dl:even').addClass('dl_even');
		  $('dl:odd').addClass('dl_odd');
		  
		});		

$(function() {	
	$('#tt_adsAdBlock') 
	.cycle({ 
		fx:     'turnDown', 
		speed:   2000,
		timeout: 15000	
	});
});

function theClear()
	{
		var o = document.getElementById('siteSearchCriteria');
		o.value='';
	}
		
		
//NAVIGATION STUFF
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//AJAX LOADER
 $().ready(function() {
setTimeout(function(){ $('#loader').fadeOut('slow'); }, 4000);
					});
 
 
//DRAG N DROP FOR NAV ADMIN
$(document).ready(function() {
	$(".draggable").tableDnD();
	
	$('.draggable').tableDnD({
		onDragClass: "myDragClass",
		onDrop: function(table, row) {
		  // alert($.tableDnD.serialize());
			$("#status").load("/dyna/index.php?mode=arrangeMenu&menu="+$.tableDnD.serialize());
			$("#nav").load("/dyna/?mode=getMenu");	
		}
		
	});
});
