﻿//function $(the_id) {
//	var obj = document.getElementById(the_id);
//	if ( obj == null)
//	  obj = document.getElementById(ID(the_id));
//	
//	return obj;
//}

function ID( idtag ){
    return 'ctl00_MC1_' + idtag;
}
function isArray(obj) {
   return (obj.constructor.toString().indexOf("Array") == -1 ? false : true);
}


 // Function takes an button sets to either disabled or enabled, with given text
 function buttonSetBusy( button, isBusy, buttonText ){
        button.value = buttonText;
        button.disabled = isBusy;
 }

function DLog( message )
{
  var y;
  var x;
  var logT = $('logTable');

  if ( logT ){
      x= logT.insertRow(0);
      y= x.insertCell(0);
      y.innerHTML = message;
  }
}

function toggle(obj, On) {
  if ( On == true ){
    obj.style.display = '';
  }else if ( On == false ){
    obj.style.display = 'none';
  }else{
	    if ( obj.style.display != 'none' ) {
		    obj.style.display = 'none';
	    }
	    else {
		    obj.style.display = '';
	    }
	}
}

function toggleByID(aID, On) {
    if ( $(aID) != null )
        toggle($(aID), On);
    else if ( $(ID(aID)) != null )
        toggle($(ID(aID)), On);
}
function getWindowSize()
{
	var height = 0;
	if(self.innerHeight) {
			height = self.innerHeight;
	}else if(document.documentElement && document.documentElement.clientHeight) {
			height = document.documentElement.clientHeight;
	}else {
			height = document.body.clientHeight;
	}
	return height;
}

function fillArray( theArray, val, startIndex, endIndex ){
    if ( startIndex == null)  startIndex = 0;
    if ( endIndex   == null)  endIndex   = theArray.length-1;

    for( var i = startIndex; i <= endIndex; i++){
        theArray[i] = val;
    } 
}

function getWindowSize()
{
	var height = 0;
	if(self.innerHeight) {
			height = self.innerHeight;
	}else if(document.documentElement && document.documentElement.clientHeight) {
			height = document.documentElement.clientHeight;
	}else {
			height = document.body.clientHeight;
	}
	return height;
}


//
// Mozilla/Firefox compatibility fix, allows Mozilla to read IE targetted DOM 
//
var isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);

if (! isIE) {
  HTMLElement.prototype.__defineGetter__("innerText", 
              function () { return(this.textContent); });
  HTMLElement.prototype.__defineSetter__("innerText", 
              function (txt) { this.textContent = txt; });
}



function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}