
/*AJAX CODE*/

/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
 xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
 try {
 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (e2) {
 xmlHttp = false;
 }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != "undefined")
{
 xmlHttp = new XMLHttpRequest();
}

function NewImage(arg)
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function ChangeImage()
{
	if (document.images && (preloadFlag == true))
	{
		for (var i=0; i<ChangeImage.arguments.length; i+=2)
		{
			document[ChangeImage.arguments[i]].src = ChangeImage.arguments[i+1];
		}
	}
}

function FlashManager(strFile, intWidth, intHeight, strBackgroundColour)
{
	var window_mode = 'transparent' //set this to transparent to make flash movie sit in the document order correctly

	document.write('<object\n');
	document.write('id="rokgsa1"\n');
	document.write('classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\n');
	document.write('codebase="'+location.protocol+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"\n');
	document.write('width="'+intWidth+'"\n');
	document.write('height="'+intHeight+'"\n');
	document.write('align="center">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="'+strFile+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+strBackgroundColour+'" />\n');
	document.write('<param name="wmode" value="'+window_mode+'" />\n');
	document.write('<embed\n');
	document.write('src="'+strFile+'"\n');
	document.write('quality="high"\n');
	document.write('bgcolor="'+strBackgroundColour+'"\n');
	document.write('width="'+intWidth+'"\n');
	document.write('height="'+intHeight+'"\n');
	document.write('name="rokgsa1"\n');
	document.write('align="left"\n');
	document.write('wmode="'+window_mode+'"\n');
	document.write('allowScriptAccess="sameDomain"\n');
	document.write('type="application/x-shockwave-flash"\n');
	document.write('pluginspage="'+location.protocol+'//www.macromedia.com/go/getflashplayer"\n');
	document.write('/>\n');
	document.write('</object>\n');
}

function ConfirmVerifyDelete(strInfo, strPleaseConfirmText, strOkToDelete)
{
	var strUsr = strPleaseConfirmText;
	strUsr += "\n\n";
	strUsr += strOkToDelete;
	strUsr += ": ";
	strUsr += "\n\n";
	strUsr += strInfo
	return confirm(strUsr);
}

// var objWidth = new Object();
// objWidth["stringValue"] = "mystring";

//
// Creates an editable row
// Implementation:
// Ensure the table is nested inside a form tag and
// ...each td tag has a width setting
// The edit field must have an id of 'updateurl'
// The delete field must have an id of 'deleteurl'
// arg 1: The name/id of the form
// arg 2: The name/id of the database id
// arg 3: The id value of this particularly row
// arg 4: csv list of fields needing text area
// arg 5: the number of rows needed for the text field
//
var blnEdit = false;
function EditRow(strIdFieldName, intIdValue, csvTextAreaList, intTextAreaRows, strRequiredQueryStringItem)
{
	if (blnEdit)
	{
		alert(_TXT1); // Another row already being edited
		return false;
	}
	else
	{
		blnEdit = true;
	}

	// Create array of the fields needing text areas, otherwise defauts to normal text field
	arrTextAreaList = csvTextAreaList.split(",");

	// Get the row
	var objRow = document.getElementById(intIdValue);
	var rowId = null;

	// Get cells from the row
	if (objRow)
	{
		var objCell = objRow.getElementsByTagName("td");
		var strOutput = "";

		for(var i = 0; i < objCell.length; i++)
		{
			var arrTmp = objCell[i].id.split("-");
			var strFieldName = arrTmp[0];

			// Sort out the columns
			if (strFieldName == null || strFieldName == "") continue;
			else if(strFieldName == strIdFieldName) // The hidden non-editable field with the row id
			{
				objCell[i].innerHTML = objCell[i].innerHTML+' <input type="hidden" name="'+strFieldName+'" value="'+objCell[i].innerHTML+'" />';
			}
			else if(strFieldName == "deleteurl") // The delete cell, converted to a cancel button
			{
				objCell[i].innerHTML = '<a href="'+location.pathname+'?'+strRequiredQueryStringItem+'">'+_TXT2+'</a>'; // Cancel
			}
			else if(strFieldName == "updateurl") // The edit cell, converted to save button
			{
				objCell[i].innerHTML = '<input type="submit" value="'+_TXT3+'" style="width:'+(objCell[i].width-6)+'px;margin:0;cursor:pointer" />'; // Save
			}
			else if (InArray(strFieldName, arrTextAreaList)) // an editable field. uses text area
			{
				if (intTextAreaRows == undefined) intTextAreaRows = 3;
				objCell[i].innerHTML = '<textarea name="'+strFieldName+'" rows="'+intTextAreaRows+'" style="width:'+(objCell[i].width-8)+'px;">'+objCell[i].innerHTML+'</textarea>';
			}
			else // an editable field
			{
				var arrCellInputs = objCell[i].getElementsByTagName("input");

				//alert(arrCellInputs[0].name);

				var objCellChild = objCell[i].getElementsByTagName("Select");
				if (objCellChild.length > 0) objCellChild[0].disabled = false; // Only concerned with first element
				else objCell[i].innerHTML = '<input type="text" name="'+strFieldName+'" value="'+objCell[i].innerHTML+'" style="width:'+(objCell[i].width-8)+'px;" />';
			}
		}

		// For debugging
		// alert(strOutput);
	}
	return false;
}

// Typical usage
// var messages = new makeArray(COMMA SEPARATED LIST AS ARGUMENTS HERE);
function CsvToArray()
{
	arrTmp = new Array();
	for (var i = 0; i < CsvToArray.arguments.length; i++)
		arrTmp[i] = CsvToArray.arguments[i];
	return arrTmp;
}

function InArray(strSource, arrTarget)
{
	if (strSource == "") return false;
	else if (arrTarget.length == 0) return false;

	for (var i = 0; i < arrTarget.length; i++)
	{
		if (arrTarget[i] == undefined) continue;
	  	else if (arrTarget[i] == strSource) return true;
	}
	return false;
}

function DropDownGoTo(strName, selObj)
{
	var strDestination = location.pathname + "?"+strName+"="+selObj.options[selObj.selectedIndex].value;
	location.href = strDestination.substr(1); // Remove forward slash
}

function OpenWin(theURL,winName, wWidth, wHeight, withScrollbars, withResizeable, horzPos, vertPos, boolSetCookie)
{
	winHandle = '';
	vAdjustment = -50;
	if (horzPos == "" && vertPos == "")
	{
		if (screen)
		{
			horzPos = Math.ceil((screen.width - wWidth)/2);
			vertPos = Math.ceil((screen.height - wHeight)/2) + vAdjustment;
		}
		else
		{
			horzPos = 0;
			vertPos = 0;
		}
	}
	winChild = window.open(theURL, winName,'toolbar=no,location=no,scrollbars='+withScrollbars+',resizable='+withResizeable+',width='+wWidth+',height='+wHeight+', left='+horzPos+', top='+vertPos+'');
	setTimeout("winChild.focus()", 500);
	if (boolSetCookie) SetCookie("childWinUrl", theURL, 24);
}

function ShowHideObj(linkObj, objId, strShowText, strHideText)
{
	var objItem = document.getElementById(objId);

	if (objItem.style.display == "none")
	{
		objItem.style.display = "block";
		linkObj.innerHTML = strHideText;
	}
	else
	{
		objItem.style.display = "none";
		linkObj.innerHTML = strShowText;
	}

	return false;
}

function GoTo(strLocation)
{
	location.href = strLocation;
	return false;
}

function ManageCss(strObName, strNewClassName)
{
	var objMenu = document.getElementById(strObName);
	if(objMenu != null)
	{
		var strCurrUri = window.location.pathname.toLowerCase().replace("/", "");

		// Check for parent menu to override
		if (parentUrl != "")
		{
			if (parentUrl != strCurrUri) strCurrUri = parentUrl;
		}

		var arrA = objMenu.getElementsByTagName("a");
		var strAnchorHref = null;
		for(var i=0; i< arrA.length;i++)
		{
			strAnchorHref = arrA[i].href.toLowerCase().replace("//", "").replace("/", "").replace(window.location.hostname, "").replace(window.location.protocol, "");
			// alert(strAnchorHref +" : " + strCurrUri);
			if (strAnchorHref == strCurrUri)
			{
				arrA[i].className = strNewClassName;
			}
		}
	}
}

function InArray(strValue, arrArray)
{
	for(i = 0; i < arrArray.length; i++)
	{
		if (strValue == arrArray[i]) return true;
	}
	return false;
}

function AddSlashes(str)
{
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function StripSlashes(str)
{
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

//
// Typical Usage
//
/*
var page = new PageQuery(location.search);
var myValue = page.getValue("a");
if (myValue == "-1") myValue = "history.html";
*/
function PageQuery(q)
{
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q)
	{
		for(var i=0; i < this.q.split("&").length; i++)
		{
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++)
		{
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return -1;
	}
	this.getParameters = function()
	{
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++)
		{
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
     this.getLength = function() { return this.keyValuePairs.length; }
}

function CheckLeapYear(datea)
{
	datea = parseInt(datea);

	if(datea%4 == 0)
	{
		if(datea%100 != 0)
		{
			return true;
		}
		else
		{
			if(datea%400 == 0)
				return true;
			else
				return false;
		}
	}
	return false;
}

function CheckUserMsg()
{
	setTimeout('CloseUserMsg()', 3000);
	return false;
}


function CloseUserMsg()
{
	var objUserMsg = document.getElementById("userMsg");
	if (objUserMsg != null)
	{
		if (objUserMsg.innerHTML != "")
		{
			objUserMsg.innerHTML = "";
			objUserMsg.style["display"] = "none";
		}
	}
	return false;
}


Date.prototype.getMonthName = function() {
var m = ['January','February','March','April','May','June','July',
'August','September','October','November','December'];
return m[this.getMonth()];
}
Date.prototype.getDayName = function() {
var d = ['Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday'];
return d[this.getDay()];
}


function NonAcceptableChars(strString)
//  check for unacceptable characters
{
	// strValidChars copntains list of unacceptable characters
	var strValidChars = " ";
	var strChar;
	var blnResult = true;

	//  test strString consists of unacceptable characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
  {
	  strChar = strString.charAt(i);
	  if (strValidChars.indexOf(strChar) == 0)
	 	{
	 		blnResult = false;
	 	}
  }
	return blnResult;
}

function IsNumeric(strString)
//  check for valid numeric strings
{
	var strValidChars = "0123456789 ";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
  {
	  strChar = strString.charAt(i);
	  if (strValidChars.indexOf(strChar) == -1)
	 	{
	 		blnResult = false;
	 	}
  }
	return blnResult;
}


/*SWITH HTML CONTENT*/

function switchContent(target, source)
{
  	document.getElementById(target).innerHTML = null;
	document.getElementById(target).innerHTML = document.getElementById(source).innerHTML;
  	return false;
}

/*SWITH COLOURED NUMBERS IN HEADER BUTTON DIVS*/

function switchClass(Obj, NewClass)
{
  	document.getElementById(Obj).className = className;
  	return false;
}


/*SWITCH IMAGES*/

var aryImages = new Array();

aryImages[1] = "/local/football/rokgsa/common/images/mobiles1.jpg";
aryImages[2] = "/local/football/rokgsa/common/images/mobiles2.jpg";
aryImages[3] = "/local/football/rokgsa/common/images/mobiles3.jpg";
aryImages[4] = "/local/football/rokgsa/common/images/trials_logo.jpg";
aryImages[5] = "/local/football/rokgsa/common/images/flowchart.jpg";

for (i=0; i < aryImages.length; i++)
{
	var preload = new Image();
	preload.src = aryImages[i];
}

function swap(imgIndex, imgTarget)
{
	document[imgTarget].src = aryImages[imgIndex];
}

//
// arg1: a unique id
// arg2: URL to display
// arg3: popup width
// arg4: popup height
// arg5: topbar win title
//
function ShowPopup(strWinId, strUrl, intIfrWidth, intIfrHeight, strTopBarTitle, intLeftPos, intTopPos)
{
	// http://www.codeproject.com/KB/aspnet/JsOOP1.aspx
	var objPopup = new ClassPopup();

	// Basic properties
	var objPopupProperties = new Object;
	if (intLeftPos) objPopupProperties["intLeftPos"] = intLeftPos;
	if (intTopPos) objPopupProperties["intTopPos"] = intTopPos;
	objPopupProperties["strWinId"] = strWinId;
	objPopupProperties["strUrl"] = strUrl;
	objPopupProperties["intIfrWidth"] = intIfrWidth;
	objPopupProperties["intIfrHeight"] = intIfrHeight;
	objPopupProperties["strTopBarTitle"] = strTopBarTitle;
	objPopupProperties["intMasterDivOpacity"] = 75; // Overall percentage opacity of greyed out background
	objPopupProperties["hexMasterDivBgColour"] = "#444";
	objPopupProperties["strTopBarinnerHTML"] = '<img src="/local/football/rokgsa/en/training/images/winTopClose.gif" style="float:right;" alt="Close" /><div style="float:right;margin:5px 3px 0 0;cursor:pointer;color:#666;text-decoration: none;">CLOSE</div>';
	objPopupProperties["hexTopBarAnchorColor"] = "#fff";
	objPopup.SetProperties(objPopupProperties);

	// These are standard css styles
	// Names are appropriate for javascript
	var objTopBarStyle = new Object;
	objTopBarStyle["height"] = 26;
	objTopBarStyle["background"] = "#888 url('/local/football/rokgsa/en/training/images/winTopBg.jpg') repeat-x";
	objTopBarStyle["padding"] = "4px 0 0 7px";
	objTopBarStyle["margin"] = "0";
	objTopBarStyle["color"] = "#666";
	objTopBarStyle["fontWeight"] = "bold";
	objTopBarStyle["fontSize"] = "13px";
	objPopup.SetTopBarCss(objTopBarStyle);

	objPopup.BuildWindow();
	return false;
}

function ClassPopup()
{
	//
	// PRIVATE PROPERTIES only available from within the class
	// ...must have var prefix
	//
	var intCounter = 0;
	var _zIndex = 100;
	var objCentreDiv = null;
	var _hshTopBarCss = new Object;
	var _hshProperties = new Object;

	// Public setter arg needs to be a hash
	this["SetProperties"] = _SetProperties;
	this["SetTopBarCss"] = _SetTopBarCss;
	this["BuildWindow"] = _BuildWindow;
	this["_CreateElement"]  = _CreateElement;
	this["_GetWindowHeight"] = _GetWindowHeight;
	this["_GetWindowWidth"] = _GetWindowWidth;
	// this["_Tween"] = _Tween;

	// Constants
	this["intWinWidth"] = GetWindowWidth();
	this["intWinHeight"] = GetWindowHeight();

	function _BuildWindow()
	{
		// System check
		/*
		for (key in _hshProperties)
		{
			alert(_hshProperties[key]);
		}
		*/
		var strContainerDivId = _hshProperties["strWinId"]+"_contDiv";
		var strCentreDivId = _hshProperties["strWinId"]+"_centDiv";
		var strControlDivId = _hshProperties["strWinId"]+"_ctrDiv";
		var strContainerIfrId = _hshProperties["strWinId"]+"_contIfr";

		// These are used mainly for closing the window
		var objMasterDiv = document.getElementById(strContainerDivId); // test whether it has already been created
		var objCenterDiv = document.getElementById(strCentreDivId); // test whether it has already been created

		// Doesn't already exist
		if (objMasterDiv == null)
		{
			// Adjust document.body to remove the scroll bar
			if (navigator.userAgent.indexOf("Safari") == -1)
			{
				document["body"]["style"]["overflow"] = "hidden";
			}

			// Create master div container
			var objMasterDiv = this._CreateElement
			(
				"div",
				strContainerDivId,
				0,
				0,
				this["intWinWidth"],
				this["intWinHeight"],
				_hshProperties["hexMasterDivBgColour"],
				this["_zIndex"]++,
				_hshProperties["intMasterDivOpacity"]
			);
			document.body.appendChild(objMasterDiv);

			// Create central div
			// All other objects are created inside this div
			var intVerticalAdjustment = 30;

			if (_hshProperties["intLeftPos"]) var intLeftPos = parseInt(_hshProperties["intLeftPos"])+"px";
			else var intLeftPos = parseInt((this["intWinWidth"]/2) - (_hshProperties["intIfrWidth"]/2))+"px";

			if (_hshProperties["intTopPos"]) var intTopPos = parseInt(_hshProperties["intTopPos"])+"px";
			else var intTopPos = parseInt((this["intWinHeight"]/2) - (_hshProperties["intIfrHeight"]/2)
						- (_hshTopBarCss["height"]*2)+_hshTopBarCss["height"]+intVerticalAdjustment)+"px";

			objCentreDiv = this._CreateElement
			(
				"div",
				strCentreDivId,
				intLeftPos,
				intTopPos,
				10, // _hshProperties["intIfrWidth"],
				10, // _hshProperties["intIfrHeight"],
				"#333", // _hshProperties["hexMasterDivBgColour"],
				this["_zIndex"]++,
				100
			);
			objCentreDiv["style"]["overflow"] = "hidden";
			document.body.appendChild(objCentreDiv);

			// Create top control area
			var objCtrDiv = this._CreateElement
			(
				"div",
				strControlDivId,
				0,
				0,
				_hshProperties["intIfrWidth"],
				_hshTopBarCss["height"],
				_hshTopBarCss["background"],
				this["_zIndex"]++,
				100
			);
			objCentreDiv.appendChild(objCtrDiv);

			// Create close link
			var objLink = document.createElement("a");
			objLink.setAttribute("href", "javascript:void(0);");
			var strWinId = _hshProperties["strWinId"];
			if (navigator.userAgent.indexOf("MSIE") != -1) objLink.onclick = function() {ShowPopup(strWinId)};
			else objLink.setAttribute("onclick", "return ShowPopup('"+strWinId+"');"); // For other browsers
			objLink["innerHTML"] = _hshProperties["strTopBarinnerHTML"];
			objLink["style"]["color"] = _hshProperties["hexTopBarAnchorColor"];
			objCtrDiv.appendChild(objLink);

			// Create box title
			if (_hshProperties["strTopBarTitle"] != undefined)
			{
				var objDiv = document.createElement("div");
				// objDiv["style"]["width"] = parseInt(_hshProperties["intIfrWidth"]/2)+"px";
				objDiv["style"]["height"] = _hshTopBarCss["height"]+"px";
				objDiv["style"]["textAlign"] = "left";
				objDiv["style"]["margin"] = _hshTopBarCss["margin"];
				objDiv["style"]["padding"] = _hshTopBarCss["padding"];
				objDiv["style"]["color"] = _hshTopBarCss["color"];
				objDiv["style"]["fontWeight"] = _hshTopBarCss["fontWeight"];
				objDiv["style"]["fontSize"] = _hshTopBarCss["fontSize"];

				objDiv["innerHTML"] = _hshProperties["strTopBarTitle"];
				objCtrDiv.appendChild(objDiv);
			}

			var objNewIfr = this._CreateElement
			(
				"iframe",
				strContainerIfrId,
				0,
				_hshTopBarCss["height"],
				_hshProperties["intIfrWidth"],
				_hshProperties["intIfrHeight"],
				"#fff",
				this["_zIndex"]++,
				100
			);
			objNewIfr.setAttribute("name", strContainerIfrId);
			objNewIfr.setAttribute("src", _hshProperties["strUrl"]);
			objNewIfr.setAttribute("scrolling", "auto");
			objNewIfr.setAttribute("frameborder", "0");
			objCentreDiv.appendChild(objNewIfr);

			_Tween();

			return false;
		}

		else // Switch display
		{
			// Reset body area scrollbar
			document["body"]["style"]["overflow"] = "auto";

			// Close and remove
			document.body.removeChild(objCenterDiv);
			document.body.removeChild(objMasterDiv);

			return false;
		}
	}

	function _Tween()
	{
		if (objCentreDiv["offsetWidth"] < _hshProperties["intIfrWidth"])
		{
			// To avoid making width too great
			var intCurrWidth = 0;
			if ((objCentreDiv["offsetWidth"]+50) > _hshProperties["intIfrWidth"]) intCurrWidth = _hshProperties["intIfrWidth"];
			else intCurrWidth = parseInt(objCentreDiv["offsetWidth"]+50)

			// Make the width change
			objCentreDiv["style"]["width"] = intCurrWidth+"px";

			setTimeout(_Tween, 10);
		}

		else if (objCentreDiv["offsetHeight"] < parseInt(_hshTopBarCss["height"]+_hshProperties["intIfrHeight"]))
		{
			var intChange = 20;
			var intCurrHeight = 0;

			// Ease out tween
			var intCurrDiff = _hshProperties["intIfrHeight"] - (objCentreDiv["offsetHeight"]+intChange);
			if (intCurrDiff < 100 && intCounter < intChange)
			{
				intChange = intChange - intCounter;
				intCounter++;
			}

			// To avoid making height too great
			if ((objCentreDiv["offsetHeight"]+intChange) > _hshProperties["intIfrHeight"]) intCurrHeight = _hshProperties["intIfrHeight"];
			else intCurrHeight = parseInt(objCentreDiv["offsetHeight"]+intChange)

			// Make the height change
			objCentreDiv["style"]["height"] = intCurrHeight+"px";
			setTimeout(_Tween, 10);
		}

		else // Fall through - a final correction
		{
			objCentreDiv["style"]["height"] = parseInt(_hshTopBarCss["height"]+_hshProperties["intIfrHeight"])+"px";
			objCentreDiv["style"]["width"] = _hshProperties["intIfrWidth"]+"px";
			intCounter = 0;
		}
	}

	function _SetProperties(hshProperties)
	{
		_hshProperties = hshProperties;
	}

	function _SetTopBarCss(hshTopBarCss)
	{
		_hshTopBarCss = hshTopBarCss;
	}

	function _CreateElement(strElementType, strId, intLeft, intTop, intWidth, intHeight, strBackground, intZindex, intBackgroundOpacity)
	{
		var objPointer = document.createElement(strElementType);
		objPointer.setAttribute("id", strId);

		// Set these for all
		// Both following lines may be reset if necessary using the returned object
		objPointer["style"]["position"] = "absolute";
		objPointer["style"]["display"] = "block";

		// Style elements
		if (intLeft > 0) objPointer["style"]["left"] = intLeft+"px";
		else objPointer["style"]["left"] = intLeft;

		if (intTop > 0) objPointer["style"]["top"] = intTop+"px";
		else objPointer["style"]["top"] = intTop;

		objPointer["style"]["width"] = intWidth+"px";
		objPointer["style"]["height"] = intHeight+"px";
		objPointer["style"]["background"] = strBackground;
		objPointer["style"]["zIndex"] = intZindex;

		if (intBackgroundOpacity != 100)
		{
			objPointer["style"]["filter"] = "alpha(opacity="+intBackgroundOpacity+") Shadow(Color=#00FF00, Direction=225)";
			objPointer["style"]["-moz-opacity"] = "."+intBackgroundOpacity;
			objPointer["style"]["opacity"] = "."+intBackgroundOpacity;
			objPointer["style"]["-khtml-opacity"] = "0."+intBackgroundOpacity;
		}
		return objPointer;
	}

	function _GetWindowHeight()
	{
		var intHeight = 0;
		if( typeof( window.innerWidth) == "number")
		{
			intHeight= window.innerHeight;
		}

		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
			intHeight= document.documentElement.clientHeight;
		}

		else if(document.body && (document.body.clientWidth || document.body.clientHeight))
		{
			intHeight= document.body.clientHeight;
		}
		return intHeight;
	}

	function _GetWindowWidth()
	{
		var intWidth = 0;
		if( typeof( window.innerWidth) == "number")
		{
			intWidth= window.innerWidth;
		}

		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
			intWidth= document.documentElement.clientWidth;
		}

		else if(document.body && (document.body.clientWidth || document.body.clientHeight))
		{
			intWidth= document.body.clientWidth;
		}
		return intWidth;
	}

	return false;
}

//
// Get the height of the working window for any browser
// Generic
//
function GetWindowHeight()
{
	var intHeight = 0;
	if( typeof( window.innerWidth) == "number")
	{
		intHeight= window.innerHeight;
	}

	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		intHeight= document.documentElement.clientHeight;
	}

	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		intHeight= document.body.clientHeight;
	}
	return intHeight;

}

