// JavaScript Document
$(document).ready(function () {
	$.ajax({
		url		: "Mockup.html",
		success	: function (navigation) {
			$("#navMain").html($(navigation).children());	
			//$("ul ul").hide();	
		}
	});
	
	$("#frame p").hide();	
	$(".pikamehide").hide();
	
	$("#frame h3").click(function () {
		var ourp = $(this).next();
		ourp.slideToggle("fast");
		$("#frame p").each( function () {
			if (ourp.text() != $(this).text()) {
				$(this).slideUp("fast");
			}
		});
		$("#frame #calendar").show();
	}).mouseover(function () {
		$(this).css("cursor","pointer");
	});
	
	/*$("#frame h3").click(function () {
		var ourp = $(this).next();
		ourp.slideToggle("fast");
		$("#frame #calendar").each( function () {
			if (ourp.text() != $(this).text()) {
				$(this).slideUp("fast");
			}				   
		});
	}).mouseover(function () {
		$(this).css("cursor","pointer");
	});*/
	
	

	var d = new Date();
	var y = d.getFullYear();
	var m = d.getMonth();

	$('#calendar').fullCalendar({
		draggable: false,
		events: [
			{
				id: 1,
				title: "Splash Into Summer",
				start: new Date(y, m, 12, 18, 0),
				end: new Date(y, m, 12),
				url: "javascript:openmodal('Splash Into Summer!')"
			},
			/*{
				id: 2,
				title: "Repeating Event",
				start: new Date(y, m, 2)
			},
			{
				id: 2,
				title: "Repeating Event",
				start: new Date(y, m, 9)
			},
			{
				id: 3,
				title: "Meeting",
				start: new Date(y, m, 20, 9, 0)
			},*/
			{
				id: 4,
				title: "NACURH Conference",
				start: new Date(y, m, 27, 16),
				end: new Date(y, m, 29),
				url: "javascript:openPage('http://nacurh.web.arizona.edu/')"
			}
		]
	});
	
	$("#frame #calendar").hide();	
	
	$("#dialog").dialog({
		bgiframe: true,
		autoOpen: false,
		height: 300,
		buttons: {
			close: function() {
				$(this).dialog('close');
			}
		}
	});
	$(".pikame").PikaChoose({show_captions:true, show_prev_next: false, auto_play: false});
});

			

function openPage(url) {
	var page = window.open(url, "sub", "");
	page.focus();
}

function openmodal(info) {
	$("#dialog").html(info);
	$("#dialog").dialog('open');
}