// Extended Javascript V1.05
function ext_isEmail() {
	var email = this;
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";

    // Check for null
    if (email == "") {
        return false;
    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
}

function ext_isDate(dateStr) 
{
  var dateStr = this;
  var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
  var matchArray = dateStr.match(datePat); // is format OK?

  if (matchArray == null) {
    //alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
    return false;
  }

  // parse date into variables
  month = matchArray[1];
  day = matchArray[3];
  year = matchArray[5];

  if (month < 1 || month > 12) { // check month range
    alert("Month must be between 1 and 12.");
    return false;
  }

  if (day < 1 || day > 31) {
    alert("Day must be between 1 and 31.");
    return false;
  }

  if ((month==4 || month==6 || month==9 || month==11) && day==31) {
    alert("Month " + month + " doesn't have 31 days!")
    return false;
  }

  if (month == 2) { // check for february 29th
    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
    if (day > 29 || (day==29 && !isleap)) {
      alert("February " + year + " doesn't have " + day + " days!");
      return false;
    }
  }
  if (year <1990){
  	alert("Invalid Year");
	return false;
  }
  return true;  // date is valid
}

function ext_isCreditCard() 
{
  // Encoding only works on cards with less than 19 digits
  var st = this;
  if (st.length > 19)
    return (false);
  else if(st.length < 10)
  	return (false);

  sum = 0; mul = 1; l = st.length;
  for (i = 0; i < l; i++) {
    digit = st.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }
// Uncomment the following line to help create credit card numbers
// 1. Create a dummy number with a 0 as the last digit
// 2. Examine the sum written out
// 3. Replace the last digit with the difference between the sum and
//    the next multiple of 10.

//  document.writeln("<BR>Sum      = ",sum,"<BR>");
//  alert("Sum      = " + sum);

  if ((sum % 10) == 0)
    return (true);
  else
    return (false);

} // END FUNCTION isCreditCard()

/*
	This function allows you get your self-defined tags's value.
	If the tag does not exist, the function just return "".
	By Aelxander Liu on Sept 18, 2004
*/
function ext_getSelfDefinedTagValue(tagname)
{
	tagname = tagname.toLowerCase();
	var bt = "<"+tagname+">";
	var et = "</"+tagname+">";
	var btr = new RegExp(bt,"gi");
	var etr = new RegExp(et,"gi");
	var btt = "@@@"+tagname+"@@@";
	var ett = "@@@/"+tagname+"@@@";
	var lt 	= "@@@less than@@@";
	var w = this.replace(btr,btt);
	var w = w.replace(etr,ett);
	var w = w.replace("<",lt);
	pos1 = w.indexOf(btt);
	if(pos1!=-1)
	{
		var pos2 = w.indexOf(ett, pos1);
		if(pos2>pos1)
		{
			var portion = w.substring(pos1, pos2+ett.length);
			portion = portion.replace(btt, "");
			portion = portion.replace(ett, "");
			portion = portion.replace(lt, "<");
			return portion;
		}
	}
	return "";
}
	
/*
	This function allows you get your self-defined tags's value.
	If the tag does not exist, the function just return "".
	By Aelxander Liu on Sept 18, 2004
*/
function ext_deleteSelfDefinedTag(tagname)
{
	tagname = tagname.toUpperCase();
	var begintag = "<"+tagname+">";
	var endtag = "</"+tagname+">";
	
	var pos1 = this.toUpperCase().indexOf(begintag);
	if(pos1!=-1)
	{
		var pos2 = this.toUpperCase().indexOf(endtag, pos1);
		if(pos2>pos1)
		{
			var portion = this.substring(pos1, pos2+endtag.length);
			return this.replace(portion,"");
		}
	}
	return this;
}

/*
	This Function return true or false
	True: is a number
	False: Not a number
*/
function ext_isNumeric()
{
	var st = this;
	st = st.replace(" ","");
	if(st=="")
		return false;
	else
	{
		return !isNaN(st);
	}
}

String.prototype.getSelfDefinedTagValue=ext_getSelfDefinedTagValue;
String.prototype.deleteSelfDefinedTag=ext_deleteSelfDefinedTag;
String.prototype.isEmail=ext_isEmail;
String.prototype.isDate=ext_isDate;
String.prototype.isCreditCard=ext_isCreditCard;
String.prototype.isNumeric=ext_isNumeric;

function ObjectArray(obj)
{
	if(obj.length)
	{
		newobj=obj;
	}
	else
	{
		newobj=new Array();
		newobj[0]=obj;
	}
	return newobj;
}

function absLeft(pobj)
{
	var sleft=pobj.offsetLeft;
	while(pobj=pobj.offsetParent)
		sleft+=pobj.offsetLeft;
	return sleft;
}

function absTop(pobj)
{
	var sTop=pobj.offsetTop;
	while(pobj=pobj.offsetParent)
		sTop+=pobj.offsetTop;
	return sTop;
}

function openWindow(pageToLoad, winName, width, height, center, scrollbar, returnobj) 
{
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}
	if(typeof scrollbar=="undefined")
		scrollbar=1;
	if(typeof returnobj=="undefined")
		returnobj=0;
	
	args = "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars="+scrollbar+","
	+ "status=0," 
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + ","  //NN Only
	+ "screeny=" + yposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only

	mywindow = window.open( pageToLoad,winName,args );
	if(returnobj==1)
		return mywindow;
}

