$(document).ready(function() {
			
	// Menu rollover states
	$('li.menu_toplevel').hover(
		function() {
			var graphic_file_to_flip = ($('img.menu_toplevel_img',this).attr('src')).replace(/\_off/,'_on');
			$('ul', this).css('display', 'block');
			$('img.menu_toplevel_img', this).attr('src',graphic_file_to_flip);
			},
		function() {
			$('ul', this).css('display', 'none');
			var graphic_file_to_flip = ($('img.menu_toplevel_img',this).attr('src')).replace(/\_on/,'_off');
			$('img.menu_toplevel_img', this).attr('src',graphic_file_to_flip);
		}
	);	
    $("#bestdayeverdate").datepicker({
        showOn: "both",
        buttonImage: "/images/js_icon_calendar.jpg",
        buttonImageOnly: true,
        beforeShowDay: $.datepicker.noWeekends,
        minDate: '0d',
        dateFormat: 'yy-mm-dd',
        changeMonth: false,
        changeYear: false,
        closeAtTop: false
    });
    $('.onHover_cluetip').cluetip({
        closePosition: 'title',
        closeText: '<img src="/admin/images/icn_info.gif" alt="close" />',
        fx: {
            open: 'fadeIn',
            openSpeed: 'fast'
        },
        ajaxCache: true,
        positionBy: 'bottomTop',
        arrows: true,
        dropShadow: false
    });
    $('.onClick_cluetipAudio').cluetip({
        width: 305,
        sticky: true,
        activation: 'click',
        closePosition: 'title',
        closeText: '<img src="/images/btn_close.gif" alt="Close">',
        fx: {
            open: 'fadeIn',
            openSpeed: 'fast'
        },
        ajaxCache: true,
        positionBy: 'bottomTop',
        arrows: true,
        dropShadow: false
    });
    var emailsent = getURLVar("email")
    if (emailsent == "sent") {
        alert("Thanks for the email!");
    }
    if (emailsent == "best") {
        alert("We'll be sure to put it on the schedule!");
    }
    $('#sp_poll').ajaxForm(function() {
		var showInitials = document.showname.show.value;
		var cookieName = ("fm107_"+showInitials+"_pollVote");
        $('#sp_poll_submitform').load("show_elements/polling/sp_poll_results.inc.php?showname="+showInitials,function() {
			Set_Cookie(cookieName,'voted','60');	
            $('.sp_poll_resultbars').fadeIn('slow');
        });
    });
});