function getURL(url) {
	window.open(url, '_self');
}

function getURLBlank(url) {
	window.open(url, '_blank');
}

//ANTISPAM EMAIL LINK
function antiSpam(id, domain, style) {
	document.write("<a href='mailto:" + id + "@" + domain + "' class='" + style + "'>" + id + "@" + domain + "</a>");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function show_drop_down_menu(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
				var left = getOffsetLeft(link_id) + 'px';
        var top = getOffsetTop(link_id) + document.getElementById(link_id).offsetHeight + 'px';
        document.getElementById(menu_id).style.left = left;
        document.getElementById(menu_id).style.top = top;
        document.getElementById(link_id).style.backgroundColor = '';
        document.getElementById(menu_id).style.visibility = 'visible';
				document.getElementById(menu_id).style.zindex = 100;
    }
}

function show_drop_down_menu2(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
				var left = getOffsetLeft(link_id) + 'px';
        var top = (getOffsetTop(link_id) + document.getElementById(link_id).offsetHeight - 14) + 'px';
        document.getElementById(menu_id).style.left = left;
        document.getElementById(menu_id).style.top = top;
        document.getElementById(link_id).style.backgroundColor = '';
        document.getElementById(menu_id).style.visibility = 'visible';
				document.getElementById(menu_id).style.zindex = 100;
    }
}

function show_drop_down_menu3(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
        var left = (getOffsetLeft(link_id) + document.getElementById(link_id).offsetWidth - 7) + 'px';
        var top = (getOffsetTop(link_id)) + 'px';
        document.getElementById(menu_id).style.left = left;
        document.getElementById(menu_id).style.top = top;
        document.getElementById(link_id).style.backgroundColor = '';
        document.getElementById(menu_id).style.visibility = 'visible';
				document.getElementById(menu_id).style.zindex = 100;
    }
}

function hide_drop_down_menu3(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
        document.getElementById(menu_id).style.visibility = 'hidden';
        document.getElementById(link_id).style.backgroundColor = '';
    }
}

function show_drop_down_menu_side(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
				var left = getOffsetLeft(link_id) + document.getElementById(link_id).offsetWidth + 'px';
        var top = getOffsetTop(link_id) + 'px';
        document.getElementById(menu_id).style.left = left;
        document.getElementById(menu_id).style.top = top;
        document.getElementById(link_id).style.backgroundColor = '';
        document.getElementById(menu_id).style.visibility = 'visible';
				document.getElementById(menu_id).style.zindex = 100;
    }
}

function hide_drop_down_menu(menu_id, link_id) {
    if (document.getElementById(menu_id)) {
        document.getElementById(menu_id).style.visibility = 'hidden';
        document.getElementById(link_id).style.backgroundColor = '';
    }
}

function getOffsetTop(element) {
    el = document.getElementById(element);
    xPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getOffsetLeft(element) {
    el = document.getElementById(element);
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

var tab_id = "1";
function homeTabSelect(tabid) {
	if (tab_id != tabid) {
		document.getElementById("div_tab" + tab_id).style.display = 'none';
		document.getElementById("div_tab" + tabid).style.display = 'inline';
		img = "sitewyze/files/tab" + tabid + ".jpg";
		document.getElementById("div_header").style.backgroundImage = "url('" + img + "')";
		tab_id = tabid;
	}
}

function homeTabSelect2(tabid) {
	if (tab_id != tabid) {
		document.getElementById("div_tab" + tab_id).style.display = 'none';
		document.getElementById("div_tab" + tabid).style.display = 'inline';
		document.getElementById("div_tab" + tabid).scrollTop = 0
		tab_id = tabid;
	}
}

// Banner Images
function init_mini_gallery() {
	var nF = new noobFade({
		items: $$('div.banner'),
//		handles: $$('#bannerhandles span.slot'),
		addButtons: {
			previous: $('bannerprev'),
			play: $('bannerplay'),
			stop: $('bannerstop'),
			next: $('bannernext')
		},
		onWalk: function(currentItem,currentHandle) {
//			this.handles.removeClass('active');
//			currentHandle.addClass('active');
		},
		autoPlay: true,
		interval: 5000
	});
	
	if ($('bannerplay')) { 
		// Init
		$('bannerplay').addClass('bannerhide');
		$('bannerplay').addEvent(
			'click', 
			function() { 
				$('bannerplay').addClass('bannerhide');
				$('bannerstop').removeClass('bannerhide');
			}
		);
	}

	if ($('bannerstop')) { 
		$('bannerstop').addEvent(
			'click', 
			function() { 
				$('bannerstop').addClass('bannerhide');
				$('bannerplay').removeClass('bannerhide');
			}
		);
	}
}

// Find a Pro Search
function findProJS(e, ff) {
	var key=e.keyCode || e.which;
	if (key == 13){
		location.href='/site/member_directory?m=' + escape(ff.value);
		return false;
	}
}

// Find a Club Search
function findClubJS(e, ff) {
	var key=e.keyCode || e.which;
	if (key == 13){
		location.href='/site/golf_facilities?c=' + escape(ff.value);
		return false;
	}
}

// Find a Club Search
function findClubRegionJS(val) {
	location.href='/site/golf_facilities?r=' + escape(val);
}

function searchSite(e, ff) {
	var key=e.keyCode || e.which;
	if (key == 13){
		var url = location.href;
		if (url.indexOf("?") > 0)
			url = url.substring(0, url.indexOf("?"));
		location.href = url + "?q=" + escape(ff.value);
		return false;
	}
}