function quick_openwindow(pid, width, height, center, scrollbar)
{
	pageToLoad = "about:blank";
	if(typeof scrollbar=="undefined")
		scrollbar=1;
	mywindow = openWindow(pageToLoad, '', width, height, center, scrollbar,1);
	mywindow.document.write("<html><head><style>body, table, div, span, input, select, textarea, button{font-family:verdana;font-size:xx-small;}</style><script src='/js/extendedjavascript.js' type='text/javascript'></script></head><body leftmargin=1 topmargin=1></body></html>");
	myid = document.getElementById(pid);
	if(myid!=null)
		mywindow.document.body.innerHTML=myid.innerHTML;
	mywindow.opener = window;
}

function find_bigwindow()
{
	var mywin = window;
	var i=0;
	while(mywin!=mywin.parent.window){mywin=mywin.parent.window;if(i++>20) break;};
	return mywin;	
}

function al_alertwin(pid, pwidth, pheight, ptitle, pcontentid, scrollbar)
{
	var myparent=	window;
	var topwin 	= 	find_bigwindow();
	var topdoc 	= 	topwin.document;
	var myobj	=	topdoc.getElementById(pid);
	ptitle = ptitle.replace(/[ ]/g,"&nbsp;");
	if(pwidth.indexOf("%")!=-1)
		pwidth = topdoc.body.clientWidth * parseFloat(pwidth.replace("%",""))/100;
	if(pheight.indexOf("%")!=-1)
		pheight = topdoc.body.clientHeight * parseFloat(pheight.replace("%",""))/100;
	if(myobj!=null)
		al_framewin_remove(pid);
	mytop 		= 	parseInt(topdoc.body.scrollTop)+(topdoc.body.clientHeight-pheight)/2;
	myleft		=	parseInt(topdoc.body.scrollLeft)+(topdoc.body.clientWidth-pwidth)/2;
	newdiv 		=	topdoc.createElement("div");
	newdiv.style.position = "absolute";
	newdiv.style.left = myleft;
	newdiv.style.top = mytop;
	newdiv.setAttribute("id",pid);
	pcontent = "<iframe id='"+pid+"_background' name='"+pid+"_background' width='"+pwidth+"' height:'"+pheight+"' frameborder='0' scrolling='no' style='position:absolute; float:left;' src='/blank.htm'></iframe>";
	pcontent += "<div id='"+pid+"_main' name='"+pid+"_main'  style='position:absolute;float:left;border:2px outset #D6D3CE;width:"+pwidth+"px;height:"+pheight+"px;background-color:#ffffcc;'>";
	pcontent += "<table cellpadding='0' cellspacing='0' width='100%' height='100%' border='0' bgcolor=#ffffff>";
	ptitle=ptitle.replace(" ","");
	pcontent += "<tr>";
	pcontent += "<td height=20 width=100% bgcolor='#0061D6'><font color=#ffffff size=2>&nbsp;<b>"+ptitle+"</b></font></td>";
	pcontent += "<td width=20 bgcolor=#0061D6 nowrap><a href='javascript:al_framewin_maxwin(\""+pid+"\")'><img id='framewin_maximg_"+pid+"' src='/images/max.gif' border='0'></a><span id='framewin_originalwidth"+pid+"' style='display:none;'>"+pwidth+"</span><span id='framewin_originalheight"+pid+"' style='display:none;'>"+pheight+"</span><span id='framewin_status"+pid+"' style='display:none;'>0</span></td>";
	pcontent += "<td width=20 bgcolor=#0061D6 nowrap><a href='javascript:al_framewin_remove(\""+pid+"\")'><img src='/images/close.gif' border='0'></a></td>";
	pcontent += "</tr>";
	pcontent += "<tr><td height=1 colspan=3 bgcolor='#848284'></td></tr>";
	pcontent += "<tr><td id='"+pid+"_td_al' colspan=3 height=100% width=100%><div id='"+pid+"_frame_al' name='"+pid+"_frame_al' style='width:100%;height:100%;overflow:auto;'></div></td></tr>";
	pcontent += "</table></div>";
	newdiv.innerHTML = pcontent;
	topdoc.body.appendChild(newdiv);
	frameobj=topdoc.getElementById(pid+"_frame_al");
	if(BrowserDetect()!="IE")
	{
		tdobj=topdoc.getElementById(pid+"_td_al");
		frameobj.style.width = tdobj.clientWidth;
	}
	alertcontent = document.getElementById(pcontentid);
	if(alertcontent!=null)
		frameobj.innerHTML=alertcontent.innerHTML;
	eval("topdoc."+pid+"_frame_al_parent=myparent");
	al_framewin_maxwin(pid);
}

