
<!--
var keys;
var timeStamp;
timeStamp = new Date();


function ReturnTo(destinationUrl)
{
    window.location = destinationUrl;
}
function DropDownList_onkeypress(control) {
	var key = event.keyCode;
	event.returnValue=false;
	//a-z, A-Z, 0-9	
	if ((key>=97 && key<=122) || (key>=65 && key<=90) || (key>=48 && key<=57))
	{
		key = String.fromCharCode(key).toUpperCase();		
		var now = new Date();
		var diff = (now.getTime() - timeStamp.getTime());
		timeStamp = new Date();
		//2 seconds = 2000 milliseconds
		if (diff > 2000)
		{
			keys = key;
		}
		else
		{
			keys = keys + key;
		}
		var cnt;
		for (cnt=0;cnt<document.all(control).children.length;cnt++)
		{
			var itm = document.all(control).children[cnt].text;			
			if (itm.substring(0,keys.length).toUpperCase()==keys)
			{
				document.all(control).selectedIndex = cnt;
				break;
			}
		}
	}
}

function Delete_onclick(control) 
{ 
	if ((document.all(control).value == "") || (document.all(control).value == "0")) {
	  alert ("Please choose an appropriate record to delete!");
	  return false;
	}  
	if (confirm("Are you sure that you want to delete this record?")==true) 
		return true; 
	else 
		return false; 
}

function btnDelete_onclick(control) 
{ 
	if ((document.all(control).value == "") || (document.all(control).value == "0")) {
	  alert ("Please choose an appropriate record to delete!");
	  return false;
	}  
	if (confirm("Note: This action will DELETE all data associated with this Entry!")==true) 
		return true; 
	else 
		return false; 
}

function openWindow(destinationURL) {
  var childWin;
  var attr;
  attr = "toolbar = no, width =" + (screen.availwidth - 150) + ", height=" + (screen.availheight - 150) + 
  	", alwaysRaised, status = no, scrollbars =yes, screenX=100, screenY=100, left=10,top=100,resizable=yes";
  childWin = window.open (destinationURL, "NewWin", attr);
  childWin.focus();
} 

function doAttach(control)
{
	var file = document.all(control).value;
	Array = new Array("gif", "jpg", "peg");
	submit = false;
	if (!file) return true;
	var ext = file.slice(file.length-3,file.length);
	for (var i = 0; i < Array.length; i++)
	{
	if (Array[i] == ext)
	{
	submit = true; break; 
	}
	}
	if (submit) return true;
	else
	alert("You can only upload files of type : " 
	+ "(" + Array.join(" ") + ")");
	return true;
}


// News Flash Script-->

// API
// These are the functions you will call to use the NewsScroller from your web page

// NewsScroller_Initialize
//	Parameters:
//		elmDivForNews: object reference to a DIV element that will be used to display the news
//	Return:
//		returns a NewsScroller object, with supporting properties and methods
function NewsScroller ()
{
	if (window.NewsScrollerInstance != null)
		{
		window.alert("Only one NewsScroller control is allowed on a page.");
		return;
		}
	window.NewsScrollerInstance = this;
	
	this.LoadXML = NewsScroller_LoadXML;
	this.AddNewsItem = NewsScroller_AddNewsItem;
	this.Clear = NewsScroller_Clear;
	this.StartScrolling = NewsScroller_StartScrolling;
	this.StopScrolling = NewsScroller_StopScrolling;
	this.Render = NewsScroller_Render;
	
	// public properties
	this.className = "";
	this.itemNormalClassName = "";

	this.scrollRate = 25;
	this.scrollStep = 1;
	this.scrollPause = 2000;
	
	// internal use
	this.RenderChildren = NewsScroller_RenderChildren;

	this.renderedControl = "";
	this.itemsText = new Array();
	this.itemsLink = new Array();
	this.itemCount = 0;
	
	this.scrollEnabled = false;
}

function NewsScroller_LoadXML (sXmlID)
{
	this.Clear();
	var elmXml = document.getElementById(sXmlID);
	var xDoc = elmXml.XMLDocument;
	var xItems = xDoc.selectNodes("/Items/Item");
	for (var iNode = 0; iNode < xItems.length; iNode++)
		{
		var xItem = xItems[iNode];
		var xText = xItem.selectSingleNode("Text");
		var xLink = xItem.selectSingleNode("Link");
		this.AddNewsItem(xText.text, xLink.text);
		}
	var elmControl = document.getElementById(this.renderedControl);
	this.RenderChildren(this.renderedControl);
}

