

//Call a popup window
//---------------------------------
function popup(URL, title, w, h) {
 winprops = 'height='+h+',width='+w+',top=0,left=0,menubar=yes,toolbar=yes,status=yes,scrollbars=auto,resizable=1';
 var page = window.open(URL, title, winprops);
 page.focus();
}

//Call a popup window with scroll
//---------------------------------
function popupscroll(URL, title, w, h) {

 winprops = 'height='+h+',width='+w+',top=0,left=0,menubar=yes,location=yes, toolbar=yes,status=yes,scrollbars=yes,resizable=1';
 var page = window.open(URL, title, winprops);
 page.focus();
}


//Choose an image for the page header
//-------------------------------------
function choosePic(){
	headerImages = new Array("Images/headerSkater.gif","Images/skater2.gif","Images/skater3.gif")
	imgCt = headerImages.length
	pix = Math.floor((Math.random() * imgCt))
	document.picture.src = headerImages[pix]
}


//Choose an image for the page header from a directory other than home
//-------------------------------------
function choosePicUp(){
	headerImages = new Array("/Images/headerSkater.gif","/Images/skater2.gif","/Images/skater3.gif")
	imgCt = headerImages.length
	pix = Math.floor((Math.random() * imgCt))
	document.picture.src = headerImages[pix]
}

	
//This function repositions the drop-down menus based on the window size
//-------------------------------------
	function adjpos() 
	{
  	var lpos1 = 0;		
  	var lpos2 = 91;		
  	var lpos3 = 184;		
  	var lpos4 = 277;		
  	var lpos5 = 375;		
  	var lpos6 = 507;		
   	var lpos7 = 150;		
  	var lpos11 = 0;		
  	var lpos12 = 91;		
  	var lpos13 = 184;		
  	var lpos14 = 277;		
  	var lpos15 = 375;		
  	var lpos16 = 507;		
 	var myWidth = 0;
	var str = navigator.appVersion
	var browser = str.match("Safari")

  		if( typeof( window.innerWidth ) == 'number' ) 
		{
    		//Non-IE
    		myWidth = window.innerWidth;
  		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		{
    		//IE 6+ in 'standards compliant mode'
    		myWidth = document.documentElement.clientWidth;
  		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
    		//IE 4 compatible
    		myWidth = document.body.clientWidth;
  		}

		if (myWidth > 800)
		{
			lpos1 = ((myWidth-800)/2)+0;
			lpos2 = ((myWidth-800)/2)+91;
			lpos3 = ((myWidth-800)/2)+184;
			lpos4 = ((myWidth-800)/2)+277;
			lpos5 = ((myWidth-800)/2)+375;
			lpos6 = ((myWidth-800)/2)+507;
			lpos7 = 150;
			lpos8 = ((myWidth-800)/2)+325;
			pos11 = ((myWidth-800)/2)-8;
			lpos11 = Math.round(pos11);
			lpos12 = ((myWidth-800)/2)+82;
			lpos13 = ((myWidth-800)/2)+175;
			lpos14 = ((myWidth-800)/2)+268;
			lpos15 = ((myWidth-800)/2)+366;
			lpos16 = ((myWidth-800)/2)+498;
		} 
		else 
		{
			lpos1 = 0;
			lpos2 = 91;
			lpos3 = 184;
			lpos4 = 277;
			lpos5 = 375;
			lpos6 = 507;
			lpos7 = 150;
			lpos8 = 333
			lpos11 = 0;
			lpos12 = 91;
			lpos13 = 184;
			lpos14 = 277;
			lpos15 = 375;
			lpos16 = 507;
		}

		if (document.all)
		{
			document.all.home.style.left=lpos1;
			document.all.club.style.left=lpos2;
			document.all.teams.style.left=lpos3;
			document.all.archive.style.left=lpos4;
			document.all.swap.style.left=lpos5;
			document.all.links.style.left=lpos6;
			document.all.abteams.style.left=lpos7;
			document.all.aateams.style.left=lpos7;
			document.all.gwteams.style.left=lpos7;
			document.all.abteams.style.top=22;
			document.all.aateams.style.top=6;
			document.all.gwteams.style.top=38;
		} 
		else 
		{

			if (browser == "Safari"){
  				document.getElementById('home').style.left=lpos1;
  				document.getElementById('home').style.top=187;
				document.getElementById('club').style.left=lpos2;
				document.getElementById('club').style.top=187;
				document.getElementById('teams').style.left=lpos3;
				document.getElementById('teams').style.top=187;
				document.getElementById('archive').style.left=lpos4;
				document.getElementById('archive').style.top=187;
				document.getElementById('swap').style.left=lpos5;
				document.getElementById('swap').style.top=187;
				document.getElementById('links').style.left=lpos6;
				document.getElementById('links').style.top=187;
				document.getElementById('abteams').style.left=lpos7;
				document.getElementById('abteams').style.top=22;
				document.getElementById('aateams').style.left=lpos7;
				document.getElementById('aateams').style.top=6;
				document.getElementById('gwteams').style.left=lpos7;
				document.getElementById('gwteams').style.top=38;
			}else{
  				document.getElementById('home').style.left=lpos11;
  				document.getElementById('home').style.top=187;
				document.getElementById('club').style.left=lpos12;
				document.getElementById('club').style.top=187;
				document.getElementById('teams').style.left=lpos13;
				document.getElementById('teams').style.top=187;
				document.getElementById('archive').style.left=lpos14;
				document.getElementById('archive').style.top=187;
				document.getElementById('swap').style.left=lpos15;
				document.getElementById('swap').style.top=187;
				document.getElementById('links').style.left=lpos16;
				document.getElementById('links').style.top=187;
				document.getElementById('abteams').style.left=lpos8;
				document.getElementById('abteams').style.top=210;
				document.getElementById('aateams').style.left=lpos8;
				document.getElementById('aateams').style.top=194;
				document.getElementById('gwteams').style.left=lpos8;
				document.getElementById('gwteams').style.top=226;
			}
		}
	}

//These functions hide/show the dropdowns and change the background color of the menu items
//--------------------------------

	function showmenu(elmnt)
	{
		document.getElementById(elmnt).style.visibility="visible"
	}


	function hidemenu(elmnt)
	{
		document.getElementById(elmnt).style.visibility="hidden"
	}


	function highlight(elmnt)
	{
		document.getElementById(elmnt).style.background="#E0E0E0"
	}


	function restore(elmnt)
	{
		document.getElementById(elmnt).style.background="#005B68"
	}


//This function is called when a dropdown menu item is selected
//------------------------------

	function redirect(page)
	{	
		window.location=page
	}


//This function repositions the drop-down menus on the calendar page based on the window size
//-------------------------------------
	function adjposcal() 
	{
  	var lpos1 = 0;		
  	var lpos2 = 105;		
  	var lpos3 = 212;		
  	var lpos4 = 319;		
  	var lpos5 = 427;		
  	var lpos6 = 553;		
   	var lpos7 = 150;		
  	var lpos11 = 0;		
  	var lpos12 = 105;		
  	var lpos13 = 212;		
  	var lpos14 = 319;		
  	var lpos15 = 427;		
  	var lpos16 = 553;		
 	var myWidth = 0;
	var str = navigator.appVersion
	var browser = str.match("Safari")
  		if( typeof( window.innerWidth ) == 'number' ) 
		{
    		//Non-IE
    		myWidth = window.innerWidth;
  		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		{
    		//IE 6+ in 'standards compliant mode'
    		myWidth = document.documentElement.clientWidth;
  		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		{
    		//IE 4 compatible
    		myWidth = document.body.clientWidth;
  		}

		if (myWidth > 900)
		{
			lpos1 = ((myWidth-900)/2);
			lpos2 = ((myWidth-900)/2)+105;
			//lpos2 = Math.round(pos2);
			lpos3 = ((myWidth-900)/2)+212;
			lpos4 = ((myWidth-900)/2)+319;
			lpos5 = ((myWidth-900)/2)+427;
			lpos6 = ((myWidth-900)/2)+553;
			lpos7 = 150;
			lpos8 = ((myWidth-800)/2)+340;
			pos11 = ((myWidth-800)/2)-8;
			lpos11 = Math.round(pos11);
			lpos12 = ((myWidth-800)/2)+97;
			lpos13 = ((myWidth-800)/2)+204;
			lpos14 = ((myWidth-800)/2)+311;
			lpos15 = ((myWidth-800)/2)+419;
			lpos16 = ((myWidth-800)/2)+545;
		} 
		else 
		{
			lpos1 = 0;
			lpos2 = 105;
			lpos3 = 212;
			lpos4 = 319;
			lpos5 = 427;
			lpos6 = 553;
			lpos7 = 150;
			lpos8 = 348
			lpos11 = 0;
			lpos12 = 105;
			lpos13 = 212;
			lpos14 = 319;
			lpos15 = 427;
			lpos16 = 553;
		}

		if (document.all)
		{
			document.all.home.style.left=lpos1;
			document.all.club.style.left=lpos2;
			document.all.teams.style.left=lpos3;
			document.all.archive.style.left=lpos4;
			document.all.swap.style.left=lpos5;
			document.all.links.style.left=lpos6;
			document.all.abteams.style.left=lpos7;
			document.all.aateams.style.left=lpos7;
			document.all.gwteams.style.left=lpos7;
			document.all.abteams.style.top=22;
			document.all.aateams.style.top=6;
			document.all.gwteams.style.top=38;
		} 
		else 
		{
			if (browser == "Safari"){
  				document.getElementById('home').style.left=lpos1;
  				document.getElementById('home').style.top=187;
				document.getElementById('club').style.left=lpos2;
				document.getElementById('club').style.top=187;
				document.getElementById('teams').style.left=lpos3;
				document.getElementById('teams').style.top=187;
				document.getElementById('archive').style.left=lpos4;
				document.getElementById('archive').style.top=187;
				document.getElementById('swap').style.left=lpos5;
				document.getElementById('swap').style.top=187;
				document.getElementById('links').style.left=lpos6;
				document.getElementById('links').style.top=187;
				document.getElementById('abteams').style.left=lpos7;
				document.getElementById('abteams').style.top=22;
				document.getElementById('aateams').style.left=lpos7;
				document.getElementById('aateams').style.top=6;
				document.getElementById('gwteams').style.left=lpos7;
				document.getElementById('gwteams').style.top=38;
			}else{
  				document.getElementById('home').style.left=lpos11;
  				document.getElementById('home').style.top=187;
				document.getElementById('club').style.left=lpos12;
				document.getElementById('club').style.top=187;
				document.getElementById('teams').style.left=lpos13;
				document.getElementById('teams').style.top=187;
				document.getElementById('archive').style.left=lpos14;
				document.getElementById('archive').style.top=187;
				document.getElementById('swap').style.left=lpos15;
				document.getElementById('swap').style.top=187;
				document.getElementById('links').style.left=lpos16;
				document.getElementById('links').style.top=187;
				document.getElementById('abteams').style.left=lpos8;
				document.getElementById('abteams').style.top=210;
				document.getElementById('aateams').style.left=lpos8;
				document.getElementById('aateams').style.top=194;
				document.getElementById('gwteams').style.left=lpos8;
				document.getElementById('gwteams').style.top=226;
			}
		}
	}


//-----------------------------------------------------
