﻿//FADE CONTROLS //////////////////////////////////////////////////////////////////////////////////////////
$(document).ready(function () {
	$("#div #logo").fadeTo("slow", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
	$("#div #logo").hover(function () {
		$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
	}, function () {
		$(this).fadeTo("slow", 0.3); // This should set the opacity back to 30% on mouseout
	});
});
$(document).ready(function () {
    $('div #logo').hide();
    $("div #logo").fadeIn(1600);
});


// Change Properties
function MM_changeProp(objId, x, theProp, theValue) { //v9.0
    var obj = null; with (document) {
        if (getElementById)
            obj = getElementById(objId);
    }
    if (obj) {
        if (theValue == true || theValue == false)
            eval("obj.style." + theProp + "=" + theValue);
        else eval("obj.style." + theProp + "='" + theValue + "'");
    }
}

//SWAP IMAGE //////////////////////////////////////////////////////////////////////////////////////////
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
// Set Up for Jquery UI Elements /////////////////////////////////////////////////////////////////////////
$(function () {

	// Accordion
	$("#accordion").accordion({
		header: "h2",
		autoHeight: false
	});


	// Tabs
	$('#tabs').tabs();
	$(".selector").tabs({ spinner: 'Retrieving data...' });
	//getter
	var spinner = $(".selector").tabs("option", "spinner");
	//setter
	$(".selector").tabs("option", "spinner", 'Retrieving data...');

	// Dialog			
	$('#dialog').dialog({
		autoOpen: false,
		draggable: false,
		resizable: false,
		modal: true,
		width: 600,
		buttons: {
			"Ok": function () {
				$(this).dialog("close");
			},
			"Cancel": function () {
				$(this).dialog("close");
			}
			
		}
	});

	// Dialog Link
	$('#dialog_link').click(function () {
		$('#dialog').dialog('open');
		return false;
	});


	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
					function () { $(this).addClass('ui-state-hover'); },
					function () { $(this).removeClass('ui-state-hover'); }
				);

});

// Add Accordian Icons //////////////////////////////////////////////////////////////////////////////////////////
$(function () {
	var icons = {
		header: "ui-icon-circle-arrow-e",
		headerSelected: "ui-icon-circle-arrow-s"
	};
	$("#accordion").accordion({
		icons: icons
	});
	$("#toggle").button().toggle(function () {
		$("#accordion").accordion("option", "icons", false);
	}, function () {
		$("#accordion").accordion("option", "icons", icons);
	});
});


// BACK TO TOP ANIMATION ////////////////////////////////////////////////////////////////////////////////////////
$(function () {
	$(window).scroll(function () {
		if ($(this).scrollTop() > 400) {
			$('#toTop').fadeIn();
		} else {
			$('#toTop').fadeOut();
		}
	});

	$('#toTop').click(function () {
		$('body,html').animate({ scrollTop: 0 }, 600);
	});
});