function al_framewin(pid, pwidth, pheight, ptitle, purl, scrollbar)
{
	var myparent=	window;
	var topwin 	= 	find_bigwindow();
	var topdoc 	= 	topwin.document;
	var myobj	=	topdoc.getElementById(pid);
	ptitle = ptitle.replace(/[ ]/g,"&nbsp;");
	if(pwidth.indexOf("%")!=-1)
		pwidth = topdoc.body.clientWidth * parseFloat(pwidth.replace("%",""))/100;
	if(pheight.indexOf("%")!=-1)
		pheight = topdoc.body.clientHeight * parseFloat(pheight.replace("%",""))/100;
	if(myobj!=null)
		al_framewin_remove(pid);
	mytop 		= 	parseInt(topdoc.body.scrollTop)+(topdoc.body.clientHeight-pheight)/2;
	myleft		=	parseInt(topdoc.body.scrollLeft)+(topdoc.body.clientWidth-pwidth)/2;
	newdiv 		=	topdoc.createElement("div");
	newdiv.style.position = "absolute";
	newdiv.style.left = myleft;
	newdiv.style.top = mytop;
	newdiv.setAttribute("id",pid);
	pcontent = "<iframe id='"+pid+"_background' name='"+pid+"_background' width='"+pwidth+"' height:'"+pheight+"' frameborder='0' scrolling='no' style='position:absolute; float:left;' src='/blank.htm'></iframe>";
	pcontent += "<div id='"+pid+"_main' name='"+pid+"_main'  style='position:absolute;float:left;border:2px outset #D6D3CE;width:"+pwidth+"px;height:"+pheight+"px;background-color:#ffffcc;'>";
	pcontent += "<table cellpadding='0' cellspacing='0' width='100%' height='100%' border='0' bgcolor=#ffffff>";
	ptitle=ptitle.replace(" ","");
	pcontent += "<tr>";
	pcontent += "<td height=20 width=100% bgcolor='#0061D6'><font color=#ffffff size=2>&nbsp;<b>"+ptitle+"</b></font></td>";
	pcontent += "<td width=20 bgcolor=#0061D6 nowrap><a href='javascript:al_framewin_maxwin(\""+pid+"\")'><img id='framewin_maximg_"+pid+"' src='/images/max.gif' border='0'></a><span id='framewin_originalwidth"+pid+"' style='display:none;'>"+pwidth+"</span><span id='framewin_originalheight"+pid+"' style='display:none;'>"+pheight+"</span><span id='framewin_status"+pid+"' style='display:none;'>0</span></td>";
	pcontent += "<td width=20 bgcolor=#0061D6 nowrap><a href='javascript:al_framewin_remove(\""+pid+"\")'><img src='/images/close.gif' border='0'></a></td>";
	pcontent += "</tr>";
	pcontent += "<tr><td height=1 colspan=3 bgcolor='#848284'></td></tr>";
	pcontent += "<tr><td id='"+pid+"_td_al' colspan=3 height=100% width=100%><iframe id='"+pid+"_frame_al' name='"+pid+"_frame_al' width='"+(BrowserDetect()=="IE"?"100%":"99.9%")+"' height='100%' src='"+purl+"' scrolling='"+scrollbar+"'></iframe></td></tr>";
	pcontent += "</table></div>";
	newdiv.innerHTML = pcontent;
	topdoc.body.appendChild(newdiv);
	if(BrowserDetect()!="IE")
	{
		frameobj=document.getElementById(pid+"_frame_al");
		tdobj=document.getElementById(pid+"_td_al");
		frameobj.style.width = tdobj.clientWidth;
	}
	eval("topdoc."+pid+"_frame_al_parent=myparent");
	al_framewin_maxwin(pid);
}

