
/*Always run code. To remove frames if present. Prevents other, possibly malicious, sites from opening this site inside a frame on their site!*/
	// Disabled to allow Telerik Windows to work
//if (self != parent) parent.location.href = self.location.href;
//if (top != self) top.location.replace(self.location.href);

	function MM_openBrWindow(theURL,winName,features) { //v2.0
		window.open(theURL,winName,features);
		}
		 
		
	function ShowTranslate(PagePath, CtrlName, cssPath, tid, FormName, MaxLength, Rows)    
    {  
		ctl = document.getElementById(CtrlName);
		if (FormName == 'frmUnTranslatedText') 
		    ctlForm = document.getElementById(FormName);
		ShowWindow(PagePath + '/Translate.aspx?tid=' + tid + '&sValue=' + ctl.value + '&cssPath=' + cssPath + '&FormName=' + FormName + '&MaxLength=' + MaxLength + '&Rows=' + Rows,450,350,true)
    }

    function ShowReportMultiSelect(PagePath, cssPath, CtrlName, Lookup, LookupExt) {
        ctl = MM_findObj(CtrlName);
        if (PagePath == '')
            PagePath = '../controls';
        ShowWindow(PagePath + '/MultiSelect.aspx?ctlName=' + CtrlName + '&cssPath=' + cssPath + '&Lookup=' + Lookup + '&LookupExt=' + LookupExt + '&MSValue=' + ctl.value, 450, 350, true)
    }
    
	function ShowReportDateSelect(PagePath, cssPath, CtrlName)    
    {
        ctl = document.getElementById(CtrlName); 
        if (PagePath == '')
            PagePath = '../controls';
		ShowNamedWindow('ReportDateSelect', PagePath + '/RptDatePicker.aspx?ctlName=' + CtrlName + '&cssPath=' + cssPath ,450,350,true)
    } 
    
    	function MM_findObj(n, d) { //v4.01
			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);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
			}

	function MM_swapImage() 
		{ 
			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 MM_swapImgRestore() 
		{
			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_preloadImages() 
		{ 
			var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
		}

	function setStatus(msgStr) 
		{
			window.status = msgStr;
			document.returnValue = true;
		}

	function clearStatus() 
		{
			window.status = "";
			document.returnValue = true;
		}

	function SetFocus(ctl)
	{ 
		try
		{
		
			if (ctl!="")
			{	if (document.getElementById)
				{
					var d=document.getElementById(ctl);
				}
				else
				{	if (document.all || document.layers)
					var d=eval('document.forms[0].'+ctl);
				}
				if (d!=null)
				{
					d.focus();
				}
			}
		}
		catch(e){}	
	}

	function ShowNamedWindow(WindowName, link, width, height, scroll) {
		if (document.layers) {
			window.top.captureEvents(Event.CLICK | Event.FOCUS);
		}

		var y = 0
		var x = 0


		if (window.outerWidth) {
			x = ((window.outerWidth - width) / 2) + window.screenX;
			y = ((window.outerHeight - height) / 2) + window.screenY;
		}
		else {
			x = ((document.documentElement.clientWidth - width) / 2) + window.screenLeft;
			y = ((document.documentElement.clientHeight - height) / 2) + window.screenTop;
		}

		window.onclick = IgnoreEvents;
		window.onfocus = HandleFocus;

		if (scroll == true)
			winModalWindow = window.open(link, WindowName, "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",dependent=yes,toolbars=no,scrollbars=yes,status=yes,resizable=yes");
		else
			winModalWindow = window.open(link, WindowName, "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",dependent=yes,toolbars=no,scrollbars=no,status=yes,resizable=no");
		winModalWindow.focus();
	}

		
//Section for Modal Dialog simulation
	var ctlImage
	var ctlForm
	var winModalWindow
	

	function IgnoreEvents(e)
	{
		return false
	}

	function ChangeListSeparator(url){
		ShowWindow(url, 390, 140, false );
		return false;
	}

	function ShowWindow(link,width,height,scroll)
	{ 
		ShowNamedWindow('ModalChild', link,width,height,scroll);
	}

	function HandleFocus()
	{ 
		window.setTimeout("HandleFocus2()", 50);
		return false
	}
	
	function HandleFocus2()
	{
		if (winModalWindow)
			{
				if (!winModalWindow.closed)
					{
						winModalWindow.focus()
					}
				else
					{
						if (document.layers) 
							{
								window.top.releaseEvents(Event.CLICK|Event.FOCUS)
							}
						window.top.onfocus=null;
						window.top.onclick=true;
					}
			}
		return false
	}
	var ctl;
	var ctlParent;
	var ctlPathDisplay1;
	var ctlPathDisplay2;
	var ctlDisplayOrder
	
	
	function GetParentUI(Link, ctlName, ctlParentName, oPath1, oPath2, ParentUIID, ExcludeUIID, ItemType, oDisplayOrder, ShowAll, LinkedContent, SiteID)
	{
		ctl= document.getElementById(ctlName);
		ctlParent= document.getElementById(ctlParentName);
		ctlPathDisplay1 = document.getElementById(oPath1); 
		ctlPathDisplay2 = document.getElementById(oPath2); 
		ctlDisplayOrder = document.getElementById(oDisplayOrder); 
		ShowWindow(Link + '?ParentUIID=' + ParentUIID + '&ExcludeUIID=' + ExcludeUIID + '&ItemType=' + ItemType + '&ShowAll=' + ShowAll + '&LinkedContent=' + LinkedContent + '&SiteID=' + SiteID, 500,600,  true)
	}
	
	function GetUI(Link, ctlName, ctlParentName, oPath, ParentUIID, ExcludeUIID, ItemType, oDisplayOrder, ShowAll, PartID, GroupID)
	{
		ctl= document.getElementById(ctlName);
		ctlParent= document.getElementById(ctlParentName);
		ctlPathDisplay = document.getElementById(oPath); 
		ctlDisplayOrder = document.getElementById(oDisplayOrder); 
		ShowWindow(Link + '?ParentUIID=' + ParentUIID + '&ExcludeUIID=' + ExcludeUIID + '&ItemType=' + ItemType + '&ShowAll=' + ShowAll + '&PartID=' + PartID + '&GroupID=' + GroupID + '&LinkedContent=0', 350,420,  true)
	}
	
	function ReturnTrans()
    {
		document.forms[0].submit();
    } 
	
	function SetParent(sParent, sParentType, sPath, sDisplayOrder)
    {
		ctl.value = sParent;
		if(ctlParent)ctlParent.value = sParentType;
		ctlPathDisplay1.innerHTML = sPath;
		if (ctlPathDisplay2!=null)ctlPathDisplay2.value = sPath;
		if (ctlDisplayOrder!=null)ctlDisplayOrder.value=sDisplayOrder;
			
    }

	function GetDate(Link, CtrlName,time,DOB)    
    {
        ctl = document.getElementById(CtrlName);
		if (time==1)
			ShowWindow(Link + 'Calendar.aspx?DOB=' + DOB + '&sDate=' + ctl.value + '&time=' + time,300,320,false)
		else
			ShowWindow(Link + 'Calendar.aspx?DOB=' + DOB + '&sDate=' + ctl.value ,300,300,false)
    } 
      
    function SetDate(sDate)
    {
		ctl.value = sDate;
		fireHTMLEvent(ctl, 'keyup', false);

/*		ctl.fireEvent("onchange",evt);*/
    }


	function GetTime(Link, CtrlName)    
    {  
		ctl = document.getElementById(CtrlName);
		ShowWindow(Link + 'TimePicker.aspx?sTime=' + ctl.value ,300,150,false)
    } 
      
    function SetTime(sTime)
    {
		ctl.value = sTime;
		fireHTMLEvent(ctl, 'keyup', false);

/*		ctl.fireEvent("onchange",evt);*/
    }
/* Fire an event in a browser-compatible manner */
    function fireHTMLEvent(element, eventType, canBubble) {
    canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
    if (element.fireEvent) {
        element.fireEvent('on' + eventType);
    }
    else {
        var evt = document.createEvent('HTMLEvents');
        evt.initEvent(eventType, canBubble, true);
        element.dispatchEvent(evt);
    }
}




/* Fire an event in a browser-compatible manner */
function fireClick(target) {
    fireMouseEvent(target, "click");
}


function fireMouseEvent(target, event) {
    if (document.dispatchEvent) { // W3C
        var oEvent = document.createEvent("MouseEvents");
        oEvent.initMouseEvent(event, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, target);
        target.dispatchEvent(oEvent);
    }
    else if (document.fireEvent) { // IE
        target.fireEvent("on" + event);
    }
}


    var ContactCtl
    
    
    
    function AddContact(Path, CtrlName, NoBind)    
    {  
		var popupHeight=800
		var popupWidth=700
		ContactCtl = CtrlName;
		ShowNamedWindow('AddContact',Path+ '&NoBind=' + NoBind,popupWidth,popupHeight, true)
    } 
    
    
    function FindContact(Path, CtrlName, Find, AssociateID, ShowBodyType, NoBind, ExcludeBodyID, Group)    
    {  
		var popupHeight=550
		var popupWidth=340
		ContactCtl = CtrlName;
		ShowNamedWindow('ContactPicker', Path + 'FindContact.aspx?Find=' + Find + '&AssociateID=' + AssociateID + '&ShowBodyType=' + ShowBodyType + '&NoBind=' + NoBind + '&ExcludeBodyID=' + ExcludeBodyID+ '&Group=' + Group , popupWidth,popupHeight, true)
    } 
    
    function SetContact(sName,iContactID,NoBind)
    {
		var ctlhd
		var ctlProcess
		var ctlPickerDisplay
		
		ctlhd = document.getElementById(ContactCtl + "Displayhd");
		ctlhd.value = sName;
				
		ctlProcess = document.getElementById(ContactCtl + "DisplayProcess");
		if (ctlProcess!=null)
				{
				ctlProcess.value = 1;
				}
		
		ctl = document.getElementById(ContactCtl + "DisplayID");
		ctl.value = iContactID;
		//document.forms[0].submit();
		//alert(NoBind); 
		if (NoBind != '1')
			{
				document.forms[0].submit();
			}
		else
			{
				ctlPickerDisplay = document.getElementById(ContactCtl + "_PickerDisplay"); 
				ctlPickerDisplay.innerHTML = sName;
			}
		if (ctlProcess!=null)
				{
				ctlProcess.value = 0;
				}
		
    }
    
    function DeleteContact(CtrlName)
    {
		var ctlhd
		var ctlProcess
		
		ctlhd = document.getElementById(CtrlName + "Displayhd");
		ctlhd.value = '';
		
		ctlProcess = document.getElementById(CtrlName + "DisplayProcess");
		if (ctlProcess!=null)
				{
				ctlProcess.value = 1;
				}
		
		ctl = document.getElementById(CtrlName + "DisplayID");
		ctl.value = 0;
		
		document.forms[0].submit();
		if (ctlProcess!=null)
				{
				ctlProcess.value = 0;
				}
		
    }

   
 function ShowVideo(PagePath)    
    {  
		ShowNamedWindow('VideoView', PagePath, 450,500, true)
    } 
       
    
    function CompSchedulePopup(url)    
    {  
		var popupHeight=600
		var popupWidth=700
		ShowWindow(url,popupWidth,popupHeight,true)
    } 
   
    function AwardContactPopup(url)    
    {  
		var popupHeight=450
		var popupWidth=500
		ShowNamedWindow('AssignAward',url,popupWidth,popupHeight,true)
    } 
   
    function CourseLevelPopup(url)    
    {  
		var popupHeight=450
		var popupWidth=500
		ShowWindow(url,popupWidth,popupHeight,true)
    } 
        
    function BlurbEdit(url)    
	{  
		ShowNamedWindow('BlurbEdit', url, 800, 500, true)
	} 
       
    
    function ReturnDate()
	{
		var now = new Date();   
		return now.getDate()+'/'+eval(now.getMonth()+1)+'/'+now.getFullYear();
	}
    function Today()
	{
		var now = new Date();   
		return now.getDate()+'  '+eval(now.getMonth()+1)+'  '+now.getFullYear();
	}
	
	function dateAdd( start, interval, number ) {
		
		// Create 3 error messages, 1 for each argument. 
		var startMsg = "Sorry the start parameter of the dateAdd function\n"
			startMsg += "must be a valid date format.\n\n"
			startMsg += "Please try again." ;
			
		var intervalMsg = "Sorry the dateAdd function only accepts\n"
			intervalMsg += "d, h, m OR s intervals.\n\n"
			intervalMsg += "Please try again." ;

		var numberMsg = "Sorry the number parameter of the dateAdd function\n"
			numberMsg += "must be numeric.\n\n"
			numberMsg += "Please try again." ;
			
		// get the milliseconds for this Date object. 
		var buffer = Date.parse( start ) ;
		
		// check that the start parameter is a valid Date. 
		if ( isNaN (buffer) ) {
			alert( startMsg ) ;
			return null ;
		}
		
		// check that an interval parameter was not numeric. 
		if ( interval.charAt == 'undefined' ) {
			// the user specified an incorrect interval, handle the error. 
			alert( intervalMsg ) ;
			return null ;
		}

		// check that the number parameter is numeric. 
		if ( isNaN ( number ) )	{
			alert( numberMsg ) ;
			return null ;
		}

		// so far, so good...
		//
		// what kind of add to do? 
		switch (interval.charAt(0))
		{
			case 'd': case 'D': 
				number *= 24 ; // days to hours
				// fall through! 
			case 'h': case 'H':
				number *= 60 ; // hours to minutes
				// fall through! 
			case 'm': case 'M':
				number *= 60 ; // minutes to seconds
				// fall through! 
			case 's': case 'S':
				number *= 1000 ; // seconds to milliseconds
				break ;
			default:
			// If we get to here then the interval parameter
			// didn't meet the d,h,m,s criteria.  Handle
			// the error. 		
			alert(intervalMsg) ;
			return null ;
		}
		return new Date( buffer + number ) ;
	}
	function Yesterday()
	{
		var d = new Date();
		var i = 'd' ;
		var j = -1 ;
		
		temp = ( dateAdd( d, i, j ) ) ;
		
		if ( temp != null ) return temp.getDate()+'/'+eval(temp.getMonth()+1)+'/'+temp.getFullYear();
 ;
	}


function ShowWindow2(link,width,height,scroll)
	{ 
		ShowNamedWindow('ModalChild2', link,width,height,scroll);
	}
	var objpostbackCtl;
function GetSiteID(Link, ctlSiteID, ctlSiteName1, ctlSiteName2,postbackCtl)
	{
		ctl= document.getElementById(ctlSiteID);
		ctlPathDisplay1 = document.getElementById(ctlSiteName1); 
		if (ctlSiteName2!=null) ctlPathDisplay2 = document.getElementById(ctlSiteName2); 
		if (postbackCtl!=null) objpostbackCtl=document.getElementById(postbackCtl);
		ShowNamedWindow('SiteIDPicker',Link, 500,600,  true)
		
	}
function SetSiteID(sSiteID, sSiteName)
    {
		ctl.value = sSiteID;
		ctlPathDisplay1.innerHTML = sSiteName;
		if (ctlPathDisplay2!=null) {
			ctlPathDisplay2.value = sSiteName;
		}
		if (objpostbackCtl!=null)  objpostbackCtl.click();return false;
		
    }

function ClearSite(SiteID, SiteName1, SiteName2)	
	{
	document.getElementById(SiteID).value='';
	document.getElementById(SiteName1).innerHTML='';
	document.getElementById(SiteName2).value='';
	}   
	 		
function setDisplay(o,display)
{
	ary = document.getElementsByName(o) ;
	
	if(ary.length==0)
	{
		ary=new Array(0)
		ary[0]=document.getElementById(o);
	}
	if (ary.length>0)
	{ 

		for (i = 0 ; i < ary.length ; i++)
		{ 
			if(display)
			{
				try
				{
					ary[i].style.display='inline-block';
					ary[i].style.display='table-row';
				}
				catch(e){}
			}
			else
			{
				try
				{
					ary[i].style.display='none';
				}
				catch(e){}
			}
		}
	}
}
function CheckAllCheckBoxes(aspCheckBoxID, checkVal) 
{

    re = new RegExp(':' + aspCheckBoxID + ':') 
    for(i = 0; i < document.forms[0].elements.length; i++) 
    {

        elm = document.forms[0].elements[i]

        if (elm.type == 'checkbox') 
        {
            if (re.test(elm.name)) 
            {
                elm.checked = checkVal
            }
        }
    }
}
function ShowTransactionListForGLItem(Path, TransID, LookupID)    
    {  
		var popupHeight=450
		var popupWidth=600
		ShowWindow(Path + 'TransactionsForGLItem.aspx?TransID=' + TransID + '&LookupID=' + LookupID,popupWidth,popupHeight,true)
    } 

function printit()
{  
	if (window.print) {
		window.print() ;  
	} else {
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}


function extractNumber(obj, decimalPlaces, allowNegative)
{
	var temp = obj.value;
	
	// avoid changing things if already formatted correctly
	var reg0Str = '[0-9]*';
	if (decimalPlaces > 0) {
		reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}';
	} else if (decimalPlaces < 0) {
		reg0Str += '\\.?[0-9]*';
	}
	reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str;
	reg0Str = reg0Str + '$';
	var reg0 = new RegExp(reg0Str);
	if (reg0.test(temp)) return true;

	// first replace all non numbers
	var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']';
	var reg1 = new RegExp(reg1Str, 'g');
	temp = temp.replace(reg1, '');

	if (allowNegative) {
		// replace extra negative
		var hasNegative = temp.length > 0 && temp.charAt(0) == '-';
		var reg2 = /-/g;
		temp = temp.replace(reg2, '');
		if (hasNegative) temp = '-' + temp;
	}
	
	if (decimalPlaces != 0) {
		var reg3 = /\./g;
		var reg3Array = reg3.exec(temp);
		if (reg3Array != null) {
			// keep only first occurrence of .
			//  and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0
			var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length);
			reg3Right = reg3Right.replace(reg3, '');
			reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right;
			temp = temp.substring(0,reg3Array.index) + '.' + reg3Right;
		}
	}
	
	obj.value = temp;
}
function blockNonNumbers(obj, e, allowDecimal, allowNegative)
{
	var key;
	var isCtrl = false;
	var keychar;
	var reg;
		
	if(window.event) {
		key = e.keyCode;
		isCtrl = window.event.ctrlKey
	}
	else if(e.which) {
		key = e.which;
		isCtrl = e.ctrlKey;
	}
	
	if (isNaN(key)) return true;
	
	keychar = String.fromCharCode(key);
	
	// check for backspace or delete, or if Ctrl was pressed
	if (key == 8 || isCtrl)
	{
		return true;
	}

	reg = /\d/;
	var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
	var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
	
	return isFirstN || isFirstD || reg.test(keychar);
}

function sendVote (link,ctrl) 
{
	ary = document.getElementsByName(ctrl) ;
		
	if(ary.length==0)
	{
		ary=new Array(0)
		ary[0]=document.getElementById(ctrl);
	}
	if (ary.length>0)
	{ 
		for (i = 0 ; i < ary.length ; i++)
		{ 
			if(ary[i].checked == true)
			{
				link+=ary[i].value
				
				break;
			}
		} 
    }
ShowNamedWindow('OpinionPoll', link ,450,420,true)
}

function selectMe(me)
{	
	ary = document.getElementsByName('selected') ;
	
	if(ary.length==0)
	{
		ary=new Array(0)
		ary[0]=document.getElementById('selected');
	}
	if (ary.length>0)
	{ 
		for (i = 0 ; i < ary.length ; i++)
		{ 
			try
			{
				ary[i].id='normal'
			}
			catch(e){}
		}
	}
	if (me.parentNode)
		me.parentNode.id='selected';
	else 	if (me.parentElement)
		me.parentElement.id='selected';

}


function clickButtonCtrl(e, ctlbtn) 
{
    var keyCode = (window.Event) ? e.which : e.keyCode;
    if (keyCode == 13) 
	{
	
		var fireOnThis = document.getElementById(ctlbtn);
		if (fireOnThis && typeof(fireOnThis.click) != "undefined")
		fireOnThis.click();
		
		e.cancelBubble = true; 
		if (e.stopPropagation) e.stopPropagation(); 
			return false;
	} 
	    
}
function setGenericTab(id, ctl, btnPrefix)
{
    var tab
    if (ctl)
        tab=ctl
        
    else
	    tab=document.getElementById('td' + id);
	var MP=document.getElementById('MP' + id);
	if (tab)
	{ 
		if (selectedTab)
		{
			selectedTab.className ='GenericTab';
			selectedTab.childNodes[0].className='GenericTabLink';
		}
		tab.className ='GenericTabSelectedTab';
		tab.childNodes[0].className='GenericTabSelectedTabLink';
		selectedTab=tab;
	}
	if (MP)
	{
		if (selectedMP )
			setDisplay(selectedMP.id,false);
/*			selectedMP.style.display='none';
		MP.style.display='block';*/
		setDisplay(MP.id,true);
		selectedMP=MP
	}
	if (btnPrefix  && !document.getElementById(tab.id.replace('td', btnPrefix)).getAttribute('Loaded')) {
	    document.getElementById(tab.id.replace('td', btnPrefix)).click();
	}
}

	
function SetImage(ImageName)
{
	ctlImage.value = ImageName;
}

    
function SetText(sValue, FormName)
{
	if (ctl!=null)
	{
	ctl.value = sValue;
		}
}

function ShowTranslator(PagePath, cssPath, tid)    
{  
	ShowWindow(PagePath + '/Translate.aspx?tid=' + tid + '&cssPath=' + cssPath + '&Trans=1',400,400,true)
} 

function ReturnTrans()
{
	document.forms[0].submit();
} 

function HorseGrade(HorseID, DisciplineID, Path, Guid, hName)    
{
    ShowWindow2(Path + 'HorseGrade.aspx?HorseID=' + HorseID + '&DisciplineID=' + DisciplineID + '&GUID=' + Guid + '&hName=' + hName, 400, 300, false)
} 

function RiderGrade(RiderID, DisciplineID)    
{  
	ShowWindow2('../Horse/RiderGrade.aspx?RiderID=' + RiderID + '&DisciplineID=' + DisciplineID, 300, 150, false)
} 

function HeartRate(ResultID, EventID, HorseID)    
{  
	ShowWindow2('Horse/QEHeartRate.aspx?ResultID=' + ResultID + '&EventID=' + EventID + '&HorseID=' + HorseID, 300, 300, false)
} 

function ProfileEdit(BodyID)    
{  
	ShowWindow2('../Admin/ProfileEdit.aspx?BodyID=' + BodyID, 800, 500, true)
} 

function GamesBlurbEdit(GamesID, TypeID)    
{  
	ShowWindow2('../Admin/BlurbEdit.aspx?BlurbID=' + GamesID + '&TypeID=' + TypeID , 800, 500, true)
} 

function SportBlurbEdit(SportID, TypeID)    
{  
	ShowWindow2('../Admin/BlurbEdit.aspx?BlurbID=' + SportID + '&TypeID=' + TypeID , 800, 500, true)
} 

function DisciplineBlurbEdit(DisciplineID, TypeID)    
{  
	ShowWindow2('../Admin/BlurbEdit.aspx?BlurbID=' + DisciplineID + '&TypeID=' + TypeID, 800, 500, true)
} 

function Trim(s) 
{
// Remove leading spaces and carriage returns
	
while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
{
	s = s.substring(1,s.length);
}

// Remove trailing spaces and carriage returns

while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
{
	s = s.substring(0,s.length-1);
}
return s;
}

function getObjInnerText (obj) { 
return (obj.innerText) ? obj.innerText 
: (obj.textContent) ? obj.textContent 
: ""; 
} 