


function RefreshCurrentPage()
{
	window.location = window.location;
}

function ClosePopupAndRefreshParent()
{
	window.opener.location = window.opener.location;
	//self.close();
	window.close();
}

function ClosePopup()
{
	window.close();
	//self.close();
}

function printpage() {
	window.print();
}

function GetDropDownListSelectedValue(controlId)
{
	for (i=0;i<document.getElementById(controlId).length;i++) {
		if (document.getElementById(controlId).options(i).selected == true) {
			return document.getElementById(controlId).options(i).text;
		}
	}
}

function SetDropDownListSelectedValue(controlId, ValueToSetTo)
{
	for (i=0;i<document.getElementById(controlId).length;i++) {
		if (ValueToSetTo == document.getElementById(controlId).options(i).text) {
			document.getElementById(controlId).options(i).selected = true;
		}
	}
}

function ResetDropDownList(controlId, IndexToResetTo)
{
	for (i=0;i<document.getElementById(controlId).length;i++) {
		if(totalRows == i) {
			document.getElementById(controlId).options(i).selected = true;
		}
	}
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
 
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
	}
	return IsNumber;
}


/*
nn=(document.layers)?true:false;
ie=(document.all)?true:false;
function submitOnEnter(e) {
	var evt=(e)?e:(window.event)?window.event:null;
	if(evt){
		var key=(evt.charCode)?evt.charCode:
			((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
		if(key=="13") document.forms[0].submit();
	}
}
document.onkeydown=keyDown;
if(nn) document.captureEvents(Event.KEYDOWN);*/

function submitOnEnter(submitBtn) {

	if (window.event.keyCode == 13)
	{
		var button = document.getElementById(submitBtn);
		if (button != null)
		{
			button.click();
		}
	}
}

function OpenPopupWindow(sUrl, w, h)
{
	var win = window.open('' + sUrl + '',null,'width=' + w + ',height=' + h + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=1');
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function OpenPopupWindowWithScrollbars(sUrl, w, h)
{
	var win = window.open('' + sUrl + '',null,'width=' + w + ',height=' + h + ',status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=1,resizable=1');
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function ShowHideFilterBox(divId)
{
	try {
		var obj = document.getElementById(divId);	
		var objTd = document.getElementById('myControl1_ucWindow_ucFilterBox_btnHideShowSearch_tdSearchTab');
		if(obj.style.display == 'none') {
			obj.style.display = 'block';
			try {objTd.className = "";}
			catch(e){}
			finally{}
		}
		else {
			obj.style.display = 'none';
			try {objTd.className = "FilteringShowHideAreaTdBottom";}
			catch(e){}
			finally{}
		}
		obj.focus();
	}
	catch(e){}
	return false;
}

function ClearHtmlTags()
{
	for(var i=0;i<document.forms[0].elements.length;i++) {
		if (document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "textarea") {
			if (document.forms[0].elements[i].value.indexOf("<") >= 0) {
				do {
					document.forms[0][i].value = document.forms[0].elements[i].value.replace("<","&lt;")
				}
				while (document.forms[0].elements[i].value.indexOf("<") >= 0);
			}
			if (document.forms[0].elements[i].value.indexOf(">") >= 0) {     
				do {
					document.forms[0][i].value = document.forms[0].elements[i].value.replace(">","&gt;")
				}
				while (document.forms[0].elements[i].value.indexOf(">") >= 0);
			}
		}
	}
}

function DecodeHtmlTags(controlToDecode)
{
	var ctrl = document.getElementById(controlToDecode);
	var str = ctrl.innerHTML;
	
	if (str.indexOf("&lt;") >= 0) {
		do {
			str = str.replace("&lt;", "<");
		}
		while (str.indexOf("&lt;") >= 0);
	}
	if (str.indexOf("&gt;") >= 0) {     
		do {
			str = str.replace("&gt;", ">")
		}
		while (str.indexOf("&gt;") >= 0);
	}
	ctrl.innerHTML = str;
}

function countCharacters(tbId)
{
	var tb = document.getElementById(tbId);
	//var formObject = tbId.charcount.value;
	return tb.value.length;	 
}

function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	{
		while(1) 
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.x)
	{
		curleft += obj.x;
	}
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	{
		while(1)
		{
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	}
	else if(obj.y)
		curtop += obj.y;
	
	//return obj.;
	return curtop;
}

function Dimension(element)
{
	this.x=-1;
	this.y=-1;
	this.w=0;
	this.h=0;
	if (element==document)
	{
		this.x=element.body.scrollLeft;
		this.y=element.body.scrollTop;
		this.w=element.body.clientWidth;
		this.h=element.body.clientHeight;
	}
	else if (element!=null)
	{
		var e=element;
		var left=e.offsetLeft;
		while ((e=e.offsetParent)!=null)
		{ 
			left+=e.offsetLeft; 
		}
		var e=element;
		var top=e.offsetTop;
		while((e=e.offsetParent)!=null)
		{ 
			top+=e.offsetTop; 
		}
		this.x=left;
		this.y=top;
		this.w=element.offsetWidth;
		this.h=element.offsetHeight;
	}
}
<!-- // 
	var urlAddress = "http://www.hypergurl.com/graphics.html"; 
	var pageName = "The Culture Trail"; 
	
	function addToFavorites() { 
		
		if (window.external) { 
			window.external.AddFavorite(urlAddress,pageName) 
		} else { 
			alert("Sorry! Your browser doesn't support this function."); 
		} 
		
	} 
// -->