function al_framewin_remove(pid)
{
	if(typeof pid=="undefined")
	{
		if(window.name.indexOf("_frame_al")>0)
			pid = window.name.replace("_frame_al","");
		else
			pid = "nopidnopidnopid";
	}
	var topwin 	= 	find_bigwindow();
	var topdoc 	= 	topwin.document;
	var myobj = topdoc.getElementById(pid);
	if(myobj!=null)
	{
		myobj.innerHTML = "";
		topdoc.body.removeChild(myobj);
	}
}

function al_framewin_maxwin(pid)
{
	var topwin 	= 	find_bigwindow();
	var topdoc 	= 	topwin.document;
	var winstatus = topdoc.getElementById("framewin_status"+pid).innerHTML;
	var maximg = topdoc.getElementById("framewin_maximg_"+pid);
	var myobj_background = topdoc.getElementById(pid+"_background");
	var myobj_main = topdoc.getElementById(pid+"_main");
	var myobj = topdoc.getElementById(pid);
	
	if(winstatus=="1")
	{
		topdoc.getElementById("framewin_status"+pid).innerHTML="2";
		maximg.src="/images/restore.gif";
		myobj.style.left = parseInt(topdoc.body.scrollLeft);
		myobj.style.top = parseInt(topdoc.body.scrollTop);
		myobj_main.style.height=topdoc.body.clientHeight;
		myobj_main.style.width=topdoc.body.clientWidth;
		myobj_background.style.height=topdoc.body.clientHeight;
		myobj_background.style.width=topdoc.body.clientWidth;
	}
	else
	{
		var pheight = parseInt(topdoc.getElementById("framewin_originalheight"+pid).innerHTML);
		var pwidth = parseInt(topdoc.getElementById("framewin_originalwidth"+pid).innerHTML);
		topdoc.getElementById("framewin_status"+pid).innerHTML="1";
		maximg.src="/images/max.gif";
		myobj.style.left = parseInt(topdoc.body.scrollLeft)+(topdoc.body.clientWidth-pwidth)/2;
		myobj.style.top = parseInt(topdoc.body.scrollTop)+(topdoc.body.clientHeight-pheight)/2;
		myobj_main.style.height=pheight;
		myobj_main.style.width=pwidth;
		myobj_background.style.height=pheight;
		myobj_background.style.width=pwidth;		
	}
}

