function makeBiggerMap()
{
	jQuery("#mapcontainer").removeClass('map-small');
	jQuery("#mapcontainer").addClass('map-big');
	jQuery("#mapmakebigger").html('<a href="#" onclick="makeSmallerMap();return false;">Make Smaller</a>');
}

function makeSmallerMap()
{
	jQuery("#mapcontainer").removeClass('map-big');
	jQuery("#mapcontainer").addClass('map-small');
	jQuery("#mapmakebigger").html('<a href="#" onclick="makeBiggerMap();return false;">Make Bigger</a>');
}

function deleteHall(path_ajax,hall_id)
{
	jQuery.ajax({
		type: "POST",
		url: path_ajax+"json_delete_hall.php",
		data: "hall_id="+hall_id,
		success: function(msg){
			
			var p = eval('(' + msg + ')');
			if (p.status=='ok') {
				jQuery('#hall'+hall_id).toggle(400);
			} else {
				alert(p.status);
			}
	
		}
	});
	return false;
}

function updateCounties(path_ajax,otheroption,current_value)
{
	var tccountry_id = jQuery('#tccountry_id').val();
	jQuery.ajax({
		type: "POST",
		url: path_ajax+"json_lookup_counties.php",
		data: "tccountry_id="+tccountry_id,
		success: function(msg){
			
			$('#tccounty_id').html('');
			
			var p = eval('(' + msg + ')');
			if (p.status=='ok') {
				$('<option value=""> -- '+otheroption+' -- </option>').appendTo('#tccounty_id');
				for(var i=0;i<p.counties.length;i++)
				{
					if (p.counties[i].tccounty_id == current_value) {
						$('<option selected="selected" value="'+p.counties[i].tccounty_id+'">'+p.counties[i].county+'</option>').appendTo('#tccounty_id');
					} else {
						$('<option value="'+p.counties[i].tccounty_id+'">'+p.counties[i].county+'</option>').appendTo('#tccounty_id');
					}
				}
			} else {
				$('<option value=""> -- '+otheroption+' -- </option>').appendTo('#tccounty_id');
			}
	
		}
	});
}

function updateTowns(path_ajax)
{

	var tccounty_id = jQuery('#tccounty_id').val();
	
	jQuery.ajax({
		type: "POST",
		url: path_ajax+"json_lookup_towns.php",
		data: "tccounty_id="+tccounty_id,
		success: function(msg){
			
			$('#tctown_id').html('');
			
			var p = eval('(' + msg + ')');
			if (p.status=='ok') {
				$('<option value=""> -- All -- </option>').appendTo('#tctown_id');
				for(var i=0;i<p.towns.length;i++)
				{
					$('<option value="'+p.towns[i].tctown_id+'">'+p.towns[i].town+'</option>').appendTo('#tctown_id');
				}
			} else {
				$('<option value=""> -- All -- </option>').appendTo('#tctown_id');
			}
	
		}
	});

}

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
		var rel_value = anchor.getAttribute("rel");
		var pattern=/external/i;
    if (anchor.getAttribute("href") && 
				(pattern.test(rel_value)))
			anchor.target = "_blank";
	}
}

function areYouSure(url,form_id) {
	if (confirm('Are you sure you want to do that?')) {
		if (!form_id) {
			document.location.href=url;
		} else {
			document.getElementById(form_id).submit();
		}
	}
}

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/* Taken from http://www.dustindiaz.com/getelementsbyclass/ */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}