function NewsScroller_AddNewsItem (strText, strLink)
{
	this.itemsText[this.itemCount] = strText;
	this.itemsLink[this.itemCount] = strLink;
	this.itemCount++;
}

function NewsScroller_Clear ()
{
	this.StopScrolling ();
	var elmControl = document.getElementById(this.renderedControl);
	while (elmControl.childNodes.length > 0)
		elmControl.removeChild(elmControl.childNodes[0]);
	this.itemsText = new Array();
	this.itemsLink = new Array();
	this.itemCount = 0;
}

function NewsScroller_StartScrolling ()
{
	if (this.itemCount > 0)
		{
		var sControlName = this.renderedControl;
		if (sControlName == null)
			{
			window.alert ("You must render a control before you can start scrolling it.");
			return;
			}
		var elmControl = document.getElementById(sControlName);
		var elmItem0 = document.getElementById("floatingNews0");
		if (this.itemCount > 1)
			{
			var elmItem1 = document.getElementById(sControlName + "1");
			this.cySeparator = (elmItem1.offsetTop - elmItem0.offsetTop) - elmItem0.offsetHeight;
			}
		else
			{
			this.cySeparator = 0;
			}
		
		if (this.ScrollTimerID == null)
			this.ScrollTimerID = window.setInterval(NewsScroller_ScrollNews, this.scrollRate);
		}
}

function NewsScroller_StopScrolling ()
{
	window.clearInterval(this.ScrollTimerID);
	this.ScrollTimerID = null;
}

function NewsScroller_Render(sControlID)
{
	if (sControlID.length == 0)
		{
		window.alert("You must provide a unique ID for the rendered control.");
		return;
		}
	var elmControl = document.getElementById(sControlID);
	if (elmControl != null)
		{
		window.alert("A NewsScroller with this ID has already been rendered. Please use a unique ID.");
		return;
		}
	this.renderedControl = sControlID;
	
	// <DIV>
	document.write("<div");
	document.write(" id=\"" + sControlID + "\"");
	document.write(" class=\"" + this.className + "\"");
	document.write(" style=\"position: relative; width: 100%; height: 100%; \"");
	document.write(">");
	
	// </DIV>
	document.write("</div>");

	this.RenderChildren(sControlID);
 
	var dtNow = new Date();
	var dtResume = new Date(dtNow.getFullYear(), dtNow.getMonth(), dtNow.getDate(), dtNow.getHours(), dtNow.getMinutes(), dtNow.getSeconds(), this.scrollPause);
	elmControl = document.getElementById(sControlID);
	elmControl.ResumeDateTime = dtResume;
}

// Supporting functions
function NewsScroller_RenderChildren()
{
	var sControlID = this.renderedControl;
	elmControl = document.getElementById(sControlID);
	
	// <DIV>
	elmDiv = document.createElement("div");
	elmDiv.style.position = "absolute";
	elmDiv.style.left = "0px";
	elmDiv.style.width = "100%";
	elmDiv.style.height = "100%";
	elmDiv.style.overflow = "hidden";
	elmControl.appendChild(elmDiv);
	
	for (var nItem = 0; nItem < this.itemCount; nItem++)
		{
		var sItemName = sControlID + nItem.toString();
		
		var elmP = document.createElement("p");
		elmP.id = sItemName;
		elmP.style.position = "relative";
		elmP.style.top = "0px";
		elmP.style.width = "100%";
		elmP.className = this.itemNormalClassName;
		elmDiv.appendChild(elmP);
		
		var elmA = document.createElement("a");
		elmA.className = this.itemNormalClassName;
		elmA.href = this.itemsLink[nItem];
		elmP.appendChild(elmA);
		
		var tn = document.createTextNode(this.itemsText[nItem]);
		elmA.appendChild(tn);
		
		}
}

