function openRegisterWindow()
		{
			window.open('https://secure.thefa.com/FAN/Register.aspx?registrationID={9AF6D171-8FA5-4B61-BAD5-97C7C9B3B6AB}','winReg','width=479,height=600,scrollbars=no,statusbar=no');
		}	
		
		function NewWin(url) {
			var newWindow = window.open(url);
		newWindow.focus();
		}		
function highlightButton(s) {
    if ("INPUT"==event.srcElement.tagName)
      event.srcElement.className=s;
  }
  function h( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#666666';
				tableCellRef.className = 'x';
				break;
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#FFFFFF';
				tableCellRef.className = 'lm';
				break;
		}
	}
}
function h2( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#666666';
				tableCellRef.className = 'x2';
				break;
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#999999';
				tableCellRef.className = 'topstyle';
				break;
		}
	}
}
function hCl( url ) {
	window.location.href = url;
}

function dofocus(){
	if(document.getElementById('_ctl0:_ctl0:login_username') != null){
	   document.getElementById('_ctl0:_ctl0:login_username').focus();
	}
}

function newHelpWin(url, name, w, h) {
  l = (screen.availWidth-10 - w) / 2;
  t = (screen.availHeight-20 - h) / 2;

  features = "width="+w+",height="+h+",left="+l+",top="+t;
  features += ",screenX="+l+",screenY="+t;
  features += ",scrollbars=1,resizable=1,location=0";
  features += ",menubar=0,toolbar=0,status=0";

  window.open(url, name, features);
}

function doshowhelp(id) {
newHelpWin('/somersetfa/help.aspx?id=' + id,null,620,500);
}

function doshowworkshop(id) {
newHelpWin('/somersetfa/workshopinfo.aspx?popup=1&id=' + id,null,620,500);
}
var rowBackColor, columnBorderColor;
function RowMouseOver(index)
{
	rowBackColor = this.Rows[index].Control.style.backgroundColor;
	this.Rows[index].Control.style.backgroundColor = "#d9d9d9";
}

function RowMouseOut(index)
{
	this.Rows[index].Control.style.backgroundColor = rowBackColor;
}

function OpenHTMLEditor(name) {
  w = 550;
  h = 500;
  l = (screen.availWidth-10 - w) / 2;
  t = (screen.availHeight-20 - h) / 2;

  features = "width="+w+",height="+h+",left="+l+",top="+t;
  features += ",screenX="+l+",screenY="+t;
  features += ",scrollbars=0,resizable=1,location=0";
  features += ",menubar=0,toolbar=0,status=0";

  window.open('/htmleditor.aspx', name, features);
}


function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function GetCharCount(e,obj,maxlimit)
{
	varTheText = e.value;
	var object = getObject(obj);
	
	if(varTheText.length > maxlimit)
		e.value = e.value.substring(0, maxlimit);
	else
		object.innerHTML = maxlimit - varTheText.length;
		//object.innerHTML = parseInt(varTheText.length);
}

function GetCharCount_OLD(e,obj)
{
	varTheText = e.value;
	var object = getObject(obj);
	object.innerHTML = parseInt(varTheText.length);
}


function setMaxLength()
{
	var x = document.getElementsByTagName('textarea');
	var counter = document.createElement('div');
	counter.className = 'counter';
	for (var i=0;i<x.length;i++)
	{
		if (x[i].getAttribute('maxlength'))
		{
			var counterClone = counter.cloneNode(true);
			counterClone.relatedElement = x[i];
			counterClone.innerHTML = '<span>0</span>/'+x[i].getAttribute('maxlength');
			x[i].parentNode.insertBefore(counterClone,x[i].nextSibling);
			x[i].relatedElement = counterClone.getElementsByTagName('span')[0];

			x[i].onkeyup = x[i].onchange = checkMaxLength;
			x[i].onkeyup();
		}
	}
}

function checkMaxLength()
{
	var maxLength = this.getAttribute('maxlength');
	var currentLength = this.value.length;
	if (currentLength > maxLength)
		this.relatedElement.className = 'toomuch';
	else
		this.relatedElement.className = '';
	this.relatedElement.firstChild.nodeValue = currentLength;
	// not innerHTML
}
function fnTrapKD(btn, ev){
	var keyCode = ev.which ? ev.which : ev.keyCode;
	if (keyCode == 13){
		ev.returnValue=false;
		ev.cancel = true;
		btn.click();
	}
}
function NavTo(folder,clientid) {
	value = document.getElementById(clientid).value;
	window.location = folder + '/participant/s.aspx?s=' + value;
}

function CheckAllINBOX() {
  for (var i = 0; i < document.PF.elements.length; i++) {
    if(document.PF.elements[i].type == 'checkbox'){
      document.PF.elements[i].checked = !(document.PF.elements[i].checked);
    }
  }
}

function NoConfirm()
{
win = top;
win.opener = top;
win.close();
}

function CloseWindow() {
window.open('','_parent','');
window.close();
}

function win_close() {
  if(navigator.appName=="Microsoft Internet Explorer")
  {
	this.focus();
	self.opener = this;
         self.close();
  }
  else
  {
	window.open('','_parent','');
	window.close();
  }
}
