$(document).ready(function() {
	jQuery.fn.exists = function() {
		return ( this.is('*') );
	};
	
	// Accordion
				$("#accordion").accordion({ header: "h3" });
	
				// Tabs
				$('#tabs').tabs();
	

				// Dialog			
				$('#dialog').dialog({
					autoOpen: false,
					width: 600,
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
				
				// Dialog Link
				$('#dialog_link').click(function(){
					$('#dialog').dialog('open');
					return false;
				});

				// Datepicker
				$('#datepicker').datepicker({
					inline: true
				});
				
				// Slider
				$('#slider').slider({
					range: true,
					values: [17, 67]
				});
				
				// Progressbar
				$("#progressbar").progressbar({
					value: 20 
				});
				
				//hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
				
				$("#myController").jFlow({
					controller: ".jFlowControl", // must be class, use . sign
					slideWrapper : "#jFlowSlider", // must be id, use # sign
					slides: "#mySlides",  // the div where all your sliding divs are nested in
					selectedWrapper: "jFlowSelected",  // just pure text, no sign
					width: "970px",  // this is the width for the content-slider
					height: "50px",  // this is the height for the content-slider
					duration: 400,  // time in miliseconds to transition one slide
					prev: ".jFlowPrev", // must be class, use . sign
					next: ".jFlowNext", // must be class, use . sign
					auto: true	
				});
			
				$('.slideshow')
						.before('<div id="hero-nav">')
						.cycle({
					fx: 'fade',
						timeout: 10000,
						pager:  '#hero-nav'
				});
});
