// JavaScript Document
//image overs
var image1On = new Image()
image1On.src ="images/btn-about2.jpg"

var image2On = new Image()
image2On.src ="images/btn-party2.jpg"

var image3On = new Image()
image3On.src ="images/btn-events2.jpg"

var image4On = new Image()
image4On.src ="images/btn-hours2.jpg"

var image5On = new Image()
image5On.src ="images/btn-faqs2.jpg"

var image6On = new Image()
image6On.src ="images/btn-photo2.jpg"

var image7On = new Image()
image7On.src ="images/btn-test2.jpg"

var image8On = new Image()
image8On.src ="images/btn-map2.jpg"

var image9On = new Image()
image9On.src ="images/btn-contact2.jpg"

// replaces an images with the specified image preloaded above 
function Roll(theImage, theObject)
 {
document.images[theImage].src=theObject.src
}
function RollOut(theImage, imageName)
{
document.images[theImage].src=imageName
}



<!-- Ajax Functions
//Browser Support Code
function ajaxFunction(){

var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server  
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
$('#calendar').fullCalendar('refresh');
}
}
var hour = new Number(document.getElementById('hour').value);
var minute = document.getElementById('minute').value
var period = document.getElementById('period').value
	if(period == 'pm'){
		hour = hour +12;
		}else if(hour < 10){
		var hour = new String(hour);
		hour = "0" + hour;
		}
var check = document.getElementById('check').value;
var date = document.getElementById('date').value;
var time = hour + ":" + minute + ":00z"; // Formats time variables... yay
//alert(time + check + date);
var eventname = document.getElementById('eventname').value;
var description = document.getElementById('description').value;

var queryString = "?check=" + check + "&date=" + date + "&time=" + time + "&eventname=" + eventname + "&description=" + description;


ajaxRequest.open("GET", "../includes/insert-script.php" + queryString, true);
ajaxRequest.send(null); 
//alert(queryString);
}


function ajaxFunctionMoved(varDate,varID){// Duh

var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server  
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
$('#calendar').fullCalendar('refresh');
}
}
//alert('HIT');
var check2 = "moved";

var queryString = "?check2=" + check2 + "&date2=" + varDate + "&id=" + varID;
 //  alert(queryString +	'(My Script goes here!!)');
//alert(queryString);
//var queryString = "?day=" + day;

ajaxRequest.open("GET", "../includes/edit-script.php" + queryString, true);

ajaxRequest.send(null); 
	

}


function ajaxFunctionEdit(){// Duh

var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server  610 664 8900 ex416
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
$('#calendar').fullCalendar('refresh');
}
}
//alert('HIT');
var check2 = document.getElementById('check2').value;
var id = document.getElementById('id').value;
var date2 = document.getElementById('date2').value;
var time2 = document.getElementById('time2').value;
var eventname2 = document.getElementById('eventname2').value;
var description2 = document.getElementById('description2').value;


var queryString = "?check2=" + check2 + "&id=" + id + "&date2=" + date2 + "&time2=" + time2 + "&eventname2=" + eventname2 + "&description2=" + description2;
//alert(queryString);
//var queryString = "?day=" + day;

ajaxRequest.open("GET", "../includes/edit-script.php" + queryString, true);

ajaxRequest.send(null); 
	

}

function ajaxFunctionDelete(){// Duh

var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server  
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
$('#calendar').fullCalendar('refresh');
}
}
//alert('HIT');
var check2 = document.getElementById('check2').value;
var id = document.getElementById('id').value;

var queryString = "?check2=" + check2 + "&id=" + id;
//alert(queryString);
//var queryString = "?day=" + day;

ajaxRequest.open("GET", "../includes/delete-script.php" + queryString, true);

ajaxRequest.send(null); 
	

}
// End Ajax Functions -->

<!-- JQuery Functions

$(function() {
		
		var name = $("#name"),
			email = $("#email"),
			password = $("#password"),
			allFields = $([]).add(name).add(email).add(password),
			tips = $("#validateTips");

		function updateTips(t) {
			tips.text(t).effect("highlight",{},1500);
		}

		function checkLength(o,n,min,max) {

			if ( o.val().length > max || o.val().length < min ) {
				o.addClass('ui-state-error');
				updateTips("Length of " + n + " must be between "+min+" and "+max+".");
				return false;
			} else {
				return true;
			}

		}

		function checkRegexp(o,regexp,n) {

			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass('ui-state-error');
				updateTips(n);
				return false;
			} else {
				return true;
			}

		}
		
		$("#dialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 475,
			modal: true,
			buttons: {
				'Add an Event': function() {
					
						$('#users tbody').append('<tr>' +
							'<td>' + name.val() + '</td>' + 
							'<td>' + email.val() + '</td>' + 
							'<td>' + password.val() + '</td>' +
							'</tr>'); 
						$(this).dialog('close');
						ajaxFunction();
				
				},
				Cancel: function() {
					$(this).dialog('close');
				}
			},
			close: function() {
				allFields.val('').removeClass('ui-state-error');
			}
		});
		
	
		
		$('#Add-Event').click(function() {
			$('#dialog').dialog('open');
		})
		.hover(
			function(){ 
				$(this).addClass("ui-state-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-state-hover"); 
			}
		).mousedown(function(){
			$(this).addClass("ui-state-active"); 
		})
		.mouseup(function(){
				$(this).removeClass("ui-state-active");
		});
		
		
		$("#dialog2").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 475,
			modal: true,
			buttons:{
			'Save Edits': function() {
$('#users tbody').append('<tr>' +
							'<td> Edited</td>' + 
							'<td>' + email.val() + '</td>' + 
							'<td>' + password.val() + '</td>' +
							'</tr>'); 
						$(this).dialog('close');
						ajaxFunctionEdit();
					
				},
				'Remove Event': function() {
				$('#users tbody').append('<tr>' +
							'<td> Deleted</td>' + 
							'<td>' + email.val() + '</td>' + 
							'<td>' + password.val() + '</td>' +
							'</tr>'); 
						$(this).dialog('close');
						ajaxFunctionDelete();
					
				},
				
				Cancel: function() {
					$(this).dialog('close');
				}
			},
			close: function() {
				allFields.val('').removeClass('ui-state-error');
			}
			
		});
		
		
		$('#Edit-Event').click(function() {
			$('#dialog2').dialog('open');
		})
		.hover(
			function(){ 
				$(this).addClass("ui-state-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-state-hover"); 
			}
		).mousedown(function(){
			$(this).addClass("ui-state-active"); 
		})
		.mouseup(function(){
				$(this).removeClass("ui-state-active");
		});	
		
		

	});
	
	// Date Picker
		$(function() {
			$("#date").datepicker({minDate: -20, maxDate: '+1M +10D', altField: '#alternate', altFormat: 'DD, MM d, yy'});
			$("#date2").datepicker({minDate: -20, maxDate: '+1M +10D', altField: '#alternate', altFormat: 'DD, MM d, yy'});
	});

// End JQuery Functions -->