function al_framewin_getparent()
{
	if(window.name.indexOf("_frame_al")>0)
	{
		var topwin 	= 	find_bigwindow();
		var topdoc 	= 	topwin.document;
		//alert(topdoc);
		return eval("topdoc."+window.name+"_parent");
	}
	else
		return document.parent;
}

function al_alertwin_getparent(pid)
{
	var topwin 	= 	find_bigwindow();
	var topdoc 	= 	topwin.document;
	return eval("topdoc."+pid+"_frame_al_parent");
}

function BrowserDetect()
{
	if(navigator.appName.indexOf('Microsoft Internet Explorer')!=-1)
		return "IE";
	else if(navigator.appName.indexOf('Netscape')!=-1)
		return "Netscape";
	else
		return "N/A";
}


//Row Change Color Functions on July 13, 2005
function al_mouseover(groupid, obj, pcolor)
{
	al_definedvariables(groupid, obj);
	obj.style.backgroundColor=pcolor;
}
function al_mouseout(groupid, obj)
{
	al_definedvariables(groupid, obj);
	obj.style.backgroundColor=obj.currentcolor;
}

function al_click(groupid, obj, pcolor, multipleHighlight)
{
	al_definedvariables(groupid, obj);
	if(typeof(multipleHighlight)=="undefined")
		multipleHighlight=0;
	if(multipleHighlight==0)
		multipleHighlight=1;
	else
		multipleHighlight=0;
	mydiv = document.getElementById("hiddnediv_"+groupid);
	mydiv.style.backgroundColor=pcolor;
	pcolor=mydiv.style.backgroundColor;
	if(multipleHighlight==0)
	{
		if(obj.currentcolor==pcolor)
			obj.style.backgroundColor=obj.originalcolor;
		else
			obj.style.backgroundColor=pcolor;
	}
	else
		obj.style.backgroundColor=pcolor;
	obj.currentcolor=obj.style.backgroundColor;
	if(multipleHighlight!=0)
	{
		if(eval("document.currentclickedobj_"+groupid)!=obj&&eval("document.currentclickedobj_"+groupid)!=null)
		{
			var oldobj = eval("document.currentclickedobj_"+groupid);
			oldobj.style.backgroundColor=oldobj.originalcolor;
			oldobj.currentcolor=oldobj.originalcolor;
		}
	}
	eval("document.currentclickedobj_"+groupid+"=obj");
}

function al_definedvariables(groupid, obj)
{
	if(typeof(obj.originalcolor)=="undefined")
		obj.originalcolor=obj.style.backgroundColor;		
	if(typeof(obj.currentcolor)=="undefined")
		obj.currentcolor=obj.style.backgroundColor;	
	if(typeof(eval("document.currentclickedobj_"+groupid))=="undefined")
		eval("document.currentclickedobj_"+groupid+"=null");
	mydiv = document.getElementById("hiddnediv_"+groupid);
	if(mydiv==null)
	{
		mydiv 	=	document.createElement("div");
		mydiv.setAttribute("id", "hiddnediv_"+groupid);
		document.body.appendChild(mydiv);
		mydiv.style.display="none";
	}
}
//Row Change Color Functions End

function showgroupinformation()
{
	if(typeof document.showgroupinfo_lasttime=='undefined')
	{
		document.showgroupinfo_lasttime = new Date();
		document.showgroupinfo_counter = 0;
	}
	var currenttime=new Date();
	if(document.showgroupinfo_counter==0)
	{
		document.showgroupinfo_counter++;
		document.showgroupinfo_lasttime = currenttime;
	}
	else if((currenttime-document.showgroupinfo_lasttime)<2000)
		document.showgroupinfo_counter++;
	else
		document.showgroupinfo_counter=0;
	if(document.showgroupinfo_counter>=4)
	{
		if(document.getElementById("GroupInformation")!=null)
			al_alertwin('showgroupinfo', '300', '300', 'Show Grounp Information', 'GroupInformation', 'yes');
		document.showgroupinfo_counter=0;
	}
}