function GetWindowWidth()
{
	var intWidth = 0;
	if( typeof( window.innerWidth) == "number")
	{
		intWidth= window.innerWidth;
	}

	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		intWidth= document.documentElement.clientWidth;
	}

	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		intWidth= document.body.clientWidth;
	}
	return intWidth;

}

function CreateElement(strElementType, strId, intLeft, intTop, intWidth, intHeight, strBackground, intZindex, intBackgroundOpacity)
{
	var objPointer = document.createElement(strElementType);
	objPointer.setAttribute("id", strId);

	// Set these for all
	// Both following lines may be reset if necessary using the returned object
	objPointer["style"]["position"] = "absolute";
	objPointer["style"]["display"] = "block";

	// Style elements
	if (intLeft > 0) objPointer["style"]["left"] = intLeft+"px";
	else objPointer["style"]["left"] = intLeft;

	if (intTop > 0) objPointer["style"]["top"] = intTop+"px";
	else objPointer["style"]["top"] = intTop;

	objPointer["style"]["width"] = intWidth+"px";
	objPointer["style"]["height"] = intHeight+"px";
	objPointer["style"]["background"] = strBackground;
	objPointer["style"]["zIndex"] = intZindex;

	if (intBackgroundOpacity != 100)
	{
		objPointer["style"]["filter"] = "alpha(opacity="+intBackgroundOpacity+") Shadow(Color=#00FF00, Direction=225)";
		objPointer["style"]["-moz-opacity"] = "."+intBackgroundOpacity;
		objPointer["style"]["opacity"] = "."+intBackgroundOpacity;
		objPointer["style"]["-khtml-opacity"] = "0."+intBackgroundOpacity;
	}
	return objPointer;

}



