			$(function(){
				$("ul.nav").superfish({
					animation:{
					height: "show",
					width: "show"
					}, speed : 0
				});
					
				//tooltip
				$(".tooltip").easyTooltip();
		
				// Check all the checkboxes when the head one is selected:
				$('.checkall').click(
					function(){
						$(this).parent().parent().parent().parent().find("input[type='checkbox']").attr('checked', $(this).is(':checked'));   
					}
				);

				$(".close").click(
					function () {
						$(this).fadeTo(400, 0, function () { // Links with the class "close" will close parent
							$(this).slideUp(400);
						});
					return false;
					}
				);

				
				
				
				
				
				//sortable, portlets
				$(".column").sortable({
					connectWith: '.column'
				});
				
				$(".sort").sortable({
					connectWith: '.sort'
				});
				

				$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
				.find(".portlet-header")
				.addClass("ui-widget-header ui-corner-all")
				.prepend('<span class="ui-icon ui-icon-circle-arrow-s"></span>')
				.end()
				.find(".portlet-content");

				$(".portlet-header .ui-icon").click(function() {
					$(this).toggleClass("ui-icon-minusthick");
					$(this).parents(".portlet:first").find(".portlet-content").toggle();
				});

				$(".column").disableSelection();
				
				
			
				// Accordion
				$("#accordion").accordion({ header: "h3" });
	
				// Tabs
				$('#tabs').tabs();
	
	
				$(function() { // Shorthand for $(document).ready(function() {
      		$('div.dialog').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					buttons: 
					{
							"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				 });
				
				 
     		$('button.opener').click(function() {
            $('#' + this.id.replace(/opener/, 'dialog')).dialog('open'); // Calculate corresponding ID and open
            return false;
		  	});
			});
	
	
	
	
	
	
				// Dialog	 dialog_popup		
				$('#dialog').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
				$('#dialog_popup').dialog({
					autoOpen: true,
					modal: true,
					width: 500,
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}
					}
				});
				
				// Dialog			
				$('#dialog_upload').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					},
					close: function () {
						$(this).dialog("open");
						reLoad();
		
					}
					
					
				});
				
				
				
				// Dialog			
				$('#dialog_report').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					"Cancel": function() { 
							$(this).dialog("close"); 
						}
					
					
				});
				
				// Dialog			
				$('#dialog_topic_edit').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					"Cancel": function() { 
							$(this).dialog("close"); 
						}
					
					
				});
				
				$('#dialog_reply_edit').dialog({
					autoOpen: false,
					modal: true,
					width: 500,
					"Cancel": function() { 
							$(this).dialog("close"); 
						}
					
					
				});
				
				
				
				function reLoad() {
					// jQuery.post();
					document.forms["uploader"].submit();
				}
				
				// Dialog Link
				$('#dialog_link_upload').click(function(){
					$('#dialog_upload').dialog('open');
					return false;
				});
				
				
				// Dialog Link
				$('#dialog_report_link').click(function(){
					$('#dialog_report').dialog('open');
					return false;
				});
				
				
				// Dialog Link
				$('#dialog_link').click(function(){
					$('#dialog').dialog('open');
					return false;
				});
				
				// Dialog Link
				$('#dialog_topic_edit_link').click(function(){
					$('#dialog_topic_edit').dialog('open');
					return false;
				});
				
				// Dialog Link
				$('#dialog_reply_edit_link').click(function(){
					$('#dialog_reply_edit').dialog('open');
					return false;
				});

				// Datepicker
				$('#datepicker').datepicker({
					inline: true,
					changeMonth: true,
					width: 100,
					changeYear: true,
					dateFormat: 'yy-mm-dd',
					altFormat: 'yy-mm-dd',
					yearRange: '1930:2013'
				});
				
				// Datepicker
				$('#datepicker_start').datepicker({
					inline: true,
					changeMonth: true,
					width: 100,
					changeYear: true,
					dateFormat: 'yy-mm-dd',
					altFormat: 'yy-mm-dd',
					yearRange: '2010:2013'
				});
				
				// Datepicker
				$('#datepicker_end').datepicker({
					inline: true,
					changeMonth: true,
					width: 100,
					changeYear: true,
					dateFormat: 'yy-mm-dd',
					altFormat: 'yy-mm-dd',
					yearRange: '2010:2013'
				});
				
				// Slider
				$('#slider').slider({
					range: true,
					values: [20, 70]
				});
				
				// Progressbar
				$("#progressbar").progressbar({
					value: 40 
				});
				
				//hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
		
				$('#wysiwyg').wysiwyg({
		  controls: {
			bold          : { visible : true },
			italic        : { visible : true },
			underline     : { visible : true },
			strikeThrough : { visible : true },
			
			justifyLeft   : { visible : true },
			justifyCenter : { visible : true },
			justifyRight  : { visible : true },
			justifyFull   : { visible : true },

			indent  : { visible : true },
			outdent : { visible : true },

			subscript   : { visible : true },
			superscript : { visible : true },
			
			undo : { visible : true },
			redo : { visible : true },
			
			insertOrderedList    : { visible : true },
			insertUnorderedList  : { visible : true },
			insertHorizontalRule : { visible : true },

			h4: {
				visible: true,
				className: 'h4',
				command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
				arguments: ($.browser.msie || $.browser.safari) ? '<h4>' : 'h4',
				tags: ['h4'],
				tooltip: 'Header 4'
			},
			h5: {
				visible: true,
				className: 'h5',
				command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
				arguments: ($.browser.msie || $.browser.safari) ? '<h5>' : 'h5',
				tags: ['h5'],
				tooltip: 'Header 5'
			},
			h6: {
				visible: true,
				className: 'h6',
				command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
				arguments: ($.browser.msie || $.browser.safari) ? '<h6>' : 'h6',
				tags: ['h6'],
				tooltip: 'Header 6'
			},
			
			cut   : { visible : true },
			copy  : { visible : true },
			paste : { visible : true },
			html  : { visible: true },
			increaseFontSize : { visible : true },
			decreaseFontSize : { visible : true },
			exam_html: {
				exec: function() {
					this.insertHtml('<abbr title="exam">Jam</abbr>');
					return true;
				},
				visible: true
			}
		  },
		  events: {
			click: function(event) {
				if ($("#click-inform:checked").length > 0) {
					event.preventDefault();
					alert("You have clicked jWysiwyg content!");
				}
			}
		  }
		});

		$('#wysiwyg').wysiwyg("insertHtml", "Sample code");
	


			});