function NewsScroller_ScrollNews()
{
	var ns = window.NewsScrollerInstance;
	var sControlName = ns.renderedControl;
	if (sControlName.length == 0)
		{
		window.alert ("Do not call ScrollNews directly. Use the Start method of the NewsScroller object.");
		return;
		}
	var elmControl = document.getElementById(sControlName);
	if (new Date() >= elmControl.ResumeDateTime)
		{
		// see whether any item is about to reach the top,
		var cyOffset = 0;
		for (var nItem = 0; nItem < ns.itemCount; nItem++)
			{
			var sItemName = sControlName + nItem.toString();
			var elmItem = document.getElementById(sItemName);
			if ((elmItem.offsetTop > 0) && ((elmItem.offsetTop - ns.scrollStep) <= 0))
				{
				// the top of this item has reached the top of the control,
				// so pause scrolling for the whole control
				var dtNow = new Date();
				var dtResume = new Date(dtNow.getFullYear(), dtNow.getMonth(), dtNow.getDate(), dtNow.getHours(), dtNow.getMinutes(), dtNow.getSeconds(), ns.scrollPause);
				elmControl.ResumeDateTime = dtResume;
				cyOffset = elmItem.offsetTop;
				}
			}
		if (cyOffset > 0)
			{
			// control is just now paused, so scroll all items up 
			// in order to put the top item flush with the top of the control
			for (var nItem = 0; nItem < ns.itemCount; nItem++)
				{
				var sItemName = sControlName + nItem.toString();
				var elmItem = document.getElementById(sItemName);
				elmItem.style.pixelTop = elmItem.style.pixelTop - cyOffset; 
				}
			}
		else
			{
			// the control is not paused, so scroll every item up by one step
			for (var nItem = 0; nItem < ns.itemCount; nItem++)
				{
				var sItemName = sControlName + nItem.toString();
				var elmItem = document.getElementById(sItemName);
				elmItem.style.pixelTop -= ns.scrollStep;
				
				
				}
			}
		// see whether any items have scrolled off the top
		for (var nItem = 0; nItem < ns.itemCount; nItem++)
			{
			var sItemName = sControlName + nItem.toString();
			var elmItem = document.getElementById(sItemName);
			if ((elmItem.offsetTop + elmItem.offsetHeight) <= 0)
				{
				// the bottom of this item has scrolled beyond the top of the control,
				// so move it to the bottom of the control
				if (ns.itemCount > 1)
					{
					var sBottomItemName;
					if (nItem == 0)
						sBottomItemName = sControlName + (ns.itemCount - 1).toString();
					else
						sBottomItemName = sControlName + (nItem - 1).toString();
					var elmBottomItem = document.getElementById(sBottomItemName);
					elmItem.style.pixelTop = (elmBottomItem.offsetTop + elmBottomItem.offsetHeight + ns.cySeparator) - (elmItem.offsetTop - elmItem.style.pixelTop);
					}
				else
					{
					elmItem.style.pixelTop = elmItem.parentElement.offsetHeight;
					}
				}
			}
		}
}



/*
WM_setCookie(), WM_readCookie(), WM_killCookie()
A set of functions that eases the pain of using cookies.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com
*/


// This next little bit of code tests whether the user accepts cookies.
function WM_browserAcceptsCookies() {
	var WM_acceptsCookies = false;
	if ( document.cookie == '' ) {
		document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.
		if ( document.cookie.indexOf( 'WM_acceptsCookies=yes' ) != -1 ) {
			WM_acceptsCookies = true;
		} // If it succeeds, set variable
	} else { // there was already a cookie
		WM_acceptsCookies = true;
	}
	
	return ( WM_acceptsCookies );
}

function WM_setCookie (name, value, hours, path, domain, secure) {
    if (WM_acceptsCookies) { // Don't waste your time if the browser doesn't accept cookies.
	var not_NN2 = (navigator && navigator.appName 
		       && (navigator.appName == 'Netscape') 
		       && navigator.appVersion 
		       && (parseInt(navigator.appVersion) == 2))?false:true;

	if(hours && not_NN2) { // NN2 cannot handle Dates, so skip this part
	    if ( (typeof(hours) == 'string') && Date.parse(hours) ) { // already a Date string
		var numHours = hours;
	    } else if (typeof(hours) == 'number') { // calculate Date from number of hours
		var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
	    }
	}
	document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); // Set the cookie, adding any parameters that were specified.
    }
} // WM_setCookie


function WM_readCookie(name) {
    if(document.cookie == '') { // there's no cookie, so go no further
	return false; 
    } else { // there is a cookie
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	firstChar = theBigCookie.indexOf(name);	// find the start of 'name'
	var NN2Hack = firstChar + name.length;
	if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
	    firstChar += name.length + 1; // skip 'name' and '='
	    lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else { // If there was no cookie of that name, return false.
	    return false;
	}
    }	
} // WM_readCookie

function WM_killCookie(name, path, domain) {
  var theValue = WM_readCookie(name); // We need the value to kill the cookie
  if(theValue) {
      document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
  }
} // WM_killCookie

function areCookiesEnabled(controlid)
{
  if(WM_browserAcceptsCookies()==false)
  {
    document.getElementById(controlid).innerHTML = "Your browser's cookie functionality is not enabled. Please enable it. See our FAQ page for help.";
    
  }
  
}