//Form Extend Script 
function al_keydown(ptype, myfunc)
{
	//FireFox's Javascript too stupid. Forget it. This function is only for IE
	var legalscancode = false;
	ptype = ptype.toLowerCase();
	if(event.keyCode==13) 
	{
		event.keyCode=9;
		legalscancode=true;
	}
	if((ptype=="digis_alphbat"||ptype=="digis"||ptype=="float")&&!legalscancode)
	{
		if(event.keyCode>=48&&event.keyCode<=57)
			legalscancode=true;
	}
	if(ptype=="float"&&!legalscancode)
	{
		mytarget = event.srcElement;
		if((event.keyCode==109||event.keyCode==189))
		{
			if(mytarget.value.indexOf('-')==-1)
				mytarget.value="-"+mytarget.value;
			legalscancode=false;
		}
		else if((event.keyCode==46||event.keyCode==110) && mytarget.value.indexOf('.')!=-1)
			legalscancode=false;
		else if(event.keyCode==46||event.keyCode==110||event.keyCode==109||event.keyCode==189)
			legalscancode=true;
	}
	if((ptype=="digis_alphbat"||ptype=="string")&&!legalscancode)
	{
		if(event.keyCode>=65&&event.keyCode<=90)
			legalscancode=true;
	}
	
	if(ptype=="all")
		legalscancode=true;
	
	if(event.keyCode>=96&&event.keyCode<=105)
		legalscancode=true;
	else if(event.keyCode==8||event.keyCode==46||(event.keyCode>=35&&event.keyCode<=40)||(event.keyCode>=16&&event.keyCode<=18))
		legalscancode=true;
	if((typeof myfunc)!="undefined")
		eval(myfunc);
	return legalscancode;
}

//Dynamic Grid Begin
//Dynamic Grid End


