function showrollover(id)

	{

	roID = 'ro' + id;
    
	if (document.all)

		{

		roIDref = eval(roID);

		roIDref.style.visibility="visible";

		roIDref.style.top = getAbsoluteTop(id) + 5;

		roIDref.style.left = getAbsoluteLeft(id) - 115;

		}

	else

		{

		document.getElementById(roID).style.visibility="visible";

		document.getElementById(roID).style.top = getAbsoluteTop(id) + 5;

		document.getElementById(roID).style.left = getAbsoluteLeft(id) - 120;

		}

	}



function hiderollover(id)

	{

	roID = 'ro' + id;

	if (document.all)

		{

		roIDref = eval(roID);

		roIDref.style.visibility="hidden";

		}

	else

		{

		document.getElementById(roID).style.visibility="hidden";

		}

	}





function getAbsoluteLeft(objectId) {

	// Get an object left position from the upper left viewport corner

	// Tested with relative and nested objects

	o = document.getElementById(objectId)

	oLeft = o.offsetLeft            // Get left position from the parent object

	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element

		oParent = o.offsetParent    // Get parent object reference

		oLeft += oParent.offsetLeft // Add parent left position

		o = oParent

	}

	// Return left postion

	return oLeft

}



function getAbsoluteTop(objectId) {

	// Get an object top position from the upper left viewport corner

	// Tested with relative and nested objects

	o = document.getElementById(objectId)

	oTop = o.offsetTop            // Get top position from the parent object

	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element

		oParent = o.offsetParent  // Get parent object reference

		oTop += oParent.offsetTop // Add parent top position

		o = oParent

	}

	// Return top position

	return oTop

}



function validateBooking(bookingForm)

	{

	

	

		if(bookingForm.bookName.value=='')

		{

			alert('Sorry you must enter a name to continue');

			return(false);

		}

		if(bookingForm.bookEmail.value=='')

		{

			alert('Sorry you must enter an email to continue');

			return(false);

		}

		if(bookingForm.bookPhone.value=='')

		{

			alert('Sorry you must enter a phone number to continue');

			return(false);

		}

		

		if(!bookingForm.paypal.checked)

		{

			alert('You must accept the terms & conditions before continuing.');

			return(false);

		}

	

		

		return(true);

	}	





function validateRegistration(regForm)

	{

	msgText = '';

	

	if(regForm.user.value=='')

		{

		msgText += 'Sorry you must enter a username to continue';

		}

	if(regForm.fEmail.value=='')

		{

		msgText += 'Sorry you must enter an email to continue';

		}

	if(regForm.pass.value != regForm.Cpass.value)

		{

		msgText += 'Password fields must match';

		}



	if (strlen(msgText) > 0 )

		{

		alert(msgText);

		return(false);

		}

	else

		{

		return(true);

		}

	}	







function getCal(reqMonth, reqYear)

	{
	// ajax, load new Calendar



	if (window.XMLHttpRequest)

		{

		// If IE7, Mozilla, Safari, and so on: Use native object.

		calxh = new XMLHttpRequest();

		}

	else

		{

		if (window.ActiveXObject)

			{

			// ...otherwise, use the ActiveX control for IE5.x and IE6.

			calxh = new ActiveXObject('MSXML2.XMLHTTP.3.0');

			}

		}



	calxh.onreadystatechange = function () {

	    if (calxh.readyState == 4) {
	        if (calxh.status == "200") {
                // loaded calendar, display it
	            var calContent = document.getElementById("calendarContent");
	            if (calContent) {
                    calContent.innerHTML = calxh.responseText;

                    // today marker
                    //
                    $('.calendarToday:first').each (function () {
                        var cell    = $(this);
                        $('#calendarTodayHelperHost').append ("<a id='calendarTodayHelper'>&nbsp;</a>");
                        
                        $('#calendarTodayHelper').each (function () {
                            var helper      = $(this);
                            var cellPos     = cell.position ();
                            var cellMid     = { x: cellPos.left + cell.width ()     / 2,  y: cellPos.top  + cell.height ()    / 2 + 3 };
                            var helperPos   = { x: cellMid.x    - helper.width ()   / 2,  y: cellMid.y    - helper.height ()  / 2 - 1 };
                            
                            if (cell.hasClass ('calendarEvent')) {
                                cell.children ('a:first').each (function () {
                                    var link = $(this);
                                    var cellId = link.attr ('id');
                                    
                                    helper.attr ('onmouseover', 'javascript:showrollover("' + cellId + '")');
                                    helper.attr ('onmouseout', 'javascript:hiderollover("' + cellId + '")');
                                    helper.addClass ('calendarEvent');
                                    helper.attr ('href', '' + link.attr ('href'));
                                });
                            }
                            
                            helper.css ('left', helperPos.x);
                            helper.css ('top',  helperPos.y);
                        });
                    });

                    if (window.lateLoadHandler) {
                        window.lateLoadHandler ();
                    }
                }
		    }
        }
	    else
		{
		    // still loading
            var calContent = document.getElementById("calendarContent");
            if (calContent) {
		        calContent.innerHTML = "Getting this month's events...";
		    }
		}
	}


	calUrl = "inc/calendar.asp?reqMonth="+reqMonth+"&reqYear="+reqYear;

	

	calxh.open("GET", calUrl, true);

	calxh.send(null);



	}



$(document).ready (function () {
    DoLoadCalContent ("thismonth","thisyear");
});

function DoLoadCalContent (reqMonth, reqYear)
{
	// set side calendar to current month
	var calContent = document.getElementById("calendarContent");
	if (calContent) {
	    calContent.innerHTML = "Getting this month's events...";

	    getCal(reqMonth, reqYear);
    }
}

function onLoadCal(reqMonth, reqYear)
{
    DoLoadCalContent (reqMonth, reqYear);
}

	

function checkCalInputs()

    {

    // Ensure there are valid values passed to onLoadCal
    //
    var myFormMonth = document.getElementById ('myFormMonth');
    var myFormYear  = document.getElementById ('myFormYear');
    
    var mth = (myFormMonth.value=="")? "thismonth":myFormMonth.value;
    var yr = (myFormYear.value=="")? "thisyear":myFormYear.value;

    onLoadCal(mth,yr); 

    }

   

function correctDocTitle(anchor)

    {

    //strip anchor from title bar 

    var pos = document.title.indexOf(anchor);

    if(pos != -1)

        {

        document.title = document.title.substr(0,pos);

        }

    }



function validateEmail(theForm)

	{

		if(theForm.intoEmail.value=='')

		{

			alert('Please enter an email address.');

			theForm.intoEmail.focus();

			return(false);

		}

		

		return(true);

	}

	

 function bookmark(url,title){

   if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

  window.external.AddFavorite(url,title);

  } else if (navigator.appName == "Netscape") {

    window.sidebar.addPanel(title,url,"");

  } else {

    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");

  }

 }

   

function showToolTip(e, desc){

	e = e || window.event;

	var srcEl = e.srcElement? e.srcElement : e.target;

	srcEl.title=desc;

	window.status=desc;

	return true;

}



function clearToolTip(){

	window.status="";

}


// ------------------------------------------------------------------------------------------------


var regexNames = {
    emailAddress: "EmailAddress"
};

function stringMatchesRegex (regexName, str) {
    var matches, re;
    
    matches = false;
    
    switch (regexName) {
    case regexNames.emailAddress:
        break;
    default:
        break;
    }
}


