// JavaScript Document

function tabSwitch(new_tab, new_content) {
	
	document.getElementById('content_1').style.display = 'none';
	document.getElementById('content_2').style.display = 'none';
	document.getElementById('content_3').style.display = 'none';		
	document.getElementById(new_content).style.display = 'block';	
	

	document.getElementById('tab_1').className = '';
	document.getElementById('tab_2').className = '';
	document.getElementById('tab_3').className = '';		
	document.getElementById(new_tab).className = 'active';		

}

// Ties a set of tabs and content id's together, and switches between them
// <div id='tab_1'> and <div id="content_1"> for example
// Usage: tabswitch(1, 4, 'tab', 'panel') would switch on tab_1 and panel_1

function tabSwitch_2(active, number, tab_prefix, content_prefix) {
	
	for (var i=1; i < number+1; i++) {
	  document.getElementById(content_prefix+i).style.display = 'none';
	  document.getElementById(tab_prefix+i).className = '';
	}
	document.getElementById(content_prefix+active).style.display = 'block';
	document.getElementById(tab_prefix+active).className = 'active';	
	
}

function switchto(name, on) 
{
	document[name].src = eval(name + (on == 1 ? "on.src" : "off.src"));
}
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) { //v3.0
  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); 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 win(name) {
msg=window.open("","msg","height=600,width=600,scrollbars=yes");
msg.document.writeln("<html><title>",name,"</title>");
msg.document.writeln("<SCRIPT LANGUAGE=\"JavaScript1.1\">");
msg.document.writeln("<!-- Begin ");
msg.document.writeln("function right(e) { ");
msg.document.writeln("if (navigator.appName == 'Netscape' && ");
msg.document.writeln("(e.which == 3 || e.which == 2)) ");
msg.document.writeln("return false; ");
msg.document.writeln("else if (navigator.appName == 'Microsoft Internet Explorer' && ");
msg.document.writeln("(event.button == 2 || event.button == 3)) { ");
msg.document.writeln("alert(\"Copyright TheGolfBuddy.co.uk\"); ");
msg.document.writeln("return false; ");
msg.document.writeln("} ");
msg.document.writeln("return true; ");
msg.document.writeln("} ");
msg.document.writeln(" ");
msg.document.writeln("document.onmousedown=right; ");
msg.document.writeln("document.onmouseup=right; ");
msg.document.writeln("if (document.layers) window.captureEvents(Event.MOUSEDOWN); ");
msg.document.writeln("if (document.layers) window.captureEvents(Event.MOUSEUP); ");
msg.document.writeln("window.onmousedown=right; ");
msg.document.writeln("window.onmouseup=right; ");
msg.document.writeln("//  End --> ");
msg.document.writeln("</script> ");
msg.document.write("<body bgcolor='white' onBlur=\"window.close()\">");
msg.document.write("<center><a href=\"#\" onClick=\"window.close()\"><img src='",name,"' border=0></a>");
msg.document.write("<p><a href=\"#\" onClick=\"window.close()\">Close Window</a></p></center>");
msg.document.write("</body></html>");  msg.focus();
}
