$(document).ready(function(){
		$(".navImg").mouseover(function(){
			this.src = this.src.substring(0, ((this.src.length)-4))+"On.jpg";
		});
		$(".navImg").mouseout(function(){
			this.src = this.src.substring(0, ((this.src.length)-6))+".jpg";
		});
		$(".hoverImg").mouseover(function(){
			this.src = this.src.substring(0, ((this.src.length)-4))+"Over.jpg";
		});
		$(".hoverImg").mouseout(function(){
			this.src = this.src.substring(0, ((this.src.length)-8))+".jpg";
		});
	});
	function mainmenu(){
		$(" #nav ul ").css({display: "none"});
		$(" #nav li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400);
			},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
			});
	}
	
	function showMore(which){		
		if ($("#"+which).is(":hidden")) {
			$("#"+which).slideDown(200);
			$("#"+which).parent().children("p").children(".readMore").text("...hide");
		}else{
			$("#"+which).slideUp(200);
			$("#"+which).parent().children("p").children(".readMore").text("...read more");
		}
	}
			
	$(document).ready(function(){					
		mainmenu();
		
		$("#inline").datepicker({ 
	    onSelect: function(date) {
			var checktype = document.getElementsByName('calCheck');
			var type = $(".calCheck").serialize();
    	    $.ajax({
			type: "GET",
			url: "includes/calendarList.inc.php",
			data: type+"&date="+date,
			success: function(msg){
//				alert(msg);
					document.getElementById("calendarList").innerHTML=msg;
				}
			 });
			} 
		}); 
		$("#altInline").hide();	
		$('.calCheck').click(function(){
			calChange();
		});
		

		$(".faqQ").css("cursor", "pointer");
		$(".faqQ").hover(function(){
			$(this).css("text-decoration", "underline");
			},function(){
			$(this).css("text-decoration", "none");
			});
		
		$('.faqQ').click(function(){			
			if ($(this).next('.faqA').is(":hidden")) {
				$(this).next('.faqA').slideDown(300);
			}else{
				$(this).next('.faqA').slideUp(300);
			}
		});
	});
	
	function calChange(){
		var checktype = document.getElementsByName('calCheck');
		var type = $(".calCheck").serialize();
		var date = $("#inline").datepicker("getDate");			
		try{
			date = $.datepicker.formatDate("yy-mm-dd", date);
		}catch(e){
			alert(e);
		}
		$.ajax({
		type: "GET",
		url: "includes/calendarList.inc.php",
		data: type+"&date="+date,
		success: function(msg){
			//alert(msg);
				document.getElementById("calendarList").innerHTML=msg;
			}
		 });
	}
