startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		if(navRoot != null) {
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	  }
	}
}
window.onload=startList;


 

// script for alternating table row backgrounds

// this function is need to work around a bug in IE related to element attributes

function hasClass(obj) {
	var result = false;
	if (obj.getAttributeNode("class") != null) {
	result = obj.getAttributeNode("class").value;
 }
 return result;
}   


function stripe(id) {

// the flag we'll use to keep track of whether the current row is odd or even
var even = false;

// if arguments are provided to specify the colours of the even & odd rows, then use the them;
// otherwise use the following defaults:
var evenColor = arguments[1] ? arguments[1] : "#fff";
var oddColor = arguments[2] ? arguments[2] : "#f0f0f0";

// obtain a reference to the desired table if no such table exists, abort
var table = document.getElementById(id);
if (! table) { return; }

// by definition, tables can have more than one tbody element, so we'll have to get the list of child &lt;tbody&gt;s 
var tbodies = table.getElementsByTagName("tbody");

// and iterate through them...
for (var h = 0; h < tbodies.length; h++) {

 // find all the &lt;tr&gt; elements... 
  var trs = tbodies[h].getElementsByTagName("tr");
  
  // ... and iterate through them
  for (var i = 0; i < trs.length; i++) {

	// avoid rows that have a class attribute or backgroundColor style
	if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {

	 // get all the cells in this row...
	  var tds = trs[i].getElementsByTagName("td");
	
	  // and iterate through them...
	  for (var j = 0; j < tds.length; j++) {
	
		var mytd = tds[j];

		// avoid cells that have a class attribute or backgroundColor style
		if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
	
		  mytd.style.backgroundColor = even ? evenColor : oddColor;
		  
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }

function stripe_relay(id) {

	// the flag we'll use to keep track of whether the current row is odd or even
	var even = false;
	
	// if arguments are provided to specify the colours of the even & odd rows, then use the them;
	// otherwise use the following defaults:
	var evenColor = arguments[1] ? arguments[1] : "#fff";
	var oddColor = arguments[2] ? arguments[2] : "#f0f0f0";

	var curColor = oddColor;
	var curId = "";

	// obtain a reference to the desired table if no such table exists, abort
	var table = document.getElementById(id);
	
	if (! table) { return; }

	// by definition, tables can have more than one tbody element, so we'll have to get the list of child &lt;tbody&gt;s 
	var tbodies = table.getElementsByTagName("tbody");

	// and iterate through them...
	for (var h = 0; h < tbodies.length; h++) {

		// find all the &lt;tr&gt; elements... 
		var trs = tbodies[h].getElementsByTagName("tr");
  
		// ... and iterate through them
		for (var i = 0; i < trs.length; i++) {
		
			if (curId != trs[i].id) {
				curId = trs[i].id;
				curColor = (curColor == oddColor ? evenColor : oddColor);
//alert(curColor);
			}
//curColor += trs[i].id;
//alert(curColor);

			// avoid rows that have a class attribute or backgroundColor style
			if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {


				// get all the cells in this row...
				var tds = trs[i].getElementsByTagName("td");
	
				// and iterate through them...
				for (var j = 0; j < tds.length; j++) {
					var mytd = tds[j];
					// avoid cells that have a class attribute or backgroundColor style
					if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
						mytd.style.backgroundColor = curColor; //even ? evenColor : oddColor;
					}
				}
				
			}
			// flip from odd to even, or vice-versa
			even =  ! even;
    }

  }

}

function openViewer(id, width, height) {

		if(width > 750)
			width = 750;
		
		if(height > 550)
			height = 550;
		
	windowprops = "scrollbars=yes,top=100,left=100,resizable=yes" + ",width=" + (width + 50).toString() + ",height=" + (height + 50).toString();
	newWindow = window.open("/Resource/ShowPhoto.aspx?Picture_ID=" + id, "page", windowprops)	

}


function clearSelection(){
	document.getElementById('hdnUser').value = '';
	document.getElementById('lblUser').value = '';
}

var nonMifPopupWinProps="scrollbars=yes,width=800px,height=500px";

// The below JS functions are for RollOver Effect on Table Rows.
/* JavaScript Code Start: SandeshK (2006/09/07)*/
/*
	var arrayOfRolloverClasses	= new Array();
	var arrayOfClickClasses		= new Array();
	var activeRow				= false;
	var activeRowClickArray		= new Array();

	function highlightTableRow()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

		if(this!=activeRow){
			this.setAttribute('origCl',this.className);
			this.origCl = this.className;
		}
		this.className = arrayOfRolloverClasses[tableObj.id];
		
		activeRow = this;
	}

	function clickOnTableRow()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;		
		
		if(activeRowClickArray[tableObj.id] && this!=activeRowClickArray[tableObj.id])
		{
			activeRowClickArray[tableObj.id].className='';
		}
		this.className = arrayOfClickClasses[tableObj.id];

		activeRowClickArray[tableObj.id] = this;
	}

	function resetRowStyle()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

		if(activeRowClickArray[tableObj.id] && this==activeRowClickArray[tableObj.id])
		{
			this.className = arrayOfClickClasses[tableObj.id];
			return;	
		}

		var origCl = this.getAttribute('origCl');
		if(!origCl)origCl = this.origCl;
		this.className=origCl;
	}

	function addTableRolloverEffect(tableId,whichClass,whichClassOnClick)
	{
		arrayOfRolloverClasses[tableId]	= whichClass;
		arrayOfClickClasses[tableId]	= whichClassOnClick;
		
		var tableObj					= document.getElementById(tableId);
		alert("tableId:" + tableId);
		alert(document.getElementById("tblSwimmer"));
		var tBody						= tableObj.getElementsByTagName('tr');
		alert("tBody:" + tBody);
		if(tBody)
		{
			var rows					= tBody[0].getElementsByTagName('tr');
		}
		else
		{
			var rows					= tableObj.getElementsByTagName('tr');
		}
		for(var no=0;no<rows.length;no++)
		{
			rows[no].onmouseover		= highlightTableRow;
			rows[no].onmouseout			= resetRowStyle;

			if(whichClassOnClick)
			{
				rows[no].onclick = clickOnTableRow;	
			}
		}
	}
*/	
	
	function classChange(styleChange,item) 
	{
		item.className = styleChange;
	}
	
/* JavaScript Code End: SandeshK */

/* Added by bhavana kamat on 20/10/2006 to check the Team description and Workout Schedule length */
/* start code*/

function checkMaxLength(id,typ,txt)
{
	var obj = document.getElementById(id);
	var strMsg = '';

	if(typ == "P")
		strMsg = "Pool ";
	else if(typ == "T")
		strMsg = "Team ";
	else if(typ == "B")
		strMsg = "Beach ";
		
	if(txt == 'Desc')
		strMsg += "Description ";
	else if(txt == 'Sched')
		strMsg = "Workout Schedule ";
		
	var len = obj.value.length;

	if(len >= 1500)
	{
		//Start Code : Bhavana Kamat(10/11/2006)
		//As per requirement alert was not required
		//alert(strMsg + "should not be more than 1500 characters");
		//End Code : Bhavana Kamat(10/11/2006)
		return false;
	}

	return (true);
}


/* end code */








/* JavaScript Code Starts: Kshema Kaup - to accept valid numbers as key inputs*/

function goodchars(e, goods)
{
	var key, keychar;
	key = getkey(e);
	if (key == null) return true;

	// get character
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();
	
	// check goodkeys
	if (goods.indexOf(keychar) != -1)
	{
		return true;
	}

	// control keys
	//updated by bhavana kamat on 30/10/2006 
	//Reason: Added key==92 for allowing "\"
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 || key==92)
	return true;

	// else return false
	return false;
}
//This method return keycode of character
function getkey(e)
{
	if (window.event)
	return window.event.keyCode;
	else if (e)
	return e.which;
	else
	return null;
}
/* JavaScript Code End: Kshema Kaup */

// Javascript Code Start: SandeshK (2006/10/30)
// This function returns string with replaced character(s)
function replaceAll(str, frm, to)
{
	var idx = str.indexOf(frm);

	while(idx > -1)
	{
		str = str.replace(frm, to);
		idx = str.indexOf(frm);
	}

	return str;
}
// Javascript Code End: SandeshK

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion;
    
    this.dom=document.getElementById?1:0;
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
    return this;
} 

bw=new verifyCompatibleBrowser();

function showDiv(obj)
{
    var objstyle = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval('document.'+obj):0;

	if (!bw.ns4) 
	{
        objstyle.display = "";
    }
	
}

function hideDiv(obj)
{
    var objstyle = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval('document.'+obj):0;

	if (!bw.ns4) 
	{
        objstyle.display = "none";
    }
	
}

function showHideInfo(linkObj, infoLayer) {
	if (linkObj.className == "hide"){
		linkObj.className = "show"
		document.getElementById(infoLayer).style.display="none";
	}else{
		linkObj.className = "hide"
		document.getElementById(infoLayer).style.display="";
	}	
}

function showHideInfo2(linkObj, infoLayer, alternateInfoLayer) {
	if (linkObj.className == "hide"){
		linkObj.className = "show"
		document.getElementById(infoLayer).style.display="none";
		document.getElementById(alternateInfoLayer).style.display="";
	}else{
		linkObj.className = "hide"
		document.getElementById(infoLayer).style.display="";
		document.getElementById(alternateInfoLayer).style.display="none";
	}	
}

function showHideCheckboxDivs(chkObj, infoLayer, alternateInfoLayer) {

	if (chkObj.checked){
		document.getElementById(infoLayer).style.display="";
		document.getElementById(alternateInfoLayer).style.display="none";
	}else{
		document.getElementById(infoLayer).style.display="none";
		document.getElementById(alternateInfoLayer).style.display="";
	}
}

function showHideCheckboxDivs2(chkObj, infoLayer) {
	
	if (chkObj.checked){
		document.getElementById(infoLayer).style.display="none";
	}else{
		document.getElementById(infoLayer).style.display="";
	}
}

function showHideCheckboxDivs3(chkObj, infoLayer) {
	
	if (chkObj.checked){
		document.getElementById(infoLayer).style.display="";
	}else{
		document.getElementById(infoLayer).style.display="none";
	}
}

function centerUpdatePanel(panelName,control)
{
    centerElementOnScreen(document.getElementById(panelName),document.getElementById(control));
}

function centerElementOnScreen(element,control)
{
    var scrollTop = document.body.scrollTop;
    var scrollTop2 = control.offsetTop;
    var scrollLeft = document.body.scrollLeft;

    var viewPortHeight = document.body.clientHeight;
    var viewPortWidth = document.body.clientWidth;

    if (document.compatMode == "CSS1Compat")
    {
        viewPortHeight = document.documentElement.clientHeight;
        viewPortWidth = document.documentElement.clientWidth;

        scrollTop = document.documentElement.scrollTop;
        scrollLeft = document.documentElement.scrollLeft;
    }

    var topOffset = Math.ceil(viewPortHeight/2 - element.offsetHeight/2);
    var leftOffset = Math.ceil(viewPortWidth/2 - element.offsetWidth/2);

    //var top = scrollTop + topOffset - 40;
    var top = scrollTop2 + 160;
    var left = scrollLeft + leftOffset - 70;

    element.style.position = "absolute";
    element.style.top = top + "px";
    element.style.left = left + "px";
 }

 function nextPage(pageNumber) {
     document.Form1.currentPage.value = pageNumber;
     document.Form1.submit();
 }

 function changeSort(value) {
     for (var i = 0; i < document.Form1.elements.length; i++) {
         if (document.Form1.elements[i].name == 'ddlSort') {
             for (var ind = 0; ind < document.Form1.elements[i].options.length; ind++)
             {
                 if (document.Form1.elements[i].options[ind].value == value)
                     document.Form1.elements[i].options[ind].selected = true;
             }
         }
     }
     document.Form1.sortType.value = value;
     //document.form1.submit();
 }

 function changeDirection(value) {
     for (var i = 0; i < document.Form1.elements.length; i++) {
         if (document.Form1.elements[i].name == 'ddlDirection') {
             for (var ind = 0; ind < document.Form1.elements[i].options.length; ind++) {
                 if (document.Form1.elements[i].options[ind].value == value)
                     document.Form1.elements[i].options[ind].selected = true;
             }
         }
     }

     document.Form1.sortDirection.value = value;
     //document.form1.submit();
 }

 function doAction() {
     var oSort = document.getElementById('ddlSort');
     var oDirection = document.getElementById('ddlDirection');

     document.Form1.currentPage.value = 1;
     document.Form1.submit();
 }
 
function WatermarkFocus(txtElem, strWatermark, clientID)
{
    if (txtElem.value == strWatermark)
    {
        txtElem.value = '';
        document.getElementById(clientID).style.color = "";
    }
}

function WatermarkBlur(txtElem, strWatermark, clientID)
{
    if (txtElem.value == '') 
    {
        document.getElementById(clientID).style.color = "#ccc";
        txtElem.value = strWatermark;
    }
    else
    {
        document.getElementById(clientID).style.color = "";
    }
}