//New Data Type
// AJAX
function alexobject(initvalue, name)
{
	this.onchange="";
	this.errortext = "";
	this.onerror="";
	this.name="";
	this.ontimeout="";
	this.oldvalue="";
	this.value="";
	this.divobj=null;
	this.frameobj=null;
	this.timer=0;
	this.timercouter=0;
	this.timerinterval=500;
	this.length=0;
	this.id;
	this.CreateDateTime = new Date();
	this._ms_XMLHttpRequest_ActiveX;
	this.setValue=function(newvalue, force)
				{
					this.oldvalue=this.value;
					this.value=newvalue;
					if(force)
					{
						if(!(force==false||force==true))
							force=false;
					}
					else
						force = false;
					if(this.onchange!="")
					{
						if(this.oldvalue!=this.value||force)
							eval(this.onchange);
					}
					this.length=this.value.length;
				}
	this.monitorurl2=function(URL, ValueReturn, myprocess, async)
				{
					if(!ValueReturn) ValueReturn=true;
					if(!myprocess) myprocess=null;
					if(!async) async=false;
					var my = new this.AJAXRequest("post", URL, null, myprocess, async, ValueReturn, this);
					if(async==false)
					{
						if(ValueReturn)
						{
							if(my.statusText=="OK")
							{
								if(ValueReturn)
									this.setValue(my.responseText, true);
							}
							else
							{
								if(this.onerror!="")
								{
									this.errortext = my.statusText;
									eval(this.onerror);
								}
							}
						}
						else
							this.setValue(this.value,true);
					}
				}
	this.monitorurl=function(URL, TimeOut, ValueReturn, WithHTML)
				{
					//Set some default value.
					//if timeout is 0, the program will check the url forever.
					//if valuereturn is true, it will call setValue.
					if(!TimeOut)
						TimeOut=0;
					if(!ValueReturn)
						ValueReturn=true;
					if(!WithHTML)
						WithHTML=true;
					if(this.frameobj==null)
					{
						if(!document.body)
						{
							alert("This Template is missing a <BODY> Tag! You can not use Alex Object's all feature.");
							return false;
						}
						this.frameobj=document.createElement("iframe");
						this.frameobj.setAttribute("id", "alexobject_iframe_" + Math.round(Math.random()*1000000));
						this.frameobj.style.display="none";
						URL=URL+(URL.indexOf("?")>0?"&":"?")+"alexobjectuuid="+Math.round(Math.random()*1000000);
						this.frameobj.setAttribute("src",URL);
						document.body.appendChild(this.frameobj);
						if(TimeOut>=0)
						{
							this.timer=setTimeout("window.alexobjectarray_"+this.id+".monitor_iframe("+TimeOut+","+ValueReturn+","+WithHTML+")", this.timerinterval);
							//this.timer=setTimeout("window.alexobjectarray_"+this.id+".showmyid()",this.timerinterval);
						}
					}
					return false;
				}
	this.monitor_iframe=function(TimeOut, ValueReturn, WithHTML)//This is a private function. Support not call by out side.
				{
					if(this.frameobj!=null)
					{
						if(document.frames[this.frameobj.id].document.body)
						{
							if(WithHTML)
								var mycontent = document.frames[this.frameobj.id].document.body.innerHTML;
							else
								var mycontent = document.frames[this.frameobj.id].document.body.innerText;
							document.body.removeChild(this.frameobj);
							this.frameobj=null;
							if(ValueReturn)
								this.setValue(mycontent, true)
						}
						else
						{
							this.timercouter+=this.timerinterval;
							if(this.timercouter>TimeOut&&TimeOut>0)
							{
								document.body.removeChild(this.frameobj);
								this.frameobj=null;
								if(this.ontimeout!="")
								{
									eval(this.ontimeout);
								}
							}
							else if(TimeOut>=0)
							{
								if(this.name!="")
									this.timer=setTimeout(this.name+".monitor_iframe("+TimeOut+","+ValueReturn+","+WithHTML+")", this.timerinterval);
								else
									this.timer=setTimeout("window.alexobjectarray_"+this.id+".monitor_iframe("+TimeOut+","+ValueReturn+","+WithHTML+")", this.timerinterval);
							}
							else
							{
								document.body.removeChild(this.frameobj);
								this.frameobj=null;
							}
								
						}
					}
				}
	this.AJAXRequest=function( method, url, data, process, async, dosend, pobj) 
					{
						var self = this;
						self.container = pobj;
						if (window.XMLHttpRequest) 
						{
							self.AJAX = new XMLHttpRequest();
						} 
						else if (window.ActiveXObject) 
						{
							if (this._ms_XMLHttpRequest_ActiveX) 
							{
								self.AJAX = new ActiveXObject(this._ms_XMLHttpRequest_ActiveX);
							} 
							else 
							{
								var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
								for (var i = 0; i < versions.length ; i++) 
								{
									try 
									{
										self.AJAX = new ActiveXObject(versions[i]);
										if (self.AJAX) 
										{
											this._ms_XMLHttpRequest_ActiveX = versions[i];
											break;
										}
									}
									catch (objException) 
									{
										// trap; try next one
									} ;
								}
								;
							}
						}
						if (typeof process == 'undefined' || process == null) 
						{
							process = function(AJAX){};
						}
						self.process = process;
						self.AJAX.onreadystatechange = function( ) 
														{
															self.process(self.AJAX);
														}
						if (!method) 
						{
							method = "POST";
						}
					
						method = method.toUpperCase();
					
						if (typeof async == 'undefined' || async == null) 
						{
							async = true;
						}
						self.AJAX.open(method, url, async);
						if (method == "POST") 
						{
							self.AJAX.setRequestHeader("Connection", "close");
							self.AJAX.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
							self.AJAX.setRequestHeader("Method", "POST " + url + "HTTP/1.1");
						}
						if ( dosend || typeof dosend == 'undefined' ) 
						{
							if ( !data ) data=""; 
							self.AJAX.send(data);
						}
						return self.AJAX;
					}
	if(initvalue)
		this.setValue(initvalue);
	if(name)
		this.name=name;
	else
		this.name="";
	this.id = "alexobjectid_"+Math.round(Math.random()*1000000);
	eval("window.alexobjectarray_"+this.id+"=this");
}

function browserWidth()
{
	if(BrowserDetect()!="IE")
		return window.innerWidth;
	else
		return document.body.offsetWidth;
}
function browserHeight()
{
	if(BrowserDetect()!="IE")
		return window.innerHeight;
	else
		return document.body.offsetHeight;
}