// Accordion Nav
$(document).ready(function()
{
	 //slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
	 $("#firstpane p.menu_head").click(function()
	 {
		$(this).next("div.menu_body").slideToggle(400).siblings("div.menu_body").slideUp("slow");

	 });
}); 


// IE PNG Fix
$(document).ready(function(){
  if (jQuery.browser.msie && jQuery.browser.version <= 6){
	jQuery.getScript("/javascripts/DD_belatedPNG_0.0.8a-min.js", function(){DD_belatedPNG.fix('#banner, #content, #footer, #green-bar, #header1, #header2, #header3');});   
  }
});


// Slider
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function() {
    setInterval( "slideSwitch()", 3000 );
});


// No Idea
$(document).ready(function() {
    $("#demo img[title], a[title], input[title], span[title]").tooltip('#demotip');
});

// Clinic Description Toggle
$(document).ready(function() {
    $(".toggleClinicDescription").toggle(
    function(event){
        event.preventDefault();
        $(this).parent().next().show();
        $(this).html("Hide");
    },
    function (event){
        event.preventDefault();
        $(this).parent().next().hide();
        $(this).html("Show");
    });

    $(".clinicRegistrationToggle").toggle(
    function(event){
        event.preventDefault();
        $(this).parent().next().show();
    },
    function(event){
        event.preventDefault();
        $(this).parent().next().hide();
    });

    $(".adminDetailsToggle").toggle(
    function(event){
        event.preventDefault();
        $(this).parent().next().show();
    },
    function(event){
        event.preventDefault();
        $(this).parent().next().hide();
    });


	$(document).ready(function() {
		$('textarea.adminrichedit').tinymce({
			// Location of TinyMCE script
			script_url : '/javascripts/tiny_mce/tiny_mce.js',

			// General options
			theme : "advanced",
			plugins : "style,advimage,advlink,inlinepopups,contextmenu,paste,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",

			// Theme options
			theme_advanced_buttons1 : "styleselect,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,|,cut,copy,paste,pastetext,pasteword|,bullist,numlist,|,outdent,indent,blockquote",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_buttons4 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : false,
                        content_css : "/stylesheets/editorstyles.css",
                        style_formats : [
                            {title : 'Header 1', block : 'h1'},
                            {title : 'Header 2', block : 'h2'},
                            {title : 'Header 3', block : 'h3'},
                            {title : 'Header 4', block : 'h4'},
                            {title : 'Header 5', block : 'h5'},
                            {title : 'Header 6', block : 'h6'}
                        ]
		});

                
	});



});
