/*=================
   STOP Error Msgs
  =================*/ 

function blockError(){return true;}
window.onerror = blockError;
/*=======END========*/


function Menu_Over(elem, clr)
	{
	elem.style.backgroundColor = clr;
	elem.children.tags('A')[0].style.color = "#FFFFFF";
	elem.style.cursor = 'hand'
	}

function Menu_Out(elem, clr)
	{
	elem.style.backgroundColor = clr;
	elem.children.tags('A')[0].style.color = "#808080";}

function LmDown(elem, clr)
	{
	elem.style.backgroundColor = clr;
	elem.children.tags('A')[0].style.color = "#FFFFFF";}

function Menu_Up(path)
	{
	location.href = path;
	}



/*===================
  Short Date:  09/02/2002
  ===================*/ 
 function GetShortDate(){ 
	var aceDate=new Date()
	var aceYear=aceDate.getYear()
	if (aceYear < 1000)
	aceYear+=1900
	var aceDay=aceDate.getDay()
	var aceMonth=aceDate.getMonth()+1
	if (aceMonth<10)
	aceMonth="0"+aceMonth
	var aceDayMonth=aceDate.getDate()
	if (aceDayMonth<10)
	aceDayMonth="0"+aceDayMonth
	document.write("<font color='000000' face='Arial' size='2'><b>"+aceMonth+"/"+aceDayMonth+"/"+aceYear+"</b></font></small>")
}
/*=======END========*/


/*===================
  Long Date:   Sunday, September 29, 2002
  ===================*/ 
function GetLongDate(){
	// Get today's current date.
	var now = new Date();
	
	// Array list of days.
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	
	// Array list of months.
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	
	// Calculate the number of the current day in the week.
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	
	// Calculate four digit year.
	function fourdigits(number)	{
		return (number < 1000) ? number + 1900 : number;
									}
	
	// Join it all together
	today =  days[now.getDay()] + ", " +
			  months[now.getMonth()] + " " +
			   date + ", " +
			    (fourdigits(now.getYear())) ;
	
	// Print out the data. 	document.write("Today\'s date is " +today+ ".");
	document.write(today);
}
/*=======END========*/


/*===================
   Bookmark Us
  ===================*/ 
var url = "http://www.GymnasticsWorld.com";
var title = "Gymnastics World Online";

/*====== NEW Ver ======*/
function BookmarkUs()
{
	var ver = navigator.appName
	var num = parseInt(navigator.appVersion)
	if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) 
	{
	   window.external.AddFavorite(url,title)
	}
	else
	{
	   title += "  (Ctrl+D)"
	} 
}
/*=======END========*/


/*===================
   Animate Window Opening from Center
  ===================*/ 
function ZoomOutWindow() {
for(x = 0; x < 50; x++) {
window.moveTo(screen.availWidth * -(x - 50) / 100, screen.availHeight * -(x - 50) / 100);
window.resizeTo(screen.availWidth * x / 50, screen.availHeight * x / 50);
}
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}
/*=======END========*/


/*===================
   Show Last Update
  ===================*/ 

function LastModified(){
document.write("<b>Last updated: "+document.lastModified+"</b>")
}
/*=======END========*/



/*===================
   Show Last Update
  ===================*/ 

message = "Sorry!  You do NOT have permission to copy any material from Gymnastics World ©";

function NoRightClick(b) {
   if(((navigator.appName=="Microsoft Internet Explorer")&&(event.button > 1))
   ||((navigator.appName=="Netscape")&&(b.which > 1))){
   alert(message);
   return false;
   }
}
document.onmousedown = NoRightClick;
/*=======END========*/


/*=================
   NETSCAPE Resize
  =================*/ 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
/*==================*/


/*=================
   Show a Popup Window
  =================*/ 
var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
/*=======END========*/

/*=================
   Print Window
  =================*/ 
function PrintPage() 
{ print(document); }
/*=======END========*/



/*=================
   Show a Popup That Resizes to an Image
  =================*/ 
// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
// Set Margin (3px) and double the value (6px) for borders at the window.resizeto
var AutoClose = false;

// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=150,height=100,left='+PositionX+',top='+PositionY;

function PopImage(imageURL,imageTitle)
{
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document)
	{
	writeln('<html><head><title>Loading...</title><style>body{margin:3px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
	writeln('width=100-(document.body.clientWidth-document.images[0].width);');
	writeln('height=100-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width+26,height+6);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
	close();		
	}
}

/*============================
   Claculate Difference between two dates
  =============================*/ 
function isNumberFloat(inputString)
{
  return (!isNaN(parseInt(inputString))) ? true : false;
}

function YearDifference(StartYear) 
{
	now = new Date();
	var CurMonth = now.getMonth();
	var CurDate = now.getDate();
	var CurYear = now.getFullYear();
	now = null;
		
	var Diff_Years =CurYear- StartYear ;
	var Diff_Months = 7 - CurMonth;
	var Diff_Days = 21 - CurDate;
	
	if (isNumberFloat(Diff_Years))
		{document.write(Diff_Years)}
	else 
		{return false;}
}

/*============================
   What is the Current Year
  =============================*/ 
function CurrentYear() 
{
	now = new Date();
	var CurYear = now.getFullYear();
	now = null;

	document.write(CurYear);
}


/*============================
   Is this a Valid email address?
  =============================*/ 
function checkEmailAddress(field)
{
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	if (goodEmail) 
	   {
		good = true;
	   }
	else
	   {
		alert('Please enter a valid address.');
		field.focus();
		field.select();
		good = false;
	   }
}

/*============================
   Center  Browser on Screen
  =============================*/ 
function CenterBrowser(w,h) 
{
	if (w>0) {window.resizeTo(w,h)};
	   
	PositionX = (screen.width-window.innerWidth)*0.5;
	PositionY=(screen.height-window.innerheight)*0.5;
	
	window.top(PositionY);
	window.left(PositionX);
	
	alert('X=' +PositionX + 'Y=' +PositionY);
}


/*============================
   Calculate exact Age
  =============================*/ 
//Age (year, month, day, unit, decimals, rounding)
//Decimals specifies demical places to round to (ie: 2)
//Age(11, 24, 1997)

//var one_day=1000*60*60*24
//var one_month=1000*60*60*24*30
var one_year=1000*60*60*24*30*12

function Age(mon, day, yr)
{
	today=new Date()
	var pastdate=new Date(yr, mon-1, day)
	
	var AgeCalculated=0
	
	AgeCalculated=(today.getTime()-pastdate.getTime())
	AgeCalculated=(AgeCalculated/one_year)*1
	AgeCalculated=Math.floor(AgeCalculated)
	
	document.write(AgeCalculated)
}

//=================================
