// JavaScript Document
function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) { // by Paul Davis - http://www.kaosweaver.com
	loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
	document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
	a=(loc.indexOf(defp)==-1)?1:2;for (i=0;i<(subs.length-a);i++) { subs[i]=makeCaps(unescape(subs[i]));
	document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');}
	if (nl==1) document.write("<br>");
	mytitle=document.title
	mytitle=mytitle.replace("SportsTeamMom | ","")
	document.write("<span class=\"" + tStyle + "\">" + mytitle + "</span>");
}
function makeCaps(a) {
  g=a.split(' ');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
  return g.join(" ");
}
function getLoc(c) {
  var d="";if (c>0) for (k=0;k<c;k++) d=d+"../"; return d;
}
function formvalidator(theForm) {
  if (theForm.sport.value == "")
  {
    alert("Please select a Sport.");
    theForm.sport.focus();
    return (false);
  }
  if (theForm.team_name.value == "")
  {
    alert("Please enter Team Name.");
    theForm.team_name.focus();
    return (false);
  }
  if (theForm.account_owner_firstname.value == "")
  {
    alert("Please enter Account Owner First Name.");
    theForm.account_owner_firstname.focus();
    return (false);
  }
  if (theForm.account_owner_lastname.value == "")
  {
    alert("Please enter Account Owner Last Name.");
    theForm.account_owner_lastname.focus();
    return (false);
  }
   if (theForm.account_owner_email.value == "")
  {
    alert("Please enter Account Owner Email.");
    theForm.account_owner_email.focus();
    return (false);
  } 
  if (!isEmailAddr(theForm.account_owner_email.value)) 
  {
	alert("Please enter a valid Account Owner Email.");
	theForm.account_owner_email.focus();
	return (false);
  }
  if (theForm.account_owner_password.value == "")
  {
    alert("Please enter Account Owner Password.");
    theForm.account_owner_password.focus();
    return (false);
  }
  return (true);
}

function isEmailAddr(email) {
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

//functions repeated (but not used) in cal js file
//function ensureRefresh()
//{
	//document.calendarPage.submit();
//}
function ensureRefresh()
{
	document.calendarPage.day.value = "";
	document.calendarPage.view.value = "calendar";
	document.calendarPage.action = "calendar.php";
	document.calendarPage.submit();
}
function tdmv(aItem)
{
	aItem.style.backgroundColor = 'C0C0C0';
}

function tdmu(aItem)
{
	aItem.style.backgroundColor = 'ECECEC';
}

function tdtmo(aItem)
{
	aItem.style.backgroundColor = 'ECECEC';	
}

function tdtmot(aItem)
{
	aItem.style.backgroundColor = 'FFFFFF';	
}

function sendDay(schedDay, schedMonth, schedYear)
{
	document.calendarPage.day.value = schedDay;
	document.calendarPage.month.value = schedMonth;
	document.calendarPage.year.value = schedYear;
	document.calendarPage.view.value = "schedule";
	document.calendarPage.submit();
}

function sendDayNew(schedDay, schedMonth, schedYear)
{
	document.calendarPage.action = 'calendar_admin.php?submit=add&day='+schedDay+'&month='+schedMonth+'&year='+schedYear;
	document.calendarPage.submit();
}

function newWindow(popupUrl) {
	previewWindow = window.open(popupUrl,"previewWindow"); 
	previewWindow.focus(); 
} 

function allDigits(str) {
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset) {
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// 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

var AutoClose = true;

// Do not edit below this line...
// ================================
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=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,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:0px;}</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(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["STM"].width;');writeln('window.innerHeight=document.images["STM"].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="STM" src='+imageURL+' style="display:block"></body></html>');
close();		
}}
