dhtmlLoadScript("include/JSDLogger.js");JS_DebugMode = false;  var is_opera = (navigator.userAgent.toLowerCase().indexOf('opera')!=-1);  function Control(Parent){	this.Parent=Parent;	this.disableFade=false;	//if(is_opera || (this.getInternetExplorerVersion() > 0) || isiPhone)		//this.disableFade = true;	if(this.isWebKit()) {		this.disableFade = true;	}}Control.prototype.GetType = function(){	return "Control";}Control.prototype.Paint=function(){	}Control.prototype.isSafari = function() {	return (navigator.userAgent.toLowerCase().indexOf("safari")!=-1);}Control.prototype.isWebKit = function() {	return (navigator.userAgent.toLowerCase().indexOf("webkit")!=-1);}Control.prototype.isMac = function() {	return (navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1);	}Control.prototype.disableSelection = function(element) {    if(this.isSafari())		element.onselectstart = function() {			return false;		};    element.unselectable = "on";    //element.style.MozUserSelect = "none";    element.style.cursor = "default"; }Control.prototype.enableSelection = function(element) {	if(this.isSafari())		element.onselectstart = function() {		};	element.unselectable = "off";	//element.style.MozUserSelect = "all";	element.style.cursor = "auto";}Control.prototype.newDiv = function() {	var elm = document.createElement("div");	elm.style.margin="0";	elm.style.padding="0";	elm.style.border="0";	elm.style.position="absolute";	elm.style.overflow="hidden";	return elm;}Control.prototype.newTableCell = function() {	var elm = document.createElement("td");	elm.style.margin = "0";	elm.style.padding = "0";	elm.style.border = "0";	return elm;}Control.prototype.getInternetExplorerVersion =  function()// 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;}Control.prototype.InformationDialog = function(message,title) {	return this.BasicDialog(message,title,"images/information.png","Information",true);}Control.prototype.HelpDialog = function(message,title,x,y,scroll) {	var d = this.BasicDialog(message,title,"images/help.png","Help",false,true);	if(x!=null && y!=null) {		d.myWindow.size = new Coordinates(x,y);	}	d.myWindow.CenterWindowOnDesktop();	d.myWindow.SetStyles();	d.Paint();	if (scroll != null) {		d.messageDiv.style.overflowY = "auto";		d.messageDiv.style.height = y-100+"px";		d.messageDiv.style.width = x-120+"px";			}	return d;}function JSAlert(text) {	window.myDesktop.AlertDialog(text,"Alert");	}function JSInfo(text) {	window.myDesktop.InfoDialog(text,"Information");	}Control.prototype.AlertDialog = function(message,title,handler) {	var newD = this.BasicDialog(message,title,"images/alert.png","Alert",true);	if(handler) {		newD.buttons[0].handler = function() {			handler();			this.myApp.Kill();		}		newD.buttons[0].SetEvents();	}	return newD;}Control.prototype.InfoDialog = function(message,title,handler) {	var newD = this.BasicDialog(message,title,"images/information.png","Information",true);	if(handler) {		newD.buttons[0].handler = function() {			handler();			this.myApp.Kill();		}		newD.buttons[0].SetEvents();	}	return newD;}Control.prototype.QuestionDialog = function(message,title,handler,myApp) {	var newD = this.BasicDialog(message,title,"images/Question.png","Question",true,true);	if(myApp)		newD.myApp = myApp;	if(handler) {		newD.buttons[0].handler = function() {			if(this.myApp.myApp)				handler(this.myApp.myApp);			else				handler();			this.myApp.Kill(1);		}		newD.buttons[0].SetEvents();	}	var cancelButton = new Button("Cancel",newD);	cancelButton.handler = function() {		this.Parent.Kill(1);	}	cancelButton.SetEvents();	newD.buttons.push(cancelButton);	newD.Paint();		return newD;}Control.prototype.BasicDialog = function(message,title,icon,defaultTitle,modal,waitToPaint) {	var myDialog = new Dialog(window.myDesktop);	var newButton = new Button("OK");	newButton.elm.myself = newButton;	newButton.myApp = myDialog;	newButton.handler = myDialog.Kill;	newButton.SetEvents();	myDialog.buttons.push(newButton);	if(title!=null)		myDialog.myWindow.titleBar.text = title;	else		myDialog.myWindow.titleBar.text = defaultTitle;	if(message!=null)		myDialog.message = message;	myDialog.icon = icon;	if(modal!=null)		myDialog.modal = modal;	window.myDesktop.AddWindow(myDialog.myWindow);	if(waitToPaint == null)		myDialog.Paint();	return myDialog;}Control.prototype.OKCancel = function() {	if(this.form) {		var s = this.myWindow.size;		this.okButton = this.form.AddButton("OK",s.x-135,s.y-68,this.OKButtonHandler);		this.cancelButton = this.form.AddButton("Cancel",s.x-80,s.y-68,this.CancelButtonHandler);	}}Control.prototype.ResizeGrabbers = function(e) {	if(this.grabbers)		for(var i=0;i<this.grabbers.length;i++) {			this.grabbers[i].Update(e.clientX,e.clientY);		}}Control.prototype.StopResizing = function() {	if(this.grabbers)		for(var i=0;i<this.grabbers.length;i++) {			this.grabbers[i].StopResizing();		}}var FadeElement;var FadeNextEvent;/*function FadeIn(Element,FadeToValue,NextEvent){	if (Element==null)		Element=FadeElement;	else		FadeElement=Element;	if (NextEvent==null)		NextEvent=FadeNextEvent;	else		FadeNextEvent=NextEvent;	if (getOpacity(Element) <= FadeToValue) 	{	 	setOpacity(Element,getOpacity(Element)+1);	 	setTimeout("FadeIn(null,"+FadeToValue+","+NextEvent+");",15);	}	else	{		FadeElement=null;		if (NextEvent!=null)		{			try			{				NextEvent(Element);				FadeNextEvent=null;			}			catch(e)			{			}		}	}}*/var FadeInEvents = new Array();var FadeOutEvents = new Array();function FadeObject(Element,FadeToValue,NextEvent) {	this.Element = Element;	this.FadeToValue = FadeToValue;	if(NextEvent!=null)		this.NextEvent = NextEvent;}function FadeIn(Element,FadeToValue) {	if(Element!=null) {		FadeInEvents.push(new FadeObject(Element,FadeToValue));		if(FadeInEvents.length>1)			return true;	}	if(FadeInEvents.length>0) {		if(getOpacity(FadeInEvents[0].Element) <= FadeInEvents[0].FadeToValue) {			setOpacity(FadeInEvents[0].Element,getOpacity(FadeInEvents[0].Element)+1);			setTimeout("FadeIn()",25);		} else {			FadeInEvents.shift();			setTimeout("FadeIn()",25);		}	}}function FadeOut(Element,FadeToValue,NextEvent) {	if(Element!=null) {		FadeOutEvents.push(new FadeObject(Element,FadeToValue,NextEvent));		if(FadeOutEvents.length>1)			return true;	}	if(FadeOutEvents.length>0) {		if(getOpacity(FadeOutEvents[0].Element) >= FadeOutEvents[0].FadeToValue) {			setOpacity(FadeOutEvents[0].Element,getOpacity(FadeOutEvents[0].Element)-1);			setTimeout("FadeOut()",25);		} else {			if(FadeOutEvents[0].NextEvent) {				try {					FadeOutEvents[0].NextEvent(FadeOutEvents[0].Element);				} catch(e) {				}			}			FadeOutEvents.shift();			setTimeout("FadeOut()",25);		}	}}/*function FadeOut(Element,FadeToValue,NextEvent){	if (Element==null)		Element=FadeElement;	else		FadeElement=Element;	if (NextEvent==null)		NextEvent=FadeNextEvent;	else		FadeNextEvent=NextEvent;	if (getOpacity(Element) >= FadeToValue) 	{	 	setOpacity(Element,getOpacity(Element)-1);	 	setTimeout("FadeOut(null,"+FadeToValue+","+NextEvent+");",15);	}	else	{		FadeElement=null;		if (NextEvent!=null)		{			try			{				NextEvent(Element);				FadeNextEvent=null;			}			catch(e)			{							}		}	}}*/Control.prototype.AddWindow = function(newWindow) {	newWindow.id = this.idCounter;	this.idCounter++;	window.myDesktop.windows.push(newWindow);	if(!newWindow.disableFade)		setOpacity(newWindow.elm,0);	this.elm.appendChild(newWindow.elm);	if(!newWindow.initiallyHidden) {		if (newWindow.disableFade==true)			setOpacity(newWindow.elm,10);		else			FadeIn(newWindow.elm,10);	} else		setOpacity(newWindow.elm,0);	newWindow.MakeActive();	newWindow.isPainted = true;	newWindow.SetStyles();	window.myDesktop.zIndexAdd(newWindow.id);	window.myDesktop.zIndexUpdate();	if(JS_DebugMode) {		var str = "";		str = str.concat("New Window: "+newWindow.titleBar.text+", ");		if(newWindow.myApp)			str = str.concat("My App: "+newWindow.myApp.GetType()+", ");		str = str.concat("Id: "+newWindow.id+", ");		str = str.concat("windows.length = "+window.myDesktop.windows.length);		window.myDesktop.errorConsole.Add(str);	}}Control.prototype.idCounter = 0;Control.prototype.KillWindow = function(windowToKill) {	window.myDesktop.windows.splice(this.WindowArySlot(windowToKill.id),1);	window.myDesktop.zIndexDelete(windowToKill.id);	if(windowToKill.myApp) {		if(windowToKill.myApp.myWindow)			windowToKill.myApp.myWindow = null;		windowToKill.myApp = null;	}	if(windowToKill.GetType()=="MenuItem") {		windowToKill = windowToKill.Parent.Parent.Parent;		}	RunFunction=function(Element){	windowToKill=Element.myself;	windowToKill.elm.parentNode.removeChild(windowToKill.elm);	if(windowToKill.myIcon)		windowToKill.myIcon.myWindow=false;	if(windowToKill.isActive)		if(window.myDesktop.windows.length>0)			window.myDesktop.windows[window.myDesktop.windows.length-1].MakeActive();			else {			window.myDesktop.isActive = true;			window.myDesktop.makingWindowInactive = false;		}	window.myDesktop.zIndexUpdate();	//delete(windowToKill);	if(JS_DebugMode) {		var str = "";		str = str.concat("Kill Window: "+windowToKill.titleBar.text+", ");		if(windowToKill.myApp)			str = str.concat("My App: "+windowToKill.myApp.GetType()+", ");		str = str.concat("Id: "+windowToKill.id+", ");		str = str.concat("windows.length = "+window.myDesktop.windows.length);		window.myDesktop.errorConsole.Add(str);	}	}	if (windowToKill.disableFade==true)	{		setOpacity(windowToKill.elm,10);		RunFunction(windowToKill.elm);	}	else		FadeOut(windowToKill.elm,0,RunFunction);	if(windowToKill.myDialog)		if(windowToKill.myDialog.modalDiv)			SelfDestruct(windowToKill.myDialog.modalDiv);	windowToKill = null;}Control.prototype.GetWindowById = function(id) {	var i=0;	for(i=0;i<window.myDesktop.windows.length;i++)		if(window.myDesktop.windows[i].id == id)			return window.myDesktop.windows[i];	return false;}Control.prototype.WindowArySlot = function(id) {	var i=0;	for(i=0;i<window.myDesktop.windows.length;i++)		if(window.myDesktop.windows[i].id == id)			return i;	return false;}Control.prototype.MoveWindowsToBack = function(except) {	if(except == null)		except = -1;	var i;	if(except!=-1)		var exceptID = this.WindowArySlot(except);	else		var exceptID = -1;	if(JS_DebugMode) {		//window.myDesktop.errorConsole.Add("MoveWindowsToBack Call.  except: "+except+", exceptID: "+exceptID);	}	for(i=0;i<window.myDesktop.windows.length;i++) {		if(i!=exceptID) {			if(window.myDesktop.windows[i].isActive)				window.myDesktop.makingWindowInactive = true;			window.myDesktop.windows[i].MakeInactive();		}	}}Control.prototype.LaunchApp = function(optionalParam) {//	try {	var param = null;	if(optionalParam)		param = optionalParam;	else if(this.param)		param = this.param;	var newApp = new this.myApp(window.myDesktop,param);	if(!this.apps)		this.apps = new Array();	this.apps.push(newApp);	newApp.appId = this.apps.length-1;//	} catch(e) {alert(e.number+", "+e.message+", "+e.name)}}Control.prototype.KeyPressEvent = function(ev) {	//if(!window.myDesktop.errorConsole)		//window.myDesktop.ShowErrorConsole();	if(window.event)		ev = window.event;	ev.cancelBubble = true;	var elm;	if(window.myDesktop.isActive)		elm = window.myDesktop;	else		if(window.myDesktop.activeWindow!=null)			elm = window.myDesktop.activeWindow;		else			return;	if(window.myDesktop.lists) {		try {			for(i=0;i<window.myDesktop.lists.length;i++) {				window.myDesktop.lists[i].KeyPressEvent(ev);			}				} catch(e) {			alert("error: "+e);		}			}	if(elm.iconGrid) {		var key = ev.keyCode;		if(key==38||key==63232) //up arrow key -- the 63232 is for Safari			elm.iconGrid.Move(new Coordinates(0,-1));		if(key==37||key==63234) //left arrow key			elm.iconGrid.Move(new Coordinates(-1,0));		if(key==40||key==63233) //down arrow key			elm.iconGrid.Move(new Coordinates(0,1));		if(key==39||key==63235) //right arrow key			elm.iconGrid.Move(new Coordinates(1,0));		if(key==13)			elm.iconGrid.EnterPressed();	} else		if(elm.keyPressEvents)			elm.myApp.KeyPressEvent(ev);		else			if(elm.kPEvent)				elm.kPEvent(ev);}Control.prototype.StopEventPropogation = function(ev) {	try {		ev.preventDefault();	} catch(e) {		alert("control.stopeventpropogation: "+e);	}	try {		ev.returnValue = false;		} catch(e) {alert(e+", StopEventPropogation Function");}}Control.prototype.LogoffUser = function() {	if(window.myDesktop.errorConsole)		SelfDestruct(window.myDesktop.errorConsole.elm);	if(window.myDesktop.taskBar)		SelfDestruct(window.myDesktop.taskBar.elm);	SelfDestruct(window.myDesktop.elm);	myDesktop = null;	User = null;	CurrentUser = null;	setTimeout("OnDesktopLoad()",20);	}function StripIllegalCharacters(string) {	return string.replace(/ \n/g,"");}Control.prototype.Parent=this.Parent;function WM(){	WM.prototype=new Control(this);}WM.prototype.GetType=function(){	return "WM";}var WindowManager=new WM();function Mouse(Parent){	this.Parent=Parent;	//alert(this.Parent.GetType());	Mouse.prototype = new Control(this.Parent);		}Mouse.prototype.Timer;Mouse.prototype.KillTimer=function(){	if (this.Timer!=null || this.Timer!="undefined")		clearInterval(this.Timer);}Mouse.prototype.InitTimer=function(){	this.KillTimer();	this.Timer=setInterval(this.OnMouseUp,100);}Mouse.prototype.IsDown=false;Mouse.prototype.OnMouseUp=function(){	this.IsDown=false;}Mouse.prototype.OnMouseDown=function(){	this.IsDown=true;}Mouse.prototype.GetType=function(){	return "Mouse";}function Desktop(Parent,rootless) {	this.Parent=Parent;	if(rootless!=null)		this.rootless = true;	if(this.rootless)		this.elm = document.body;	else		this.elm = document.createElement("div");	this.elm.myself = this;	this.browserWindow = new BrowserWindow();	window.myDesktop = this;	this.color = JSTheme.desktopBackgroundColor;	this.windows = new Array();	this.zIndexStack = new Array();		this.logo = new Logo(this);	this.isActive = true;	this.activeWindow = null;	this.errorConsole = null;		this.zIndexVerboseErrors = false;	this.zIndexBase = 110;		this.apps = new Array();	this.size = this.browserWindow.size;	this.iconGrid = new IconGrid(this,this.size.x,this.size.y);	this.taskBar = null;	this.makingWindowInactive = false;		window.onresize = function() {		window.myDesktop.Update();	}	WindowManager.Desktop=this;	this.Icon=new Icon(this,"images/MyIcon.gif","Test.pdf");	this.SetEvents();	}Desktop.prototype = new Control(this.Parent);Desktop.prototype.Mouse=new Mouse(this);Desktop.prototype.Paint = function() {	this.Update();	if(!this.rootless) {		this.elm.style.backgroundColor = this.color;		this.elm.style.zIndex = "0";		this.elm.style.top = "0px";		this.elm.style.left = "0px";		this.elm.style.position = "absolute";		this.disableSelection(this.elm);		this.disableSelection(document.body);	}	this.Icon.Paint();	document.body.style.overflow="hidden";	this.elm.style.overflow="hidden";	document.body.appendChild(this.elm);		//this.Mouse.InitTimer();	if(this.logo.IsSet())		this.elm.appendChild(this.logo.elm);	if(JS_DebugMode)		this.ShowErrorConsole();	//this.elm.onmousedown=this.Mouse.OnMouseDown;}Desktop.prototype.GetType=function(){	return "Desktop";}Desktop.prototype.Update = function() {	var i;	this.browserWindow.Update();	if (isiPhone) {		this.browserWindow.size = new Coordinates(630, 800);		setTimeout(function(){window.scrollTo(0,1);}, 100);	}	if(this.errorConsole)		this.errorConsole.SetStyles();	if(this.taskBar)		this.taskBar.SetStyles();	this.size = this.browserWindow.size;	if(!this.rootless) {		this.elm.style.width = this.size.x+"px";		this.elm.style.height = this.size.y+"px";	}	for(i=0;i<this.windows.length;i++) {		if(this.windows[i].isMaximized) 	//only need to update window settings if it is maximized and, therefore, tied to the			this.windows[i].SetStyles();	//desktop's size	}	if(this.iconGrid)		this.iconGrid.SetStyles(this.size.x,this.size.y);	if(this.logo.IsSet()) {		this.logo.SetStyles();	}	if(this.isActive)		this.SetEvents();	else		this.UnsetEvents();}Desktop.prototype.HideAllMenus = function(except) {	if(except == null)		var except = -1;	var i=0;	for(i=0;i<this.windows.length;i++) {		if(this.windows[i].menuBar!=null) {			if(this.windows[i].id!=except) {				this.windows[i].menuBar.HideMenusExcept(-1);				this.windows[i].menuBar.menuIsActive = false;			}		}	}	}Desktop.prototype.SetEvents = function() {	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		if(e)			e.cancelBubble = true;		window.myDesktop.isActive = true;		window.myDesktop.activeWindow = null;		window.myDesktop.HideAllMenus();		window.myDesktop.MoveWindowsToBack();		window.myDesktop.iconGrid.DeselectAll();	}	if(this.getInternetExplorerVersion()>0)		document.onkeydown = function(e) {			if(window.event)				e = window.event;			window.myDesktop.KeyPressEvent(e);		}	else		document.onkeypress = function(e) {			if(window.event)				e = window.event;			window.myDesktop.KeyPressEvent(e);		}}Desktop.prototype.UnsetEvents = function() {	document.onkeypress = function() {}}Desktop.prototype.ShowErrorConsole = function() {	if(!this.errorConsole) {		this.errorConsole = new Desktop_ErrorConsole(this);		this.Update();	}}Desktop.prototype.HideErrorConsole = function() {	this.errorConsole = null;	this.Update();}Desktop.prototype.zIndexAdd = function(id) {	if(JS_DebugMode&&this.zIndexVerboseErrors)		this.errorConsole.Add("zIndexAdd Call: "+id);	this.zIndexStack.push(id);}Desktop.prototype.zIndexDelete = function(id) {	var i=0;	for(i=0;i<this.zIndexStack.length;i++)		if(this.zIndexStack[i] == id) {			this.zIndexStack.splice(i,1);		}	if(JS_DebugMode&&this.zIndexVerboseErrors)		this.errorConsole.Add("zIndexDelete Call: "+id+", zIndexStackLength: "+this.zIndexStack.length);}Desktop.prototype.zIndexMoveToFront = function(id) {	var found = false;	for(i=0;i<this.zIndexStack.length;i++)		if(this.zIndexStack[i] == id) {			this.zIndexStack.splice(i,1);			found = true;		}	if(found)		this.zIndexStack.push(id);	if(JS_DebugMode&&this.zIndexVerboseErrors) {		this.errorConsole.Add("zIndexMoveToFront Call.  zIndexStack.length: "+this.zIndexStack.length);	}}Desktop.prototype.zIndexUpdate = function() {	if(this.zIndexStack.length>0) {		var i=0,thisWindow,str="";		for(i=0;i<this.zIndexStack.length;i++) {			thisWindow = this.GetWindowById(this.zIndexStack[i]);			if(thisWindow!=false) {				thisWindow.zIndex = i+3+this.zIndexBase;				thisWindow.elm.style.zIndex = thisWindow.zIndex;				if(JS_DebugMode&&this.zIndexVerboseErrors) {					str = str.concat(thisWindow.id+": "+thisWindow.zIndex+", ");					//thisWindow.titleBar.text = thisWindow.id+": "+thisWindow.zIndex;				}			} else {				if(JS_DebugMode && this.zIndexVerboseErrors) {					this.errorConsole.Add("<span style=\"color:red\">ZIndex Error: i="+i+", zindstack[i] = "+this.zIndexStack[i]+						", windows.length: "+this.windows.length+", zindStack.length: "+this.zIndexStack.length+"</span");				}			}		}		if(JS_DebugMode&&this.zIndexVerboseErrors)			this.errorConsole.Add("zIndexUpdate Call: "+str);	}}function Desktop_ErrorConsole(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myself = this;	this.size = new Coordinates(this.Parent.browserWindow.size.x,200);	this.position = new Coordinates(0,0);	this.errors = new Array();	this.printedErrors = 0;	this.SetEvents();	this.Paint();}Desktop_ErrorConsole.prototype = new Control(this.Parent);Desktop_ErrorConsole.prototype.GetType = function() {	return "Desktop_ErrorConsole"	}Desktop_ErrorConsole.prototype.SetStyles = function() {	this.size.x = this.Parent.browserWindow.size.x;	this.Parent.browserWindow.size.y -= this.size.y;	this.position.y = this.Parent.browserWindow.size.y;		this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.backgroundColor = "white";	this.elm.style.borderTop = "1px solid black";	this.elm.style.overflow = "scroll";}Desktop_ErrorConsole.prototype.SetEvents = function() {	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		try {			this.Parent.HideAllMenus();		}		catch(e) {			}		this.myself.MoveWindowsToBack();	}}Desktop_ErrorConsole.prototype.Paint = function() {	this.SetStyles();	document.body.appendChild(this.elm);}Desktop_ErrorConsole.prototype.PrintErrors = function() {	var i;	var oldIHTML = this.elm.innerHTML;	for(i=this.errors.length-1;i>=this.printedErrors;i--) {		//oldIHTML = oldIHTML.concat(this.errors[i]+"<br />");		oldIHTML = i+": "+this.errors[i]+"<br />"+oldIHTML;	}	this.printedErrors++;	this.elm.innerHTML = oldIHTML;}Desktop_ErrorConsole.prototype.Add = function(str) {	if(!window.myDesktop.errorConsole)		window.myDesktop.ShowErrorConsole();	this.errors.push(str);	this.PrintErrors();}function Window(Parent) {	this.Parent=Parent;	this.position = new Coordinates(100+(this.Parent.windows.length*30),100+(this.Parent.windows.length*30));	this.size = new Coordinates(500,300);	this.border = JSTheme.windowBorder;	this.bgColor = JSTheme.windowBackgroundColor;	this.iconGrid = null;	this.zIndex = 2;	this.resizeable = true;	this.initiallyHidden = false;	this.closeButton = true;	this.disableTransparency = false;	//if(this.getInternetExplorerVersion() > 0)		//this.disableTransparency = true;	this.isActive = true;	this.isMoving = false;	this.isPainted = false;	this.mouseOffset = new Coordinates(0,0); //used while window is moving	this.newMousePos = new Coordinates(0,0);	this.originalSize = new Coordinates(0,0); //used while window is resizing	this.originalPosition = new Coordinates(0,0); //used while window is resizing	this.oldSize = this.size; //used to return window from maximized state	this.oldPosition = this.position;	this.minimumSize = new Coordinates(100,100);	this.resizeFunctions = new Array();	this.menuBar = null;	this.toolBar = null;	this.statusBar = null;	this.elm = this.newDiv();	this.elm.myself = this;	this.titleBar = new TitleBar(this,this);	this.resizeGrabbers = new ResizeGrabbers(this);	this.windowContent = this.newDiv();	this.windowContent.myWindow = this;	this.windowContentSize = new Coordinates(0,0);	this.contentItems = new Array();	this.id = 0;	this.elm.appendChild(this.titleBar.elm);	this.elm.appendChild(this.windowContent);	this.SetEvents();			}Window.prototype = new Control(this.Parent);Window.prototype.Move = function() {	if(this.isMoving&&!this.isMaximized) {		this.MoveWindowsToBack(this.id);		this.MakeActive();		if(this.getInternetExplorerVersion()>0) {			document.onmousemove = this.IEmove;			}		else {			window.onmousemove = function(event) { 				event.cancelBubble = true;				if(!window.movingWindow.disableTransparency)					//FadeOut(window.movingWindow.elm,7);					setOpacity(window.movingWindow.elm,7);				window.movingWindow.position = new Coordinates((event.clientX - window.movingWindow.mouseOffset.x),					(event.clientY - window.movingWindow.mouseOffset.y));				//window.movingWindow.SetStyles();				window.movingWindow.UpdatePosition();			};		}	}	else		window.onmousemove = function() {};}Window.prototype.IEmove = function(ev) {  // because Internet Explorer is *special*	try {		window.event.cancelBubble = true;		if(window.movingWindow.isMoving) {			if(!window.movingWindow.disableTransparency)				FadeOut(window.movingWindow.elm,7);			var IECurrentMouse = new Coordinates(event.clientX,event.clientY);			window.movingWindow.position = new Coordinates((IECurrentMouse.x - window.movingWindow.mouseOffset.x),				(IECurrentMouse.y - window.movingWindow.mouseOffset.y));			//window.movingWindow.SetStyles();			window.movingWindow.UpdatePosition();		}	}	catch(e) {		//alert("IEMove"+e);	}}Window.prototype.GetType=function(){	return "Window"}Window.prototype.UpdatePosition = function() {	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	if(this.menuBar)		this.menuBar.UpdateLefts();}Window.prototype.UpdateSize = function() {	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";}Window.prototype.SetStyles = function(chain) {	if(chain==null || chain==undefined)		chain = true;	if(this.isMaximized) {		this.size = this.Parent.browserWindow.size;	}	if(this.menuBar==null)		var menuBarHeight = 0;	else		var menuBarHeight = this.menuBar.height+1;	if(this.toolBar!=null)		menuBarHeight += this.toolBar.height+2;	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	this.elm.style.zIndex = this.zIndex;	this.elm.style.backgroundColor = this.bgColor;	this.windowContent.style.top = (this.titleBar.height+menuBarHeight+2)+"px";	this.windowContent.style.left = this.border.width+"px";	this.windowContentSize.x = this.size.x-(this.border.width*2);	this.windowContentSize.y = this.size.y - this.titleBar.height - menuBarHeight - this.border.width;	if(this.statusBar!=null)		this.windowContentSize.y -= this.statusBar.height;	this.windowContent.style.width = this.windowContentSize.x+"px";	this.windowContent.style.height = this.windowContentSize.y+"px";	this.titleBar.SetStyles();	this.resizeGrabbers.SetStyles();	if(chain) {		if(this.myApp)			this.myApp.SetStyles();	}	if(this.menuBar)		this.menuBar.UpdateLefts();	if(this.toolBar)		this.toolBar.SetStyles();	if(this.statusBar)		this.statusBar.SetStyles();	if(this.myDialog)		if(this.myDialog.modal) {			this.myDialog.modalDiv.style.height = window.myDesktop.size.y+"px";			this.myDialog.modalDiv.style.width = window.myDesktop.size.x+"px";			this.myDialog.modalDiv.style.top = "0px";			this.myDialog.modalDiv.style.left = "0px";			this.myDialog.modalDiv.style.zIndex = 29;			this.myDialog.modalDiv.onmousedown = function(e) {				if(window.event)					e = window.event;				e.cancelBubble = true;			}			window.myDesktop.elm.appendChild(this.myDialog.modalDiv);		}}Window.prototype.KillMe = function() {	window.myDesktop.KillWindow(this);}Window.prototype.ActuallyResize = function(myEvent,myGrabber) {	window.myDesktop.HideAllMenus();	var i;	this.mouseOffset = new Coordinates(myEvent.clientX,myEvent.clientY);	this.originalSize = this.size;	this.originalPosition = this.position;	if(myGrabber.direction.x == 1)		this.resizeFunctions.push(this.MoveRight);	if(myGrabber.direction.x == -1)		this.resizeFunctions.push(this.MoveLeft);	if(myGrabber.direction.y == 1)		this.resizeFunctions.push(this.MoveBottom);	if(myGrabber.direction.y == -1)		this.resizeFunctions.push(this.MoveTop);	window.movingWindow = this;	if(this.getInternetExplorerVersion()>0)		this.Parent.elm.onmousemove = function() {			var i=0;			window.movingWindow.newMousePos = new Coordinates(event.clientX,event.clientY);			for(i=0;i<window.movingWindow.resizeFunctions.length;i++)				window.movingWindow.resizeFunctions[i]();		}	else		this.Parent.elm.onmousemove = function(event) {			var i=0;			window.movingWindow.newMousePos = new Coordinates(event.clientX,event.clientY);			for(i=0;i<window.movingWindow.resizeFunctions.length;i++)				window.movingWindow.resizeFunctions[i]();		}}Window.prototype.Resize = function(event) {	event.cancelBubble = true;	if(!this.myself.Parent.Parent.isMaximized&&this.myself.Parent.Parent.resizeable) {		this.myself.Parent.Parent.Parent.elm.onmouseup = this.myself.Parent.Parent.StopResize;		this.myself.Parent.Parent.ActuallyResize(event,this.myself);	}}Window.prototype.IEResize = function() {	event.cancelBubble = true;	if(!this.myself.Parent.Parent.isMaximized&&this.myself.Parent.Parent.resizeable) {		this.myself.Parent.Parent.Parent.elm.onmouseup = this.myself.Parent.Parent.StopResize;		this.myself.Parent.Parent.ActuallyResize(event,this.myself);	}}Window.prototype.MoveRight = function() {	var difference = window.movingWindow.newMousePos.x - window.movingWindow.mouseOffset.x;	var newSize = window.movingWindow.originalSize.x + difference;	if(newSize<window.movingWindow.minimumSize.x) difference-= newSize-window.movingWindow.minimumSize.x;	window.movingWindow.size = new Coordinates(window.movingWindow.originalSize.x + difference,window.movingWindow.size.y);	window.movingWindow.SetStyles();}Window.prototype.MoveLeft = function() {	var difference = window.movingWindow.newMousePos.x - window.movingWindow.mouseOffset.x;	var newSize = window.movingWindow.originalSize.x - difference;	if(newSize<window.movingWindow.minimumSize.x) difference+= newSize-window.movingWindow.minimumSize.x;	window.movingWindow.size = new Coordinates(window.movingWindow.originalSize.x - difference,window.movingWindow.size.y);	window.movingWindow.position = new Coordinates(window.movingWindow.originalPosition.x + difference,window.movingWindow.position.y);	window.movingWindow.SetStyles();}Window.prototype.MoveBottom = function() {	var difference = window.movingWindow.newMousePos.y - window.movingWindow.mouseOffset.y;	var newSize = window.movingWindow.originalSize.y + difference;	if(newSize<window.movingWindow.minimumSize.y) difference-= newSize-window.movingWindow.minimumSize.y;	window.movingWindow.size = new Coordinates(window.movingWindow.size.x,window.movingWindow.originalSize.y+difference);	window.movingWindow.SetStyles();}Window.prototype.MoveTop = function() {	var difference = window.movingWindow.newMousePos.y - window.movingWindow.mouseOffset.y;	var newSize = window.movingWindow.originalSize.y - difference;	if(newSize<window.movingWindow.minimumSize.y) difference += newSize-window.movingWindow.minimumSize.y;	window.movingWindow.size = new Coordinates(window.movingWindow.size.x,window.movingWindow.originalSize.y-difference);	window.movingWindow.position = new Coordinates(window.movingWindow.position.x,window.movingWindow.originalPosition.y+difference);	window.movingWindow.SetStyles();}Window.prototype.StopResize = function() {	//delete(window.movingWindow.resizeFunctions);	if(window.movingWindow) {		window.movingWindow.resizeFunctions = null;		window.movingWindow.resizeFunctions = new Array();		window.movingWindow.Parent.elm.onmousemove = function() {}		window.movingWindow.Parent.elm.onmouseup = function() {}		window.movingWindow = null;	}}Window.prototype.Maximize = function(myWindow) {	if(myWindow!=null) {		if(myWindow.size) {			var elm = myWindow;		} else			var elm = this.myself.Parent;	} else		var elm = this.myself.Parent;	if(elm.resizeable) {		if(elm.isMaximized) {			elm.isMaximized = false;			elm.position = elm.oldPosition;			elm.size = elm.oldSize;			if(JSTheme.maximizeButtonImage==null)				elm.titleBar.maximizeButton.text = "M";			elm.SetStyles();		} else {			elm.isMaximized = true;			elm.oldPosition = elm.position;			elm.oldSize = elm.size;			elm.position = new Coordinates(0,0);			elm.size = window.myDesktop.browserWindow.size;			if(JSTheme.maximizeButtonImage==null)				elm.titleBar.maximizeButton.text = "m";			elm.SetStyles();		}	}}Window.prototype.AddMenuBar = function() {	var newMenuBar = new MenuBar(this);	this.elm.appendChild(newMenuBar.elm);	newMenuBar.SetStyles();	this.contentItems.push(newMenuBar);	this.menuBar = newMenuBar;	return newMenuBar;}Window.prototype.SetEvents = function() {	if(this.getInternetExplorerVersion()>0) {		this.elm.onmousedown = function() {			event.cancelBubble = true;			this.myself.MakeActive();		}			} else {		this.elm.onmousedown = function(event) {			event.cancelBubble = true;			this.myself.MakeActive();		}			}	this.windowContent.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		window.myDesktop.HideAllMenus();		this.myWindow.MakeActive();	}}Window.prototype.MakeActive = function() {	window.myDesktop.isActive = false;	this.isActive = true;	window.myDesktop.activeWindow = this;	this.MoveWindowsToBack(this.id);	//this.zIndex = 3;	if(this.isPainted) {		window.myDesktop.zIndexMoveToFront(this.id);		window.myDesktop.zIndexUpdate();	}	this.titleBar.color = this.titleBar.normalColor;	this.titleBar.textColor = this.titleBar.normalTextColor;	this.SetStyles(false);}Window.prototype.MakeInactive = function() {	//this.zIndex = 2;	this.isActive = false;	this.titleBar.color = this.titleBar.inactiveColor;	this.titleBar.textColor = this.titleBar.inactiveTextColor;	this.SetStyles(false);}Window.prototype.AddToolBar = function() {	this.toolBar = new Toolbar(this);	this.contentItems.push(this.toolBar);	this.toolBar.Paint();	return this.toolBar;}Window.prototype.AddStatusBar = function() {	this.statusBar = new StatusBar(this);	this.contentItems.push(this.statusBar);	this.statusBar.Paint();	return this.statusBar;}Window.prototype.SetSizeRelativeToDesktop = function(percent) {	try {		if(percent > 1)			percent = percent*.01;		this.size.x = Math.round(window.myDesktop.browserWindow.size.x*percent);		this.size.y = Math.round(window.myDesktop.browserWindow.size.y*percent);	} catch(e) {		alert("SetSizeRelativeToDesktop: "+e);	}}Window.prototype.CenterWindowOnDesktop = function() {	try {				if(this.size.y>0 && this.size.x>0) {			this.position.y = Math.round(window.myDesktop.browserWindow.size.y/2) - Math.round(this.size.y/2);			this.position.x = Math.round(window.myDesktop.browserWindow.size.x/2) - Math.round(this.size.x/2);		}	} catch(e) {		alert("Center Window On Desktop: "+e);	}}function TitleBar(myWindow,Parent) {	this.Parent=Parent;	this.myWindow = myWindow;	this.text = "New Window";	this.normalColor = JSTheme.titleBarActiveColor;	this.inactiveColor = JSTheme.titleBarInactiveColor;	this.normalTextColor = JSTheme.titleBarActiveText;	this.inactiveTextColor = JSTheme.titleBarInactiveText;	this.color = this.normalColor;	this.textColor = this.normalTextColor;	this.font = JSTheme.titleBarFont.family;	this.fontSize = JSTheme.titleBarFont.size;	this.fontWeight = JSTheme.titleBarFont.weight;	this.alignment = "center";	this.height = JSTheme.titleBarHeight;	this.closeButton = new Button("X",this,JSTheme.closeButtonImage,JSTheme.closeButtonSize);	this.maximizeButton = new Button("M",this,JSTheme.maximizeButtonImage,JSTheme.maximizeButtonSize);	this.maximizeDrawn = false; //false until drawn.  if window.resizeable is set to false, maximize button won't draw	this.elm = document.createElement("div");	this.elm.myself = this;	this.Parent.elm.appendChild(this.closeButton.elm);	this.paddingTop = parseInt(this.height / 2) - parseInt(this.fontSize / 2)-2;	if(JSTheme.titleBarTextBackground && JSTheme.titleBarPadding==null)		this.paddingTop -= 4;	else		if(JSTheme.titleBarPadding) {			this.paddingTop += JSTheme.titleBarPadding;		}	this.SetEvents();}TitleBar.prototype = new Control(this.Parent);TitleBar.prototype.GetType=function(){	return "TitleBar";}TitleBar.prototype.SetEvents = function() {		this.elm.onmousedown = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;			window.myDesktop.HideAllMenus();			this.myself.Parent.isMoving = true;			window.movingWindow = this.myself.Parent;			this.myself.Parent.mouseOffset = new Coordinates((e.clientX - this.myself.Parent.position.x),				(e.clientY - this.myself.Parent.position.y));			this.myself.Parent.Move(e);		}		this.elm.onmouseup = function(e) {			if(window.event)				e = window.event;			this.myself.Parent.isMoving = false;			if(window.movingWindow) {				setOpacity(window.movingWindow.elm,10);				window.movingWindow = null;			}						this.myself.Parent.Move(e);			if(!this.myself.Parent.disableTransparency)				FadeIn(this.myself.Parent.elm,10);		}	this.elm.ondblclick = this.Parent.Maximize;	if(isiPhone)		this.elm.onclick = this.Parent.Maximize;	this.closeButton.elm.onclick = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		this.myWindow.KillMe();	}	this.closeButton.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(JSTheme.closeButtonImagePressed) {			this.style.backgroundImage = "url("+JSTheme.closeButtonImagePressed+")";		}	}	this.closeButton.elm.onmouseout = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(JSTheme.closeButtonImagePressed) {			this.style.backgroundImage = "url("+JSTheme.closeButtonImage+")";		}	}	this.closeButton.elm.onmouseup = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(JSTheme.closeButtonImagePressed) {			this.style.backgroundImage = "url("+JSTheme.closeButtonImage+")";		}	}	if(this.getInternetExplorerVersion()>0) {		this.maximizeButton.elm.onmouseup = function(e) {			window.event.cancelBubble = true;			this.myWindow.Maximize(this.myWindow);			if(JSTheme.maximizeButtonImagePressed) {				this.style.backgroundImage = "url("+JSTheme.maximizeButtonImage+")";			}		}	} else {		this.maximizeButton.elm.onclick = function(e) {			if(window.event)				var e = window.event;			e.cancelBubble = true;			this.myWindow.Maximize(this.myWindow);			if(JSTheme.maximizeButtonImagePressed) {				this.style.backgroundImage = "url("+JSTheme.maximizeButtonImage+")";			}		}	}	this.maximizeButton.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(JSTheme.maximizeButtonImagePressed) {			this.style.backgroundImage = "url("+JSTheme.maximizeButtonImagePressed+")";		}	}	this.maximizeButton.elm.onmouseout = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(JSTheme.maximizeButtonImagePressed) {			this.style.backgroundImage = "url("+JSTheme.maximizeButtonImage+")";		}	}}TitleBar.prototype.SetStyles = function() {	this.elm.style.backgroundColor = this.color;	if(JSTheme.titleBarBGImage)		this.elm.style.backgroundImage = "url("+JSTheme.titleBarBGImage+")";	this.elm.style.color = this.textColor;	this.elm.style.fontFamily = this.font;	this.elm.style.fontSize = this.fontSize+"px";	this.elm.style.fontWeight = this.fontWeight;	this.elm.align = this.alignment;	var start = "";	var finish = "";	if(JSTheme.titleBarTextBackground!=null) {		start = "<font style=\"background-color: "+JSTheme.titleBarTextBackground+";\">&nbsp;"		finish = "&nbsp;</font>";	}	this.elm.innerHTML = start+this.text+finish;		this.elm.style.top = this.Parent.border.width+"px";	this.elm.style.left = this.Parent.border.width+"px";	this.elm.style.width = (this.Parent.size.x - (this.Parent.border.width*2))+"px";	this.elm.style.height = (this.height - this.paddingTop)+"px";	this.elm.style.overflow="hidden";	this.elm.style.paddingTop = this.paddingTop+"px";	this.elm.style.position = "absolute";	this.elm.style.zIndex = "2";	this.elm.style.MozUserSelect = "none";	this.disableSelection(this.elm);	if(this.Parent.closeButton) {		this.closeButton.elm.myWindow = this.myWindow;		this.closeButton.elm.style.zIndex = "3";		this.closeButton.elm.style.position = "absolute";		this.closeButton.elm.style.top = (this.Parent.border.width+2)+"px";		this.closeButton.elm.style.left = (this.Parent.size.x - this.closeButton.size - this.Parent.border.width-5)+"px";		this.closeButton.elm.style.width=this.closeButton.size+"px";		if(JSTheme.closeButtonImage) {			this.closeButton.elm.style.height = this.closeButton.size+"px";			this.closeButton.elm.style.border = "0";			this.closeButton.elm.style.backgroundColor = "transparent";			this.closeButton.elm.style.top = (parseInt(this.closeButton.elm.style.top) + 2)+"px";		}	}		if(this.Parent.resizeable) {		if(!this.maximizeDrawn)			this.Parent.elm.appendChild(this.maximizeButton.elm);		this.maximizeButton.elm.style.left = (this.Parent.size.x - this.closeButton.size - this.Parent.border.width -			this.maximizeButton.size - 10)+"px";		this.maximizeButton.elm.style.width = this.maximizeButton.size+"px";		this.maximizeButton.elm.style.zIndex = "3";		this.maximizeButton.elm.style.position = "absolute";		this.maximizeButton.elm.style.top = (this.Parent.border.width+2)+"px";		this.maximizeButton.elm.myWindow = this.Parent;		this.maximizeButton.elm.style.textAlign = "center";		this.maximizeButton.elm.value = this.maximizeButton.text;		if(JSTheme.maximizeButtonImage) {			this.maximizeButton.elm.style.height = this.maximizeButton.size+"px";			this.maximizeButton.elm.style.border = "0";			this.maximizeButton.elm.style.backgroundColor = "transparent";			this.maximizeButton.elm.style.top = (parseInt(this.maximizeButton.elm.style.top) + 2)+"px";		}	}	}function ResizeGrabbers(Parent) {	this.Parent=Parent;		this.left = new Grabber(this);	this.right = new Grabber(this);	this.bottom = new Grabber(this);	this.top = new Grabber(this);	if(JSTheme.borderTopBGImage)		this.top.elm.style.backgroundImage = "url("+JSTheme.borderTopBGImage+")";	if(JSTheme.titleBarSideBGImageLeft) {		this.left.elm.style.backgroundImage = "url("+JSTheme.titleBarSideBGImageLeft+")";		this.right.elm.style.backgroundImage = "url("+JSTheme.titleBarSideBGImageRight+")";		this.left.elm.style.backgroundRepeat = "no-repeat";		this.right.elm.style.backgroundRepeat = "no-repeat";	}	this.bottomRight = new Grabber(this);	this.bottomLeft = new Grabber(this);	this.topRight = new Grabber(this);	this.topLeft = new Grabber(this);	this.left.direction = new Coordinates(-1,0);	this.right.direction = new Coordinates(1,0);	this.bottom.direction = new Coordinates(0,1);	this.top.direction = new Coordinates(0,-1);	this.bottomRight.direction = new Coordinates(1,1);	this.bottomRight.bgColor = "transparent";	this.bottomLeft.direction = new Coordinates(-1,1);	this.bottomLeft.bgColor = "transparent";	this.topRight.direction = new Coordinates(1,-1);	this.topRight.bgColor = "transparent";	this.topLeft.direction = new Coordinates(-1,-1);	this.topLeft.bgColor = "transparent";		this.Paint();}ResizeGrabbers.prototype = new Control(this.Parent);ResizeGrabbers.prototype.GetType = function() {	return "ResizeGrabbers"	}ResizeGrabbers.prototype.SetStyles = function() {	this.left.position = new Coordinates(0,0);	this.left.size = new Coordinates(this.Parent.border.width,this.Parent.size.y);	this.right.position = new Coordinates(this.Parent.size.x - this.Parent.border.width,0);	this.right.size = new Coordinates(this.Parent.border.width, this.Parent.size.y);	this.bottom.position = new Coordinates(0,this.Parent.size.y - this.Parent.border.width);	this.bottom.size = new Coordinates(this.Parent.size.x,this.Parent.border.width);	this.top.position = new Coordinates(0,0);	this.top.size = new Coordinates(this.Parent.size.x,this.Parent.border.width);	this.bottomRight.position = new Coordinates(this.Parent.size.x-10,this.Parent.size.y-10);	this.bottomRight.size = new Coordinates(10,10);	this.bottomLeft.position = new Coordinates(0,this.Parent.size.y-10);	this.bottomLeft.size = new Coordinates(10,10);	this.topRight.position = new Coordinates(this.Parent.size.x-10,0);	this.topRight.size = new Coordinates(10,10);	this.topLeft.position = new Coordinates(0,0);	this.topLeft.size = new Coordinates(10,10);	this.left.SetStyles();	this.right.SetStyles();	this.bottom.SetStyles();	this.top.SetStyles();	this.bottomRight.SetStyles();	this.bottomLeft.SetStyles();	this.topRight.SetStyles();	this.topLeft.SetStyles();	if(this.Parent.resizeable) {		this.left.elm.style.cursor = "w-resize";		this.right.elm.style.cursor = "e-resize";		this.bottom.elm.style.cursor = "s-resize";		this.top.elm.style.cursor = "n-resize";		this.bottomRight.elm.style.cursor = "se-resize";		this.bottomLeft.elm.style.cursor = "sw-resize";		this.topRight.elm.style.cursor = "ne-resize";		this.topLeft.elm.style.cursor = "nw-resize";	}}ResizeGrabbers.prototype.Paint = function() {	this.Parent.elm.appendChild(this.left.elm);	this.Parent.elm.appendChild(this.right.elm);	this.Parent.elm.appendChild(this.bottom.elm);	this.Parent.elm.appendChild(this.top.elm);	this.Parent.elm.appendChild(this.bottomRight.elm);	this.Parent.elm.appendChild(this.bottomLeft.elm);	this.Parent.elm.appendChild(this.topRight.elm);	this.Parent.elm.appendChild(this.topLeft.elm);}function Grabber(Parent) {	this.Parent = Parent;	this.position = new Coordinates(0,0);	this.size = new Coordinates(0,0);	this.bgColor = this.Parent.Parent.border.color;	this.elm = this.newDiv();	this.direction = new Coordinates(0,0);	this.elm.myself = this;	this.SetEvents();}Grabber.prototype = new Control(this.Parent);Grabber.prototype.GetType = function() {	return "Grabber"	}Grabber.prototype.SetStyles = function() {	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	this.elm.style.backgroundColor = this.bgColor;	this.elm.style.zIndex = "4";}Grabber.prototype.SetEvents = function() {	this.elm.onmouseup = this.Parent.Parent.StopResize;	if(this.getInternetExplorerVersion()>0)		this.elm.onmousedown = this.Parent.Parent.IEResize;	else		this.elm.onmousedown = this.Parent.Parent.Resize;}function Button(text,Parent,imageURL,size) {	this.Parent=Parent;	if(imageURL==null)		this.text = text;	else		this.text = "";	this.imageURL = null;	if(imageURL!=null)		this.imageURL = imageURL;	this.elm = document.createElement("input");	this.elm.type = "button";	this.elm.myself = this;	this.enableColor = "black";	this.disableColor = "gray";	if(JSTheme.buttonFont)		JSTheme.buttonFont.ApplyFont(this.elm);	if(this.imageURL) {		this.elm.style.backgroundImage = "url("+this.imageURL+")";		this.elm.style.backgroundRepeat = "no-repeat";	}	else {		this.elm.value = text;	}	if(size!=null)		this.size = size;	else		this.size = null;	if(this.size)		this.elm.style.width=this.size+"px";}Button.prototype = new Control(this.Parent);Button.prototype.GetType = function() {	return "Button";	}Button.prototype.SetEvents = function() {	if(this.handler)		this.elm.onclick = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;			if(this.myself)				this.myself.handler();		}}Button.prototype.Enable = function() {	this.elm.disabled = false;	this.elm.style.color = this.enableColor;}Button.prototype.Disable = function() {	this.elm.disabled = true;	this.elm.style.color = this.disableColor;}Button.prototype.SetLabel = function(label) {	this.elm.value = label;}Button.prototype.SetFocus = function() {	this.elm.focus();	}Button.prototype.SetToolTip = function(tooltip) {	this.elm.title = tooltip;}Button.prototype.SetText = function(text) {	this.text = text;	this.elm.value = text;}function BrowserWindow(Parent) {	this.Parent=Parent;	BrowserWindow.prototype = new Control(this.Parent);	this.size = new Coordinates;		this.Update = function() {		var myHeight = 0;		var myWidth = 0;		if( typeof( window.innerWidth ) == 'number' ) {			//Non-IE			myHeight = window.innerHeight;			myWidth = window.innerWidth;		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {			//IE 6+ in 'standards compliant mode'			myHeight = document.documentElement.clientHeight;			myWidth = document.documentElement.clientWidth;		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {			//IE 4 compatible			myHeight = document.body.clientHeight;			myWidth = document.body.clientWidth;		}		this.size.x = myWidth;		this.size.y = myHeight;	}		this.Update();}function MenuBar(Parent) {	this.Parent = Parent;		this.menus = new Array();	this.elm = this.newDiv();	this.elm.myWindow = this.Parent;	this.height = 25;	this.bgColor = JSTheme.menuBarBackground;	this.menuHighlightColor = JSTheme.menuHighlightColor;	this.borderBottom = JSTheme.menuBarBottomBorder;	this.font = JSTheme.menuBarFont;	this.containerTable;	this.tableRow = this.MakeContainerTable();	this.tableCells = new Array();	this.elm.appendChild(this.containerTable);	this.menuIsActive = false;	this.SetEvents();}MenuBar.prototype = new Control(this.Parent);MenuBar.prototype.GetType = function() {	return "MenuBar"	}MenuBar.prototype.SetStyles = function() {	var i=0;	this.elm.style.width = "100%";	this.elm.style.overflow = "visible";	this.elm.style.height = (this.height+1)+"px";	this.elm.style.paddingBottom = "1px";	this.elm.style.backgroundColor = this.bgColor;	this.elm.style.left = "0px";	this.elm.style.top = this.Parent.titleBar.height+"px";	this.elm.style.borderBottom = this.borderBottom.CSS();	this.elm.style.textAlign = "left";	for(i=0;i<this.menus.length;i++)		this.menus[i].SetStyles();}MenuBar.prototype.SetEvents = function() {	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		window.myDesktop.HideAllMenus();		this.myWindow.MakeActive();	}}MenuBar.prototype.MakeContainerTable = function() {	this.containerTable = document.createElement("table");	this.containerTable.style.margin = "0";	this.containerTable.style.padding = "0";	this.containerTable.cellpadding = "0";	this.containerTable.cellspacing = "0";	this.containerTable.border = "0";	this.containerTable.style.border = "0";	var newTBody = document.createElement("tbody");	var newRow = document.createElement("tr");	newTBody.style.margin = "0";	newTBody.style.padding = "0";	newRow.style.margin = "0";	newRow.style.padding = "0";	this.containerTable.appendChild(newTBody);	newTBody.appendChild(newRow);	return newRow;}MenuBar.prototype.AddMenu = function(name) {	var newMenu = new DropDownMenu(this);	newMenu.name = name;	var newCell = document.createElement("td");	newCell.align="center";	newCell.style.verticalAlign = "middle";	newCell.appendChild(newMenu.elm);	newCell.style.margin = "0";	newCell.style.padding = "0"; 	this.menus.push(newMenu);	newMenu.id = this.menus.length-1;	this.tableCells.push(newCell);	this.tableRow.appendChild(newCell);	return newMenu;}MenuBar.prototype.HideMenusExcept = function(id) {	var i;	for(i=0;i<this.menus.length;i++) {		if(i!=id) {			this.menus[i].HideMenu();			this.menus[i].elm.style.backgroundColor = this.bgColor;			this.menus[i].elm.style.color = "black";		}	}}MenuBar.prototype.UpdateLefts = function() {	var i;	for(i=0;i<this.menus.length;i++)		this.menus[i].UpdateLeft();}function DropDownMenu(Parent) {	this.Parent = Parent;	this.items = new Array();	this.itemHeight = 20;	this.name = "Menu";	this.elm = this.newDiv();	this.elm.myself = this;	this.itemContainer = this.newDiv();		//this.Parent.Parent.elm.appendChild(this.itemContainer);	window.myDesktop.elm.appendChild(this.itemContainer);	this.SetEvents();	this.width = 175;	this.menuActive = false;	this.id = 0;}DropDownMenu.prototype = new Control(this.Parent);DropDownMenu.prototype.GetType = function() {	return "DropDownMenu"	}DropDownMenu.prototype.SetStyles = function() {	this.elm.align="center";	this.elm.innerHTML = this.name;	if(this.Parent.menus.length==1)		this.elm.style.paddingLeft = "2px";	else		this.elm.style.paddingLeft = "5px";	this.elm.style.position = "relative";	this.elm.style.overflow = "hidden";	this.elm.style.paddingRight = "5px";	this.elm.style.paddingTop = "5px";	this.elm.style.margin = "0";	this.elm.style.height = (this.Parent.height - 5)+"px";	this.elm.style.fontFamily = this.Parent.font.family;	this.elm.style.fontSize = this.Parent.font.size+"px";	this.elm.style.fontWeight = this.Parent.font.weight;	this.disableSelection(this.elm);	this.elm.style.MozUserSelect = "none";	this.itemContainer.style.top = (this.Parent.height+this.Parent.Parent.titleBar.height+2+this.Parent.Parent.position.y)+"px";	//this.itemContainer.style.left = "0px";	this.itemContainer.style.left = (this.elm.offsetLeft+this.Parent.Parent.position.x)+"px";	this.itemContainer.style.width = this.width+"px";	if(!this.originalWidth)		this.originalWidth = this.width;	this.itemContainer.style.height = (this.items.length*this.itemHeight+5)+"px";	this.itemContainer.style.border = "1px solid black";	this.itemContainer.style.backgroundColor = JSTheme.menuBackgroundColor;	this.itemContainer.style.zIndex = "150";	this.itemContainer.style.visibility = "hidden";		var i;	for(i=0;i<this.items.length;i++)		this.items[i].SetStyles();}DropDownMenu.prototype.UpdateLeft = function() {	this.itemContainer.style.top = (this.Parent.height+this.Parent.Parent.titleBar.height+2+this.Parent.Parent.position.y)+"px";	this.itemContainer.style.left = (this.elm.offsetLeft+this.Parent.Parent.position.x)+"px";}DropDownMenu.prototype.SetEvents = function() {	this.elm.onmouseover = function() {		if(!this.myself.Parent.Parent.isMoving) {			this.style.backgroundColor = this.myself.Parent.menuHighlightColor;			this.style.color = "white";			if(this.myself.Parent.menuIsActive) {				this.myself.Parent.HideMenusExcept(this.myself.id);				this.myself.ShowMenu();			}		}	}	this.elm.onmouseout = function() {		if(!this.myself.menuActive) {			this.style.backgroundColor = this.myself.Parent.bgColor;			this.style.color = this.myself.Parent.font.color;		}	}	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		this.myself.ToggleMenu();	}		this.elm.onmouseup = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;	}}DropDownMenu.prototype.ToggleMenu = function() {	var i;	for(i=0;i<this.Parent.menus.length;i++)		if(this.id!=i)			this.Parent.menus[i].HideMenu();	if(this.menuActive) {		this.HideMenu();		this.Parent.menuIsActive = false;	} else {		this.ShowMenu();	}}DropDownMenu.prototype.HideMenu = function () {	this.menuActive = false;	this.itemContainer.style.visibility = "hidden";	var i;	for(i=0;i<this.items.length;i++)		this.items[i].Clear();}DropDownMenu.prototype.ShowMenu = function() {	window.myDesktop.HideAllMenus(this.Parent.Parent.id);	this.SetHeight();	this.menuActive = true;	this.Parent.menuIsActive = true;	this.itemContainer.style.visibility = "visible";	this.Parent.Parent.MakeActive();}DropDownMenu.prototype.SetHeight = function() {	try {		if((this.items.length*this.itemHeight+5) > (window.myDesktop.size.y - this.Parent.Parent.position.y -			this.Parent.Parent.titleBar.height - this.Parent.height)) {			this.itemContainer.style.height = (window.myDesktop.size.y - this.Parent.Parent.position.y - this.Parent.height-35)+"px";			this.itemContainer.style.overflow = "auto";			this.itemContainer.style.width = (this.originalWidth + 20) + "px";		}		else {			this.itemContainer.style.height = (this.items.length*this.itemHeight+5)+"px";			this.itemContainer.style.overflow = "hidden";			this.itemContainer.style.width = this.originalWidth + "px";		}	} catch(e) {		alert("DropDownMenu.SetHeight: "+e);	}}DropDownMenu.prototype.AddItem = function(text,handler,shortcut) {	var newItem = new MenuItem(this);	newItem.text = text;	newItem.handler = handler;	newItem.shortcut = shortcut;	newItem.SetStyles();	this.itemContainer.appendChild(newItem.elm);	this.items.push(newItem);	return newItem;}DropDownMenu.prototype.AddDivider = function() {	var newDivider = new MenuDivider(this);	this.itemContainer.appendChild(newDivider.elm);	this.items.push(newDivider);}DropDownMenu.prototype.ClearMenu = function() {	while(this.itemContainer.childNodes.length > 0)		this.itemContainer.removeChild(this.itemContainer.childNodes[0]);	this.items = new Array();}function MenuItem(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myself = this;	this.myWindow = this.Parent.Parent.Parent;	this.handler = null;	this.shortcut = "";	this.text = "Menu Item";	this.font = JSTheme.menuItemFont;	this.font.color = null;	this.disabled = false;	this.position = new Coordinates(0,this.Parent.items.length*this.Parent.itemHeight);	this.itemText = new MenuItemText(this);}MenuItem.prototype = new Control(this.Parent);MenuItem.prototype.GetType = function() {	return "MenuItem"	}MenuItem.prototype.SetStyles = function() {	this.elm.style.width = (this.Parent.width-20)+"px";	this.elm.style.height = this.Parent.itemHeight+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	//this.elm.style.fontFamily = this.Parent.elm.style.fontFamily;	//this.elm.style.fontSize = this.Parent.elm.style.fontSize;	this.font.ApplyFont(this.elm);	this.elm.style.paddingTop = (Math.floor(this.Parent.itemHeight / 2) - 8)+"px";	this.elm.style.paddingLeft = "20px";	this.elm.style.height = (this.Parent.itemHeight - parseInt(this.elm.style.paddingTop)) +"px";	if(this.disabled)		this.CancelEvents();	else		this.SetEvents();	this.disableSelection(this.elm);	this.elm.style.MozUserSelect = "none";	this.itemText.SetStyles();}MenuItem.prototype.SetEvents = function() {	this.elm.onmouseover = function() {		this.style.backgroundColor = this.myself.Parent.Parent.menuHighlightColor;		this.myself.itemText.SetColor("white");	}	this.elm.onmouseout = function() {		this.myself.Clear();	}	this.elm.onmouseup = function(e) {		if(window.event)			e=window.event;		e.cancelBubble = true;		window.myDesktop.HideAllMenus();		try {			this.myself.handler();			} catch(e) {			//alert("MenuItem Handler: "+e);		}	}	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;	}}MenuItem.prototype.Clear = function() {	this.elm.style.backgroundColor = JSTheme.menuBackgroundColor;	if(this.disabled) {			this.elm.style.color = JSTheme.menuDisabledColor;			this.itemText.SetColor(JSTheme.menuDisabledColor);	} else {			this.elm.style.color = JSTheme.menuBarFont.color;			this.itemText.SetColor(JSTheme.menuBarFont.color);	}}MenuItem.prototype.CancelEvents = function () {	this.elm.onmouseover = function() {	}	this.elm.onmouseout = function() {	}	this.elm.onmouseup = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;	}}MenuItem.prototype.Disable = function() {	this.disabled = true;	this.SetStyles();	this.itemText.SetColor(JSTheme.menuDisabledColor);}MenuItem.prototype.Enable = function() {	this.disabled = false;	this.SetStyles();	this.itemText.SetColor(JSTheme.menuBarFont.color);}MenuItem.prototype.SetLabel = function(label) {	this.text = label;	this.itemText.commandCell.innerHTML = this.text;}function MenuItemText(Parent) {	this.Parent = Parent;	this.elm = document.createElement("table");	this.tbody = document.createElement("tbody");	this.row = document.createElement("tr");	this.commandCell = this.newTableCell();	this.shortcutCell = this.newTableCell();	this.Paint();}MenuItemText.prototype = new Control(this.Parent);MenuItemText.prototype.GetType = function() {	return "MenuItemText"	}MenuItemText.prototype.Paint = function() {	this.row.appendChild(this.commandCell);	this.row.appendChild(this.shortcutCell);	this.tbody.appendChild(this.row);	this.elm.appendChild(this.tbody);	this.Parent.elm.appendChild(this.elm);	this.elm.style.padding = "0";	this.elm.style.margin = "0";	this.elm.border = "0";	this.elm.style.border = "0";	this.elm.cellspacing = "0";	this.elm.cellpadding = "0";		this.Parent.font.ApplyFont(this.commandCell);	this.Parent.font.ApplyFont(this.shortcutCell);	this.commandCell.style.textAlign = "left";	this.shortcutCell.style.textAlign = "right";}MenuItemText.prototype.SetStyles = function() {	this.elm.style.width = (this.Parent.Parent.width-40)+"px";	this.commandCell.innerHTML = this.Parent.text;	if(this.Parent.shortcut&&this.getInternetExplorerVersion()==-1)		this.shortcutCell.innerHTML = this.Parent.shortcut;	/*if(this.Parent.disabled) {		this.commandCell.style.color = JSTheme.menuDisabledColor;	} else		this.commandCell.style.color = JSTheme.menuBarFont.color;*/	/*if(this.Parent.disabled)		this.shortcutCell.style.color = JSTheme.menuDisabledColor;	else		this.shortcutCell.style.color = JSTheme.menuBarFont.color;*/}MenuItemText.prototype.SetColor = function(color) {	this.commandCell.style.color = color;	this.shortcutCell.style.color = color;}function MenuDivider(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.hr = document.createElement("hr");	this.elm.appendChild(this.hr);	this.position = new Coordinates(0,this.Parent.items.length*this.Parent.itemHeight);	//this.SetStyles();}MenuDivider.prototype = new Control(this.Parent);MenuDivider.prototype.GetType = function() {	return "MenuDivider";	}MenuDivider.prototype.SetStyles = function() {	this.elm.align="center";	this.elm.style.paddingTop = (Math.floor(this.Parent.itemHeight / 2) - 8)+"px";	this.elm.style.width = "100%";	this.elm.align="center";	this.elm.style.height = (this.Parent.itemHeight - parseInt(this.elm.style.paddingTop))+"px";	//this.elm.style.top = (this.Parent.items.length*this.Parent.itemHeight)+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	this.hr.style.width = "80%";}MenuDivider.prototype.Clear = function() {}function Coordinates(x,y) {	this.x = x;	this.y = y;}function Border(Parent, width, style, color) {	this.Parent=Parent;	Border.prototype = new Control(this.Parent);	if(width!=null)		this.width = width;	else		this.width = "1";	if(style!=null)		this.style = style;	else		this.style = "solid";	if(color!=null)		this.color = color;	else		this.color = "black";		this.CSS = function() {		return this.width+"px "+this.style+" "+this.color;	}}function MakeInvisible(Element){	Element.style.display="none";	Element.style.visibility="hidden";	//Element.style.opacity = "";	}function MakeVisible(Element){	Element.style.display="";	Element.style.visibility="";	//Element.style.opacity = "";}function SelfDestruct(Element){	if (Element.parentNode)	{		Element.parentNode.removeChild(Element);	}}function setOpacity(Element,value){    if(Element!=null) {	Element.style.opacity = value/10;    Element.style.filter = 'alpha(opacity=' + value*10 + ')';	if (value< 1)	{		MakeInvisible(Element);		Element.style.filter = '';	}	else		if (value >= 10)		{			Element.style.filter = '';			MakeVisible(Element);		}		else			MakeVisible(Element);    }}function getOpacity(Element){	try {		return Element.style.opacity*10;	} catch(e) {		return 10;		}}function Icon(file,Parent) {	this.Parent = Parent;	this.file = file; //FileObject for this icon	this.icon = null; //customized icon	this.handler = null;	this.elm = this.newDiv();	this.divUnder = this.newDiv();	this.top;	this.left;	this.image="";	this.isSelected = false;	this.id = 0;	this.bgColor = "transparent";	this.border = new Border();	this.opacity = 10;	this.gridPosition = new Coordinates(0,0);	this.border.width = 0;	this.imageElm = document.createElement("img");	this.elm.appendChild(this.imageElm);	this.elm.myself = this;	this.text = "New Icon";	this.labelTop = 65;	this.shadow = true;	this.iconLabel = new IconLabel(this);	this.labelColor = JSTheme.iconLabelFont.color;	this.iconLabel.Paint();	this.SetEvents();}Icon.prototype = new Control(this.Parent);Icon.prototype.GetType = function() {	return "Icon"	}Icon.prototype.SetStyles = function() {	this.elm.style.width = this.Parent.gridSize.x+"px";	this.elm.style.height = this.Parent.gridSize.y+"px";	this.elm.style.top = this.top+"px";	this.elm.style.left = this.left+"px";	this.elm.style.overflow = "visible";	this.elm.align="center";	this.elm.style.zIndex = "1";	this.divUnder.style.width = this.Parent.gridSize.x+"px";	this.divUnder.style.height = this.Parent.gridSize.y+"px";	this.divUnder.style.border = this.border.CSS();	this.divUnder.style.backgroundColor = this.bgColor;	this.divUnder.style.top = (this.top-4)+"px";	this.divUnder.style.left = this.left+"px";	this.divUnder.style.zIndex = "0";	setOpacity(this.divUnder,this.opacity);	this.imageElm.style.width = "64px";	this.imageElm.style.height = "64px";	this.imageElm.src = this.image;	this.iconLabel.SetStyles();}Icon.prototype.Paint = function() {	this.iconLabel.Paint();	}Icon.prototype.SetEvents = function() {	if(this.getInternetExplorerVersion()>0) {		this.elm.onmousedown = function() {			event.cancelBubble = true;			window.myDesktop.HideAllMenus();			this.myself.Parent.DeselectAll(this.myself.id);			this.myself.Select();			}	} else {		this.elm.onmousedown = function(event) {			window.myDesktop.HideAllMenus();			event.cancelBubble = true;			this.myself.Parent.DeselectAll(this.myself.id);			this.myself.Select();			}	}	if(this.getInternetExplorerVersion()>0) {		this.elm.ondblclick = function() {			if(this.myself.handler!=null) {				try {					event.cancelBubble = true;					this.myself.handler();				} catch(e) {					alert(e+", Icon SetEvents ondblclick");				}			}		}	} else {		this.elm.ondblclick = function(event) {			if(this.myself.handler!=null) {				try {					event.cancelBubble = true;					this.myself.handler();				} catch(e) {					alert(e+", Icon SetEvents ondblclick nonIE");				}			}		}			}	if(isiPhone) {		this.elm.onclick = function(e) {			if(this.myself.handler!=null) {				try {					e.cancelBubble = true;					this.myself.handler();				} catch(e) {									}			}		}	}}Icon.prototype.Select = function() {	this.isSelected = true;	this.bgColor = "#575757";	this.border.width = 2;	this.border.color = "navy";	this.opacity = 5;	this.Parent.activeIcon = this.id;	this.Parent.Parent.isActive = true;	this.SetStyles();}Icon.prototype.Deselect = function() {	this.isSelected = false;	this.bgColor = "transparent";	this.border.width = 0;	this.opacity = 10;	this.SetStyles();}function IconLabel(Parent) {	this.Parent = Parent;		this.elm = this.newDiv();	this.font = JSTheme.iconLabelFont;	this.textElm = this.newDiv();	if(this.Parent.shadow) {		this.shadowElm = this.newDiv();		this.shadowDistance = 2;	}	this.top=this.Parent.labelTop;}IconLabel.prototype = new Control(this.Parent);IconLabel.prototype.GetType = function() {	return "IconLabel"	}IconLabel.prototype.SetStyles = function() {	this.elm.style.top = this.top+"px";	this.elm.style.left = "0px";	this.elm.style.width = "100%";	this.elm.style.height = "45px";	//this.textElm.style.fontFamily = this.font;	//this.textElm.style.fontSize = this.fontSize+"px";	//this.textElm.style.fontWeight = this.fontWeight;	this.font.ApplyFont(this.textElm);	this.textElm.style.color = this.Parent.labelColor;	this.textElm.style.width = "100%";	this.textElm.style.top = "0px";	this.textElm.style.left = "0px";	this.textElm.style.margin = "0";	this.textElm.style.padding = "0";	this.textElm.style.zIndex = "1";	this.textElm.style.textAlign="center";	if(this.Parent.shadow) {		//this.shadowElm.style.fontFamily = this.font;			//this.shadowElm.style.fontSize = this.fontSize+"px";		//this.shadowElm.style.fontWeight = this.fontWeight;		this.font.ApplyFont(this.shadowElm);		this.shadowElm.style.color = "black";		this.shadowElm.style.width = "100%";		this.shadowElm.style.top = this.shadowDistance+"px";		this.shadowElm.style.left = this.shadowDistance+"px";		this.shadowElm.style.margin = "0";		this.shadowElm.style.padding = "0";		this.shadowElm.style.zIndex = "0";		this.shadowElm.style.textAlign="center";		this.shadowElm.innerHTML = this.Parent.text;	}	//setOpacity(this.shadowElm,7);	this.textElm.innerHTML = this.Parent.text;}IconLabel.prototype.Paint = function() {	if(this.Parent.shadow)		this.elm.appendChild(this.shadowElm);	this.elm.appendChild(this.textElm);	this.Parent.elm.appendChild(this.elm);}function IconGrid(Parent,width,height) {	this.Parent = Parent;	this.Parent.iconGrid = this;	if(this.Parent.Parent) {		if(this.Parent.Parent.myWindow)			this.Parent.Parent.myWindow.iconGrid = this;	}	this.gridSize = new Coordinates(90,100);	this.parentSize = new Coordinates(width,height);	this.gridCount = null;	this.direction = 0; //0 for down, then over; 1 for over, then down	this.icons = new Array();	this.activeIcon = -1;	this.currentCol = 0;	this.currentRow = 0;	this.padding = new Coordinates(10,10);	this.SetEvents();	this.SetStyles();}IconGrid.prototype = new Control(this.Parent);IconGrid.prototype.GetType = function() {	return "IconGrid"	}IconGrid.prototype.SetStyles = function(width,height) {	if(width!=null&&height!=null) {		this.parentSize = new Coordinates(width,height);	}	if(this.Parent.size)		this.parentSize = this.Parent.size;	var oldgridCount = this.gridCount;	this.gridCount = new Coordinates(Math.floor((this.parentSize.x-this.padding.x*2-5)/this.gridSize.x),		Math.floor((this.parentSize.y-this.padding.y*2)/this.gridSize.y));	if(oldgridCount!=null) {		if(oldgridCount.x!=this.gridCount.x || oldgridCount.y!=this.gridCount.y)			this.UpdateIconPositions();	}}IconGrid.prototype.AddIcon = function(icon) {	if(this.direction==0) {		if(this.currentRow == this.gridCount.y) {			this.currentCol++;			this.currentRow = 0;		}		icon.top = this.currentRow*this.gridSize.y+this.padding.y;		icon.left = this.currentCol*this.gridSize.x+this.padding.x;		icon.gridPosition = new Coordinates(this.currentCol,this.currentRow);		this.currentRow++;	} else {		if(this.currentCol == this.gridCount.x) {			this.currentRow++;			this.currentCol = 0;		}		icon.top = this.currentRow*this.gridSize.y+this.padding.y;		icon.left = this.currentCol*this.gridSize.x+this.padding.x;		icon.gridPosition = new Coordinates(this.currentCol,this.currentRow);		icon.shadow = false;		icon.labelColor = "black";				this.currentCol++;	}	icon.SetStyles();	this.Parent.elm.appendChild(icon.elm);	this.Parent.elm.appendChild(icon.divUnder);	this.icons.push(icon);	icon.id = this.icons.length;}IconGrid.prototype.UpdateIconPositions = function() {	var row=0,col=0,index=0;	if(this.direction==0) {		for(index=0;index<this.icons.length;index++) {			if(row>=this.gridCount.y) {				row = 0;				col++;			}			this.icons[index].left = col*this.gridSize.x+this.padding.x;			this.icons[index].top = row*this.gridSize.y+this.padding.y;			this.icons[index].gridPosition = new Coordinates(col,row);			this.icons[index].SetStyles();			row++;		}	} else {		for(index=0;index<this.icons.length;index++) {			if(col>=this.gridCount.x) {				col = 0;				row++;			}			this.icons[index].left = col*this.gridSize.x+this.padding.x;			this.icons[index].top = row*this.gridSize.y+this.padding.y;			this.icons[index].gridPosition = new Coordinates(col,row);			this.icons[index].SetStyles();			col++;		}			}}IconGrid.prototype.DeselectAll = function(except) {	var i=0;	if(except == null)		except = -1;	for(i=0;i<this.icons.length;i++)		if(except!=this.icons[i].id)			this.icons[i].Deselect();	this.activeIcon = -1;}IconGrid.prototype.SetEvents = function() {	this.Parent.elm.oldMD = this.Parent.elm.onmousedown;	this.Parent.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		if(this.oldMD)			this.oldMD();		if(window.myDesktop.makingWindowInactive)			window.myDesktop.makingWindowInactive = false;		else			this.myself.iconGrid.DeselectAll();	}}IconGrid.prototype.Move = function(direction) {	if(!direction)		return;	try {		if(this.activeIcon==-1) {			if(this.icons.length>0)				this.icons[0].Select();				return;		}		var thisIcon = this.icons[this.activeIcon-1];		var newGridPos = new Coordinates(thisIcon.gridPosition.x + direction.x,thisIcon.gridPosition.y + direction.y);		var newIcon = this.GetIconFromGridPos(newGridPos);		//alert(newGridPos.x+", "+newGridPos.y);		if(newIcon) {			this.icons[this.activeIcon-1].Deselect();			this.activeIcon = newIcon.id;			newIcon.Select();		}		} catch(e) {		alert("IconGridMove: "+e);	}}IconGrid.prototype.GetCoordsFromGridPos = function(gridPos) {	return new Coordinates(gridPos.x*this.gridSize.x,gridPos.y*this.gridSize.y);}IconGrid.prototype.GetRowOrColOfIcons = function(rowOrCol) {	var i,iconAry = new Array();	for(i=0;i<this.icons.length;i++)		if(this.direction==0) {			if(this.icons[i].gridPosition.x == rowOrCol)				iconAry.push(this.icons[i]);		} else {			if(this.icons[i].gridPosition.y == rowOrCol)				iconAry.push(this.icons[i]);						}	if(iconAry.length>0)		return iconAry;	else		return false;}IconGrid.prototype.GetIconFromGridPos = function(gridPos) {	if(this.IconInGridPos(gridPos)) {		var i;		if(this.direction==0) {			var thisCol = this.GetRowOrColOfIcons(gridPos.x);			for(i=0;i<thisCol.length;i++) {				if(thisCol[i].gridPosition.y == gridPos.y)					return thisCol[i];			}			return false;		} else {			var thisRow = this.GetRowOrColOfIcons(gridPos.y);			for(i=0;i<thisRow.length;i++) {				if(thisRow[i].gridPosition.x == gridPos.x)					return thisRow[i];			}			return false;		}	} else		return false;}IconGrid.prototype.IconInGridPos = function(gridPos) {	var numIcons = this.icons.length;	if(gridPos.x < 0 || gridPos.y < 0)		return false;	if(this.direction==0) {		var numCols = Math.ceil(numIcons / this.gridCount.y);		var fullColumns = numCols - 1;				//icon is in a full column and, therefore, exists		if(numCols>1 && (gridPos.x < fullColumns))			return true;		//gridPos.x is greater than the number of columns		if(gridPos.x > (numCols+1))			return false;			//calculate number of icons in last column; figure out if gridPos is inside that		var iconsInLastColumn = numIcons - (this.gridCount.y * fullColumns);		if(gridPos.y < iconsInLastColumn)			return true;		else			return false;	} else {		var numRows = Math.ceil(numIcons / this.gridCount.x);		var fullRows = numRows - 1;		//icon is in a full row and, therefore, exists		if(numRows>1 && (gridPos.y < fullRows))			return true;					//gridPos.x is greater than the number of rows		if(gridPos.y > (numRows+1))			return false;				//calculate number of icons in last column; figure out if gridPos is inside that		var iconsInLastRow = numIcons - (this.gridCount.x * fullRows);		if(gridPos.x < iconsInLastRow)			return true;		else			return false;			}}IconGrid.prototype.EnterPressed = function() {	if(this.activeIcon!=-1) {		//alert(this.icons[this.activeIcon-1].text);		this.icons[this.activeIcon-1].handler();	}}IconGrid.prototype.GetIconById = function(id) {	var i;	for(i=0;i<this.icons.length;i++)		if(this.icons[i].id == id)			return this.icons[i];	return false;}IconGrid.prototype.GetArrayPosById = function(id) {	var i;	for(i=0;i<this.icons.length;i++)		if(this.icons[i].id == id)			return i;	return false;	}IconGrid.prototype.DeleteIcon = function(id) {	var iconToDelete = this.GetIconById(id);	var arrayPos = this.GetArrayPosById(id);	this.icons.splice(arrayPos,1);	SelfDestruct(iconToDelete.elm);	this.UpdateIconPositions();}IconGrid.prototype.DeleteAllIcons = function() {	var i;	while(this.icons.length>0)		this.DeleteIcon(this.icons[0].id);}function Logo(Parent) {	this.Parent = Parent;	this.url = null;	this.size = new Coordinates(0,0);	this.position = new Coordinates(0,0);	this.elm = this.newDiv();	this.padding = new Coordinates(10,10);}Logo.prototype = new Control(this.Parent);Logo.prototype.GetType = function() {	return "Logo"	}Logo.prototype.IsSet = function() {	return (this.url!=null)}Logo.prototype.SetStyles = function() {	this.position.x = this.Parent.size.x - this.size.x - this.padding.x;	this.position.y = this.Parent.size.y - this.size.y - this.padding.y;	this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	this.elm.style.backgroundImage = "url('"+this.url+"')";	this.elm.style.zIndex = "0";}function BasicAboutBox(Parent) {	this.Parent = Parent;		this.myWindow = new Window(window.myDesktop);	this.size = new Coordinates(270,180);	this.containerDiv = this.newDiv();	this.appName = "myApp.jsda";	this.version = "1.0";	this.description = "A JS Desktop App";	this.author = "Me!";}BasicAboutBox.prototype = new Control(this.Parent);BasicAboutBox.prototype.GetType = function() {	return "BasicAboutBox"	}BasicAboutBox.prototype.SetStyles = function() {	this.text = "<span style=\"font-size:20px;font-weight:bold;\">"+this.appName+"</span><br />Version "+this.version+"<br />"+		"<br /><span style=\"font-size:17px\">"+this.description+"</span><br />By "+this.author;	this.containerDiv.style.position = "relative";	this.containerDiv.style.height = this.Parent.myWindow.windowContentSize.y+"px";	this.containerDiv.style.width = "100%";	this.containerDiv.align="center";	this.containerDiv.style.textAlign="center";	this.containerDiv.style.fontFamily = "'Lucida Grande','Trebuchet MS',Arial,Helvetica,sans-serif";	this.containerDiv.style.fontSize = "14px";	this.containerDiv.style.color = "#132543";	this.containerDiv.innerHTML = this.text;	this.containerDiv.style.paddingTop = "20px";	this.containerDiv.style.fontWeight = "normal";	this.disableSelection(this.containerDiv);	this.containerDiv.style.MozUserSelect = "none";	this.myWindow.titleBar.text = "About "+this.appName;	this.myWindow.position.x = Math.floor(window.myDesktop.size.x/2) - Math.floor(this.size.x/2);	this.myWindow.position.y = Math.floor(window.myDesktop.size.y/2) - Math.floor(this.size.y/2);	this.myWindow.size.x = this.size.x;	this.myWindow.size.y = this.size.y;	this.myWindow.resizeable = false;	this.myWindow.SetStyles();}BasicAboutBox.prototype.Paint = function(e) {	if(this.GetType() != "BasicAboutBox")		var myself = this.Parent.Parent.Parent.myApp.aboutBox;	else		var myself = this;	myself.myWindow.windowContent.appendChild(myself.containerDiv);	myself.SetStyles();	window.myDesktop.AddWindow(myself.myWindow);	window.myDesktop.HideAllMenus();}function Toolbar(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myWindow = this.Parent;	this.height = 40;	this.position = new Coordinates(0,0);	this.items = new Array();	this.spacing = 10;	this.bgColor = "#efedf0";	this.borderTop = new Border(this);	this.borderTop.color = "white";	this.borderBottom = new Border(this);	this.borderBottom.color = "gray";}Toolbar.prototype = new Control(this.Parent);Toolbar.prototype.GetType = function() {	return "Toolbar"	}Toolbar.prototype.SetStyles = function() {	this.position.y = this.GetTop();		this.elm.style.borderTop = this.borderTop.CSS();	this.elm.style.borderBottom = this.borderBottom.CSS();	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.width = "100%";	this.elm.style.height = this.height+"px";	this.elm.style.backgroundColor = this.bgColor;	var i=0;	for(i=0;i<this.items.length;i++)		this.items[i].SetStyles();}Toolbar.prototype.SetEvents = function() {	this.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		try {			window.myDesktop.HideAllMenus();			this.myWindow.MakeActive();		} catch(e) {}	}}Toolbar.prototype.Paint = function() {	this.SetStyles();	this.SetEvents();	if(this.Parent.elm)		this.Parent.elm.appendChild(this.elm);	else		try {			this.Parent.appendChild(this.elm);		} catch(e) {			alert(e);		}}Toolbar.prototype.GetTop = function() {	var height=3;	if(this.Parent.titleBar)		height+= this.Parent.titleBar.height;	if(this.Parent.menuBar)		height+= this.Parent.menuBar.height;	return height;}Toolbar.prototype.AddButton = function(text,width,height,handler,bgImageUrl) {	var newButton = new ToolbarButton(this);	newButton.text = text;	newButton.size = new Coordinates(width,height);	newButton.handler = handler;	newButton.position.x = this.GetNextLeft();	if(bgImageUrl!=null)		newButton.bgImageUrl = bgImageUrl;	else {		if(navigator.userAgent.toLowerCase().indexOf('safari')!=-1) {			newButton.size.y = 32;		}	}	this.items.push(newButton);	newButton.Paint();	return newButton;}Toolbar.prototype.AddDivider = function() {	var newDivider = new ToolbarDivider(this);	this.items.push(newDivider);	newDivider.Paint();	return newDivider;}Toolbar.prototype.AddLabel = function(label) {	this.items.push(label);	label.Paint();}Toolbar.prototype.GetNextLeft = function() {	var i,left=(this.spacing);	for(i=0;i<this.items.length;i++)		left+=this.items[i].size.x+this.spacing;	return left;}function ToolbarButton(Parent) {	this.Parent = Parent;	this.elm = document.createElement('input');	this.elm.myself = this;	this.myWindow = this.Parent.Parent;	this.elm.type = "button";	if(JSTheme.buttonFont)		JSTheme.buttonFont.ApplyFont(this.elm);	this.size = new Coordinates(0,0);	this.position = new Coordinates(0,0);	this.text = "";	this.bgImageUrl = "";	this.handler = null;}ToolbarButton.prototype = new Control(this.Parent);ToolbarButton.prototype.GetType = function() {	return "ToolbarButton"	}ToolbarButton.prototype.SetStyles = function() {	this.position.y = Math.floor((this.Parent.height - this.size.y)/2);	this.elm.value = this.text;	this.elm.style.position = "absolute";	this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	if(this.bgImageUrl!="") {		this.elm.style.border = "0";		//if(!window.event)			//this.elm.type = "image";		this.elm.style.backgroundImage = "url('"+this.bgImageUrl+"')";	}}ToolbarButton.prototype.SetEvents = function() {	if(this.handler!=null)		this.elm.onclick = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;						try {				this.myself.handler();			}			catch(e) {				alert(e);			}		}}ToolbarButton.prototype.Paint = function() {	this.SetStyles();	this.SetEvents();	this.Parent.elm.appendChild(this.elm);}ToolbarButton.prototype.SetToolTip = function(tooltip) {	this.elm.title = tooltip;}ToolbarButton.prototype.Enable = function() {	this.elm.disabled = false;}ToolbarButton.prototype.Disable = function() {	this.elm.disabled = true;}ToolbarButton.prototype.SetText = function(text) {	this.text = text;	this.elm.value = this.text;}function ToolbarDivider(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myWindow = this.Parent;	this.position = new Coordinates(0,0);	this.size = new Coordinates(0,0);	this.verticalSpacing = 5;	this.position.x = this.Parent.GetNextLeft();	this.position.y = this.verticalSpacing;	this.borderLeft = new Border(this);	this.borderLeft.color = "gray";	this.borderLeft.width = 1;	this.borderRight = new Border(this);	this.borderRight.color = "white";}ToolbarDivider.prototype = new Control(this.Parent);ToolbarDivider.prototype.GetType = function() {	return "ToolbarDivider";	}ToolbarDivider.prototype.SetStyles = function() {	this.size.x = 0;	this.size.y = this.Parent.height - (this.verticalSpacing*2);		this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.height = this.size.y+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.borderLeft = this.borderLeft.CSS();	this.elm.style.borderRight = this.borderRight.CSS();	//this.elm.style.backgroundColor = "red";	}ToolbarDivider.prototype.SetEvents = function() {	this.elm.onclick = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		try {			window.myDesktop.HideAllMenus();			this.myWindow.MakeActive();		} catch(e) {}	}}ToolbarDivider.prototype.Paint = function() {	this.SetStyles();	this.SetEvents();	this.Parent.elm.appendChild(this.elm);}function ToolBarLabel(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.textAlign = "center";	this.verticalAlign = "middle";	this.text = "";	this.font = "'Lucida Grande', Arial, Helvetica, sans-serif";	this.fontSize = 16;	this.fontWeight = "bold";	this.spacing = Math.round(this.Parent.height / 2) - Math.round(this.fontSize / 2)-2;	this.size = new Coordinates(100,this.Parent.height - this.spacing);	this.position = new Coordinates(this.Parent.GetNextLeft(),this.spacing);}ToolBarLabel.prototype = new Control(this);ToolBarLabel.prototype.GetType = function() {	return "ToolBarLabel";	}ToolBarLabel.prototype.Paint = function() {	this.elm.style.fontFamily = this.font;	this.elm.style.fontSize = this.fontSize+"px";	this.elm.style.textAlign = this.textAlign;	this.elm.style.fontWeight = this.fontWeight;	this.elm.style.verticalAlign = this.verticalAlign;	this.elm.style.top = this.position.y+"px"	this.elm.style.left = this.position.x+"px";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	this.SetStyles();	this.Parent.elm.appendChild(this.elm);}ToolBarLabel.prototype.SetStyles = function() {	this.elm.innerHTML = this.text;}function StatusBar(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myself = this;	this.status = "";	this.borderTop = new Border();	this.borderTop.color = "gray";	this.originalHeight = 20;	this.height = this.originalHeight;	this.position = new Coordinates(0,0);}StatusBar.prototype = new Control(this.Parent);StatusBar.prototype.GetType = function() {	return "StatusBar"	}StatusBar.prototype.SetStyles = function() {	this.position.y = (this.Parent.size.y - this.height);		this.elm.style.height = this.height+"px";	this.elm.style.width = "100%";	this.elm.style.left = this.position.x+"px";	this.elm.style.top = this.position.y+"px";	this.elm.style.backgroundColor = this.Parent.menuBar.bgColor;	this.elm.style.borderTop = this.borderTop.CSS();	this.elm.style.fontFamily = "'Lucida Grande', Arial, Helvetica, sans-serif";	this.elm.style.fontSize = "10px";	this.elm.style.paddingLeft = "10px";	this.elm.style.paddingTop = "1px";	this.elm.innerHTML = this.status; }StatusBar.prototype.SetEvents = function() {	}StatusBar.prototype.Paint = function() {	this.SetEvents();	this.height = this.originalHeight;	this.SetStyles();	this.Parent.elm.appendChild(this.elm);}StatusBar.prototype.SetStatus = function(status) {	this.status = status;	this.SetStyles();}StatusBar.prototype.Hide = function() {	this.Parent.elm.removeChild(this.elm);	this.height = 0;	this.Parent.SetStyles();}StatusBar.prototype.Show = function() {	this.height = this.originalHeight;	this.Parent.SetStyles();		this.Paint();}function Form(Parent,container) {	this.Parent = Parent;	this.container = container;	this.fields = new Array();}Form.prototype = new Control(this.Parent);Form.prototype.GetType = function() {	return "Form";	}var isSafari = navigator.userAgent.toLowerCase().indexOf("safari")!=-1;var isiPhone = navigator.userAgent.toLowerCase().indexOf('iphone')!=-1;Form.prototype.AddTextInput = function(label,x,y,w,defaultValue,password,normalBorder) {	if(password)		var newInput = new FormTextInput(this,true,normalBorder);	else		var newInput = new FormTextInput(this,null,normalBorder);	newInput.label = label;	this.isSafari() ? newInput.width = Math.round(w*0.8) : newInput.width = w;	if(x!=null)		newInput.position = new Coordinates(x,y);	else		newInput.position = "relative";	if(defaultValue != null) {		newInput.text = defaultValue;		newInput.inputElm.value = newInput.text;	}	newInput.SetStyles();	this.fields.push(newInput);	return newInput;}Form.prototype.AddTextArea = function(label,x,y,w,h,defaultValue,password,normalBorder) {	var newInput = new FormTextArea(this,normalBorder);	newInput.label = label;	newInput.width = w;	newInput.height = h;	if(x!=null)		newInput.elm.position = new Coordinates(x,y);	else		newInput.elm.relativePosition = true;	if(defaultValue != null) {		newInput.text = defaultValue;		newInput.inputElm.value = newInput.text;	}	newInput.SetStyles();	this.fields.push(newInput);	return newInput;}Form.prototype.AddCheckBox = function(label,x,y,checked) {	var newCheckBox = new FormCheckBox(this);	newCheckBox.label = label;	if(x!=null)		newCheckBox.position = new Coordinates(x,y);	else		newCheckBox.position = "relative";	if(checked)		newCheckBox.checked = checked;	newCheckBox.SetStyles();	newCheckBox.labelElm.myApp = this.Parent;	newCheckBox.elm.myApp = this.Parent;	this.fields.push(newCheckBox);	return newCheckBox;}Form.prototype.AddSelect = function(label,x,y,width,size,multiple,normalBorder) {	var newSelect = new FormSelect(this,normalBorder);	newSelect.label = label;	if(x!=null)		newSelect.elm.position = new Coordinates(x,y);	else		newSelect.elm.relativePosition = true;	if(multiple!=null)		newSelect.multiple = multiple;	if(size!=null)		newSelect.size = size;	newSelect.width = width;	newSelect.SetStyles();	newSelect.inputElm.myApp = this.Parent;	return newSelect;}Form.prototype.AddButton = function(label,x,y,handler) {	var newButton = new FormButton(this,label,handler);	newButton.SetText(label);	newButton.button.elm.style.position = "absolute";	newButton.button.elm.style.top = y+"px";	newButton.button.elm.style.left = x+"px";	newButton.button.myApp = this.Parent;	this.fields.push(newButton);	return newButton;}Form.prototype.AddTextField = function(text,x,y,font) {	var newTF = new FormTextField(this);	newTF.SetText(text);	newTF.elm.position = new Coordinates(x,y);	if(font)		newTF.elm.font = font;	newTF.SetStyles();	this.fields.push(newTF);	return newTF;}Form.prototype.AddRelativeTextField = function(text,font) {	var newTF = new FormTextField(this);	newTF.SetText(text);	newTF.elm.relativePosition = true;	if(font)		newTF.elm.font = font;	newTF.SetStyles();	this.fields.push(newTF);	return newTF;}Form.prototype.AddRelativeHR = function() {	var newTF = new FormTextField(this);	newTF.SetText("<hr />");	newTF.elm.relativePosition = true;	newTF.SetStyles();	this.fields.push(newTF);	return newTF;}Form.prototype.SetStyles = function() {	var i;	for(i=0;i<this.fields.length;i++)		this.fields[i].SetStyles();}function FormTextArea(Parent,normalBorder) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.elm = new Pane(this);	this.inputElm = document.createElement("textarea");	this.inputElm.myself = this;	this.width = 0;	this.height = 0;	this.position = new Coordinates(0,0);	this.text = "";	this.label = "";	this.labelElm = new Pane(this);	this.labelElm.relativePosition = "true";	if(normalBorder)		this.border = normalBorder;	else		this.border = JSTheme.inputNormalBorder;	this.highlightBorder = JSTheme.inputHighlightBorder;	this.highlightColor = JSTheme.inputHighlightColor;	this.normalColor = JSTheme.inputNormalColor;	this.firstDraw = true;	this.SetEvents();	this.Paint();}FormTextArea.prototype = new Control(this.Parent);FormTextArea.prototype.GetType = function() {	return "FormTextArea";}FormTextArea.prototype.SetEvents = function() {	this.inputElm.onblur = function() {		this.style.border = this.myself.border.CSS();		this.style.backgroundColor = this.myself.normalColor;		this.myself.text = this.value;	}	this.inputElm.onfocus = function() {		this.style.border = this.myself.highlightBorder.CSS();		this.style.backgroundColor = this.myself.highlightColor;	}}FormTextArea.prototype.SetStyles = function() {	this.elm.UpdatePosition();	this.inputElm.cols = this.width;	this.inputElm.rows = this.height;	if(this.firstDraw) {		this.labelElm.textAlign = "left";		this.labelElm.innerHTML = this.label;		this.labelElm.SetStyles();	}}FormTextArea.prototype.Paint = function() {	this.labelElm.elm.style.padding = "0px 0px 2px 0px";	this.labelElm.elm.style.margin = "0";	this.labelElm.font = JSTheme.inputLabelFont;	this.inputElm.style.border = this.border.CSS();	this.inputElm.style.padding = "3px";	this.inputElm.style.cursor = "text";	this.elm.appendChild(this.labelElm);	this.elm.appendChild(this.inputElm);	this.Parent.container.appendChild(this.elm.elm);}FormTextArea.prototype.AddOnblurEvent = function(aFunction) {	this.inputElm.oldOnblur = this.inputElm.onblur;	this.inputElm.newOnblur = aFunction;	this.inputElm.onblur = function() {		this.oldOnblur();		this.newOnblur();	}}FormTextArea.prototype.SetFocus = function() {	this.inputElm.focus();	}FormTextArea.prototype.SetSelect = function() {	this.inputElm.focus();	this.inputElm.select();}FormTextArea.prototype.SetKeyPress = function(key,button) {	this.inputElm.onkeypress = function(e) {		var keyPressed;		if(window.event) {			e = window.event;			keyPressed = e.keyCode;		} else 			keyPressed = e.which;		e.cancelBubble = true;		if(keyPressed == key)			button.elm.click();	}}FormTextArea.prototype.SetValue = function(text) {	this.inputElm.value = text;	}FormTextArea.prototype.GetValue = function() {	return this.inputElm.value;	}FormTextArea.prototype.SetToolTip = function(tooltip) {	this.inputElm.title = tooltip;	this.labelElm.elm.title = tooltip;}function FormButton(Parent,value,handler) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.button = new Button(value,this);	this.button.handler = handler;	this.button.SetEvents();	this.Paint();}FormButton.prototype = new Control(this.Parent);FormButton.prototype.GetType = function() {	return "FormButton";}FormButton.prototype.SetStyles = function() {	}FormButton.prototype.Paint = function() {	this.Parent.container.appendChild(this.button.elm);}FormButton.prototype.Disable = function() {	this.button.Disable();}FormButton.prototype.Enable = function() {	this.button.Enable();}FormButton.prototype.SetText = function(text) {	this.button.SetText(text);}function FormTextField(Parent) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.elm = new Pane(this);	this.Paint();}FormTextField.prototype = new Control(this.Parent);FormTextField.prototype.GetType = function() {	return "FormTextField";}FormTextField.prototype.SetStyles = function() {	this.elm.SetStyles();}FormTextField.prototype.Paint = function() {	this.Parent.container.appendChild(this.elm.elm);}FormTextField.prototype.SetText = function(text) {	this.elm.innerHTML = text;	this.elm.UpdateInnerHTML();}FormTextField.prototype.SetValue = function(text) {	this.SetText(text);}FormTextField.prototype.GetValue = function() {	return this.elm.innerHTML;}FormTextField.prototype.SetFont = function(font) {	this.elm.font = font;	this.elm.UpdateFont();}function FormTextInput(Parent,password,normalBorder) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.elm = this.newDiv();	this.elm.myself = this;	this.inputElm = document.createElement("input");	if(password)		this.inputElm.type = "password";	this.inputElm.myself = this;	this.width = 0;	this.position = new Coordinates(0,0);	this.text = "";	this.label = "";	this.labelElm = document.createElement("p");	this.labelElm.style.textAlign = "left";	if(normalBorder)		this.border = normalBorder;	else		this.border = JSTheme.inputNormalBorder;	this.highlightBorder = JSTheme.inputHighlightBorder;	this.highlightColor = JSTheme.inputHighlightColor;	this.normalColor = JSTheme.inputNormalColor;	this.firstDraw = true;	this.SetEvents();	this.Paint();}FormTextInput.prototype = new Control(this.Parent);FormTextInput.prototype.GetType = function() {	return "FormTextInput"	}FormTextInput.prototype.SetEvents = function() {	this.inputElm.onblur = function() {		this.style.border = this.myself.border.CSS();		this.style.backgroundColor = this.myself.normalColor;		this.myself.text = this.value;	}	this.inputElm.onfocus = function() {		this.style.border = this.myself.highlightBorder.CSS();		this.style.backgroundColor = this.myself.highlightColor;	}}FormTextInput.prototype.SetStyles = function() {	if(this.position!="relative") {		this.elm.style.top = this.position.y+"px";		this.elm.style.left = this.position.x+"px";	} else		this.elm.style.position = "relative";	this.inputElm.size = this.width;	if(this.firstDraw) {		var innerText = document.createTextNode(this.label);		this.labelElm.appendChild(innerText);		this.firstDraw = false;			}}FormTextInput.prototype.Paint = function() {	this.labelElm.style.padding = "0px 0px 2px 0px";	this.labelElm.style.margin = "0";	JSTheme.inputLabelFont.ApplyFont(this.labelElm);	this.inputElm.style.border = this.border.CSS();	this.inputElm.style.padding = "3px";	JSTheme.inputFont.ApplyFont(this.inputElm);	this.inputElm.style.cursor = "text";	this.elm.appendChild(this.labelElm);	this.elm.appendChild(this.inputElm);	this.Parent.container.appendChild(this.elm);}FormTextInput.prototype.AddOnblurEvent = function(aFunction) {	this.inputElm.oldOnblur = this.inputElm.onblur;	this.inputElm.newOnblur = aFunction;	this.inputElm.onblur = function() {		this.oldOnblur();		this.newOnblur();	}}FormTextInput.prototype.SetFocus = function() {	this.inputElm.focus();	}FormTextInput.prototype.SetSelect = function() {	this.inputElm.focus();	this.inputElm.select();}FormTextInput.prototype.SetKeyPress = function(key,button) {	this.inputElm.onkeypress = function(e) {		var keyPressed;		if(window.event) {			e = window.event;			keyPressed = e.keyCode;		} else 			keyPressed = e.which;		e.cancelBubble = true;		if(keyPressed == key)			button.elm.click();	}}FormTextInput.prototype.SetValue = function(text) {	this.inputElm.value = text;	}FormTextInput.prototype.GetValue = function() {	return this.inputElm.value;	}FormTextInput.prototype.SetToolTip = function(tooltip) {	this.inputElm.title = tooltip;	this.labelElm.title = tooltip;}function FormCheckBox(Parent) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.elm = this.newDiv();	this.elm.myself = this;	this.checked = false;	this.checkbox = document.createElement("input");	this.checkbox.type = "checkbox";	this.position = new Coordinates(0,0);	this.label = "";	this.firstDraw = true;	this.table = document.createElement("table");	this.Table();	this.labelElm = document.createElement("p");	this.labelElm.myself = this;	this.SetEvents();	this.Paint();}FormCheckBox.prototype = new Control(this.Parent);FormCheckBox.prototype.GetType = function() {	return "FormCheckBox";	}FormCheckBox.prototype.SetEvents = function() {	this.labelElm.onmousedown = function() {		this.myself.Toggle();	}}FormCheckBox.prototype.AddMouseDownFunction = function(f) {	this.elm.newFunction = f;	this.elm.oldmousedown = this.elm.onmousedown;	this.elm.onmousedown = function() {		this.newFunction();		if(this.oldmousedown)			this.oldmousedown();	}}FormCheckBox.prototype.AddMouseUpFunction = function(f) {	this.elm.newFunction = f;	this.elm.oldmouseup = this.elm.onmouseup;	this.elm.onmouseup = function() {		this.newFunction();		if(this.oldmouseup)			this.oldmouseup();	}}FormCheckBox.prototype.Toggle = function() {	if(this.checkbox.checked)		this.checkbox.checked = false;	else		this.checkbox.checked = true;}FormCheckBox.prototype.Check = function() {	this.checkbox.checked = true;}FormCheckBox.prototype.Uncheck = function() {	this.checkbox.checked = false;}FormCheckBox.prototype.Paint = function() {	this.labelElm.style.padding = "0px 0px 2px 0px";	this.labelElm.style.margin = "0";	JSTheme.menuBarFont.ApplyFont(this.labelElm);	this.tdr.appendChild(this.labelElm);	this.tdl.appendChild(this.checkbox);	this.Parent.container.appendChild(this.elm);}FormCheckBox.prototype.SetStyles = function() {	if(this.position!="relative") {		this.elm.style.top = this.position.y+"px";		this.elm.style.left = this.position.x+"px";	} else		this.elm.style.position = "relative";	if(this.firstDraw) {		//var innerText = document.createTextNode(this.label);		//this.labelElm.appendChild(innerText);		this.labelElm.innerHTML = this.label;		this.firstDraw = false;			}}FormCheckBox.prototype.IsChecked = function() {	return this.checkbox.checked;}FormCheckBox.prototype.SetValue = function(value) {	if(value==1)		this.checkbox.checked = true;	else		if(value==0)			this.checkbox.checked = false;		else			try {				this.checkbox.checked = value;			} catch(e) {}}FormCheckBox.prototype.GetValue = function() {	if(this.checkbox.checked == true)		return 1;	else		return 0;}FormCheckBox.prototype.NoMarginPadding = function(elms) {	var i;	for(i=0;i<elms.length;i++) {		elms[i].style.margin = "0px";		elms[i].style.padding = "0px";	}}FormCheckBox.prototype.Table = function() {	this.tbody = document.createElement("tbody");	this.tr = document.createElement("tr");	this.tdl = document.createElement("td");	this.tdr = document.createElement("td");	this.tdl.style.verticalAlign = "top";	this.NoMarginPadding(Array(this.tbody, this.tr, this.tdl, this.tdr, this.table));	this.tdr.style.marginLeft = "5px";	this.tr.appendChild(this.tdl);	this.tr.appendChild(this.tdr);	this.tbody.appendChild(this.tr);	this.table.appendChild(this.tbody);	this.elm.appendChild(this.table);}FormCheckBox.prototype.SetToolTip = function(tooltip) {	this.checkbox.title = tooltip;	this.labelElm.title = tooltip;}function FormSelect(Parent,normalBorder) {	this.Parent = Parent;	this.myWindow = this.Parent.Parent.myWindow;	this.elm = new Pane(this);	this.inputElm = document.createElement("select");	this.inputElm.myself = this;	this.width = 0;	this.size = null;	this.multiple = false;	this.position = new Coordinates(0,0);	this.text = "";	this.label = "";	this.labelElm = new Pane(this);	this.labelElm.relativePosition = "true";	if(normalBorder)		this.border = normalBorder;	else		this.border = JSTheme.inputNormalBorder;	this.highlightBorder = JSTheme.inputHighlightBorder;	this.highlightColor = JSTheme.inputHighlightColor;	this.normalColor = JSTheme.inputNormalColor;	this.firstDraw = true;	this.SetEvents();	this.Paint();}FormSelect.prototype = new Control(this.Parent);FormSelect.prototype.GetType = function() {	return "FormSelect";}FormSelect.prototype.SetEvents = function() {	this.inputElm.onblur = function() {		this.style.border = this.myself.border.CSS();		this.myself.text = this.value;	}	this.inputElm.onfocus = function() {		this.style.border = this.myself.highlightBorder.CSS();	}}FormSelect.prototype.SetStyles = function() {	this.elm.UpdatePosition();	this.inputElm.style.width = this.width+"px";	if(this.size)		this.inputElm.size = this.size;	if(this.firstDraw) {		this.labelElm.innerHTML = this.label;		this.labelElm.SetStyles();	}}FormSelect.prototype.Paint = function() {	this.labelElm.elm.style.padding = "0px 0px 2px 0px";	this.labelElm.elm.style.margin = "0";	this.labelElm.font = JSTheme.inputLabelFont;	this.inputElm.style.border = this.border.CSS();	this.inputElm.style.padding = "3px";	this.elm.appendChild(this.labelElm);	this.elm.appendChild(this.inputElm);	this.Parent.container.appendChild(this.elm.elm);}FormSelect.prototype.AddOnblurEvent = function(aFunction) {	this.inputElm.oldOnblur = this.inputElm.onblur;	this.inputElm.newOnblur = aFunction;	this.inputElm.onblur = function() {		this.oldOnblur();		this.newOnblur();	}}FormSelect.prototype.AddOnchangeEvent = function(aFunction) {	this.inputElm.oldOnchange = this.inputElm.onchange;	this.inputElm.newOnchange = aFunction;	this.inputElm.onchange = function() {		if(this.oldOnchange!=null)			this.oldOnchange();		this.newOnchange();	}}FormSelect.prototype.SetFocus = function() {	this.inputElm.focus();	}FormSelect.prototype.SetSelect = function() {	this.inputElm.focus();	this.inputElm.select();}FormSelect.prototype.SetKeyPress = function(key,button) {	this.inputElm.onkeypress = function(e) {		var keyPressed;		if(window.event) {			e = window.event;			keyPressed = e.keyCode;		} else 			keyPressed = e.which;		e.cancelBubble = true;		if(keyPressed == key)			button.elm.click();	}}FormSelect.prototype.SetSelectedIndex = function(index) {	this.inputElm.selectedIndex = index;	}FormSelect.prototype.GetSelectedIndex = function() {	return this.inputElm.selectedIndex;	}FormSelect.prototype.SetToolTip = function(tooltip) {	this.inputElm.title = tooltip;	this.labelElm.elm.title = tooltip;}FormSelect.prototype.SetSize = function(size) {	this.inputElm.size = size;}//takes boolean argumentFormSelect.prototype.SetMultiple = function(multiple) {	this.inputElm.multiple = multiple;}FormSelect.prototype.AddOption = function(name,value) {	if(value==null)		value = this.inputElm.options.length;	var o = document.createElement("option");	o.text = name;	o.value = value;	try {		this.inputElm.add(o,null);	} catch(e) {		this.inputElm.add(o);	}	return o;}FormSelect.prototype.RemoveOption = function(index) {	this.inputElm.remove(index);}FormSelect.prototype.RemoveAllOptions = function() {	while(this.inputElm.options.length > 0)		this.RemoveOption(0);}FormSelect.prototype.RemoveOptionByValue = function(value) {	for(var i=0;i<this.options.length;i++) {		if (this.options[i].value == value) {			this.RemoveOption(i);			break;		}	}}FormSelect.prototype.GetNumOptions = function() {	return this.inputElm.options.length;}FormSelect.prototype.GetOptionValueByIndex = function(index) {	return this.inputElm.options[index].value;}FormSelect.prototype.GetSelectedOptionValue = function() {	return this.GetOptionValueByIndex(this.GetSelectedIndex());}FormSelect.prototype.SetOnChange = function(fn) {	this.inputElm.onchange = fn;}//if you want to attach anything to your options that are being sorted,//attach it to option.data and it will sort that as wellFormSelect.prototype.SortByText = function() {	var lb = this.inputElm;	arrTexts = new Array();	arrValues = new Array();	arrOldTexts = new Array();	arrData = new Array();		for(i=0; i<lb.length; i++)	{		arrTexts[i] = lb.options[i].text;		arrValues[i] = lb.options[i].value;		if(lb.options[i].data)			arrData[i] = lb.options[i].data;				arrOldTexts[i] = lb.options[i].text;	}		arrTexts.sort();		for(i=0; i<lb.length; i++)	{		lb.options[i].text = arrTexts[i];		for(j=0; j<lb.length; j++)		{			if (arrTexts[i] == arrOldTexts[j])			{				lb.options[i].value = arrValues[j];				if(arrData.length>0)					lb.options[i].data = arrData[j];				j = lb.length;			}		}	}}function Table(Parent) {	this.Parent = Parent;	this.table = document.createElement("table");	this.elm = this.table;	this.tbody = document.createElement("tbody");	this.SetDefaultSettings();	this.numCols = 0;	this.rows = new Array();	this.headerRow = null;	//height of -1 means that no height will be assigned to the table	this.size = new Coordinates(100,-1);	this.percentWidth = false;	this.position = new Coordinates(0,0);	this.border = new Border(this,1,"solid","black");}Table.prototype = new Control(this.Parent);Table.prototype.GetType = function() {	return "Table";	}Table.prototype.SetDefaultSettings = function() {	this.table.style.position = "absolute";	this.table.cellspacing = "0";	this.table.cellpadding = "0";	this.table.border = "0";	this.table.style.borderCollapse = "collapse";}Table.prototype.Paint = function() {	//remove all rows before painting	while(this.tbody.childNodes.length > 0) {		this.tbody.removeChild(this.tbody.childNodes[0]);	}				var i=0;	this.table.style.border = this.border.CSS();	this.table.style.top = this.position.y+"px";	this.table.style.left = this.position.x+"px";	this.SetStyles();	for(i=0;i<this.rows.length;i++) {		this.rows[i].Paint();		this.tbody.appendChild(this.rows[i].elm);	}	this.elm.appendChild(this.tbody);}Table.prototype.SetStyles = function() {	if(this.percentWidth)		this.table.style.width = this.size.x+"%";	else		this.table.style.width = this.size.x+"px";	if(this.size.y>=0)		this.table.style.height = this.size.y+"px";}Table.prototype.SetNumRows = function(numRows) {	var diff = numRows - this.rows.length;	var i=0;	if(diff > 0) {		for(i=0;i<diff;i++)			this.AddRow(new TableRow(this));		this.Paint();	}	if(diff < 0) {		this.rows.splice(numRows,diff*-1);		this.Paint();	}	}Table.prototype.AddHeaderRow = function(data) {	try {		this.headerRow = new TableRow(this);		this.headerRow.defaultBGColor = "#efedf0";		this.headerRow.defaultFontSize = 12;		this.headerRow.defaultFontWeight = "bold";		this.headerRow.defaultAlignment = "center";		this.headerRow.SetContents(data);		this.numCols = data.length;		this.rows.unshift(this.headerRow);	} catch(e) {		alert("Table.AddHeaderRow"+e);	}}Table.prototype.AddRow = function(row) {	if(this.numCols == 0)		this.numCols = row.cells.length;	this.rows.push(row);}Table.prototype.ClearData = function() {	var i,start;	if(this.headerRow)		start=1;	else		start=0;	for(i=start;i<this.rows.length;i++)		this.rows[i].ClearData();}function TableRow(Parent) {	this.Parent = Parent;	this.elm = document.createElement("tr");	this.elm.myself = this;	this.cells = new Array();	this.values = new Array();	this.numCells = this.Parent.numCols;	if(this.numCells>0)		this.AddCells();	this.defaultBorder = new Border(this, 1, "solid", "black");	this.defaultBGColor = "";	this.defaultFont = "'Lucida Grande', Arial, Helvetica, sans-serif";	this.defaultFontSize = 10;	this.defaultFontWeight = "normal";	this.defaultAlignment = "left";	this.defaultPadding = "0px 5px 0px 5px";	this.defaultNoWrap = false;	this.spaceCellsEvenly = false;	this.SetDefaultSettings();	this.InitCells();}TableRow.prototype = new Control(this.Parent);TableRow.prototype.GetType = function() {	return "TableRow";	}TableRow.prototype.AddCells = function() {	var i;	for(i=0;i<this.numCells;i++)		this.cells.push(new TableCell(this));}TableRow.prototype.SetDefaultSettings = function() {	this.elm.style.margin = "0px";	this.elm.style.padding = "0px";}TableRow.prototype.InitCells = function() {	var i=0;	for(i=0;i<this.Parent.numCols;i++)		this.cells[i] = new TableCell(this);	}TableRow.prototype.Paint = function() {	//remove any existing cells...	while(this.elm.childNodes.length > 0)		this.elm.removeChild(this.elm.childNodes[0]);		var i;	for(i=0;i<this.cells.length;i++) {		if(this.spaceCellsEvenly)			this.cells[i].width = Math.round(100 / this.cells.length);		this.cells[i].Paint();		this.elm.appendChild(this.cells[i].elm);	}}TableRow.prototype.UpdateContents = function() {	var i=0;	for(i=0;i<this.cells.length;i++)		this.cells[i].UpdateContents();	}TableRow.prototype.UpdateBorder = function() {	var i=0;	for(i=0;i<this.cells.length;i++)		this.cells[i].UpdateBorder();}TableRow.prototype.Update = function() {	var i=0;	for(i=0;i<this.cells.length;i++)		this.cells[i].Update();}TableRow.prototype.SetContents = function(contents) {	try {		if(contents.length != this.cells.length)			this.SetCellNumber(contents.length);		var i=0;		for(i=0;i<contents.length;i++)			this.cells[i].value = contents[i];			if(contents.length > this.Parent.numCols)			this.Parent.numCols = contents.length;	} catch(e) {		alert("TableRow.SetContents: "+e);	}}TableRow.prototype.SetCellNumber = function(number) {	this.cells = new Array();	var i=0;	for(i=0;i<number;i++) {		this.cells[i] = new TableCell(this);		}}TableRow.prototype.ClearData = function() {	var i=0;	for(i=0;i<this.cells.length;i++)		this.cells[i].ClearData();}TableRow.prototype.SetStyles = function() {	var i;	for(i=0;i<this.cells.length;i++)		this.cells[i].SetDefaultSettings();}TableRow.prototype.PaintCells = function() {	var i;		for(i=0;i<this.cells.length;i++) {		this.cells[i].SetDefaultSettings();		this.cells[i].Paint();	}}TableRow.prototype.SpaceEvenly = function() {	this.spaceCellsEvenly = true;	}function TableCell(Parent) {	this.Parent = Parent;	this.elm = document.createElement("td");	this.elm.myself = this;	this.value = "&nbsp;";	this.SetDefaultSettings();	this.width = null;	this.widthInPixels = false}TableCell.prototype = new Control(this.Parent);TableCell.prototype.GetType = function() {	return "TableCell";	}TableCell.prototype.SetDefaultSettings = function() {	this.border = this.Parent.defaultBorder;	this.bgColor = this.Parent.defaultBGColor;	this.font = this.Parent.defaultFont;	this.fontSize = this.Parent.defaultFontSize;	this.fontWeight = this.Parent.defaultFontWeight;	this.alignment = this.Parent.defaultAlignment;	this.padding = this.Parent.defaultPadding;	this.noWrap = this.Parent.defaultNoWrap;	this.elm.style.margin = "0px";	this.elm.style.padding = "0px";}TableCell.prototype.Paint = function() {	if(this.value!="")		this.elm.innerHTML = this.value;	this.elm.style.border = this.border.CSS();	this.elm.style.fontFamily = this.font;	this.elm.style.fontSize = this.fontSize+"px";	this.elm.style.fontWeight = this.fontWeight;	if(this.width) {		if(this.widthInPixels)			this.elm.style.width = this.width+"px";		else			this.elm.style.width = this.width+"%";	}	this.elm.style.backgroundColor = this.bgColor;	//this.elm.style.textAlign = this.alignment;	this.elm.align = this.alignment;	this.elm.style.padding = this.padding;	//if(!window.myDesktop.errorConsole)		//window.myDesktop.ShowErrorConsole();	//window.myDesktop.errorConsole.Add(this.alignment);	this.elm.noWrap = this.noWrap;}TableCell.prototype.UpdateContents = function() {	this.elm.innerHTML = this.value;	}TableCell.prototype.UpdateBorder = function() {	this.elm.style.border = this.border.CSS();	}TableCell.prototype.Update = function() {	this.UpdateContents();	this.UpdateBorder();}TableCell.prototype.ClearData = function() {	this.value = "";	this.UpdateContents();}function ScrollPane(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.size = new Coordinates(0,0);	this.position = new Coordinates(0,0);}ScrollPane.prototype = new Control(this.Parent);ScrollPane.prototype.GetType = function() {	return "ScrollPane";}ScrollPane.prototype.Paint = function() {	this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.overflow = "auto";	this.SetStyles();}ScrollPane.prototype.SetStyles = function() {	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";}function SplashScreen(Parent) {	this.Parent = Parent;	this.elm = this.newDiv();	this.elm.myself = this;	this.myApp = this.Parent;	this.imageURL = "";	this.size = new Coordinates(400,300);	this.position = new Coordinates(0,0);	this.centerOnScreen = true;	this.clickToClose = false;	this.transparent = false;}SplashScreen.prototype = new Control(this.Panent);SplashScreen.prototype.GetType = function() {	return "SplashScreen";}SplashScreen.prototype.Paint = function() {	this.elm.style.zIndex = "150";	this.elm.style.width = this.size.x+"px";	this.elm.style.height = this.size.y+"px";	if(this.centerOnScreen) {		this.position = new Coordinates(Math.round(window.myDesktop.size.x / 2) - Math.round(this.size.x / 2), 			Math.round(window.myDesktop.size.y / 2) - Math.round(this.size.y / 2));	}	this.elm.style.top = this.position.y+"px";	this.elm.style.left = this.position.x+"px";	if(!this.transparent)		this.elm.style.backgroundColor = "white";	this.elm.style.backgroundImage = "url("+this.imageURL+")";	this.SetEvents();	window.myDesktop.elm.appendChild(this.elm);}SplashScreen.prototype.Kill = function() {	try {		this.elm.parentNode.removeChild(this.elm);	} catch(e) {	}	this.myApp.myWindow.MakeActive();}SplashScreen.prototype.SetEvents = function() {	if(this.clickToClose) {		this.elm.onclick = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;			this.myself.Kill();		}	}}function ImageAboutBox(Parent,imageURL) {	this.Parent = Parent;	this.imageURL = imageURL;	this.myWindow = new Window(window.myDesktop);	this.myWindow.myApp = this;	this.myWindow.size = new Coordinates(this.myWindow.border.width*2 + 400, this.myWindow.border.width*2 +		this.myWindow.titleBar.height + 300);	this.myWindow.CenterWindowOnDesktop();	this.myWindow.resizeable = false;	this.myWindow.windowContent.style.backgroundImage = "url("+this.imageURL+")";	this.myWindow.titleBar.text = "About";}ImageAboutBox.prototype = new Control(this.Parent);ImageAboutBox.prototype.GetType = function() {	return "GaugeAboutBox";	}ImageAboutBox.prototype.SetStyles = function() {	}//size is a Coordinates objectImageAboutBox.prototype.SetSize = function(size) {	this.myWindow.size = new Coordinates(this.myWindow.border.width*2 + size.x, this.myWindow.border.width*2 +		this.myWindow.titleBar.height + size.y);;}ImageAboutBox.prototype.SetTitleBarText = function(text) {	this.myWindow.titleBar.text = text;	}ImageAboutBox.prototype.Paint = function() {	this.myWindow.SetStyles();	window.myDesktop.AddWindow(this.myWindow);	window.myDesktop.HideAllMenus();}function Theme() {	this.titleBarBackground = "navy";	this.windowBorder = new Border();	this.windowBorder.width = 3;	this.windowBorder.color = "navy";	this.windowBackgroundColor = "white";	this.titleBarActiveColor = "navy";	this.titleBarInactiveColor = "gray";	this.titleBarActiveText = "white";	this.titleBarInactiveText = "black";	this.titleBarTextBackground = null;	this.titleBarFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",14,"normal");	this.titleBarAlignment = "center";	this.titleBarHeight = 30;	this.titleBarBGImage = null;	this.titleBarPadding = null;	this.borderTopBGImage = null;	this.titleBarSideBGImageLeft = null;	this.titleBarSideBGImageRight = null;	this.titleBarBGImageLeft = null;	this.titleBarBGImageRight = null;	this.maximizeButtonImage = null;	this.maximizeButtonImagePressed = null;	this.maximizeButtonSize = 30;	this.closeButtonImage = null;	this.closeButtonImagePressed = null;	this.closeButtonSize = 30;	this.menuBarBackground = "#EFEDF0";	this.menuBarBottomBorder = new Border();	this.menuBarBottomBorder.color = "gray";	this.menuHighlightColor = "#335EA8";	this.menuBarFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",12,"normal");	this.menuItemFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",12,"normal");	this.menuBackgroundColor = "white";	this.menuDisabledColor = "gray";	this.buttonFont = null;	this.toolbarBackground = "#EFEDF0";	this.toolbarTopBorder = new Border();	this.toolbarTopBorder.color = "white";	this.toolbarBottomBorder = new Border();	this.toolbarBottomBorder.color = "gray";	this.iconLabelFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",12,"bold");	this.iconLabelFont.color = "white";	this.iconLabelFont.lineHeight = 15;	this.desktopBackgroundColor = "#1C60AB";	this.desktopBackgroundImage = null;	this.taskBarColor = "#EFEDF0";	this.taskBarFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",12,"bold");	this.taskBarBorderTop = new Border();	this.taskBarBorderTop.color = "black";	this.inputHighlightColor = "#E1F1FF";	this.inputNormalColor = "white";	this.inputHighlightBorder = new Border(null,1,"solid","#0099FF");	this.inputNormalBorder = new Border();	this.inputFont = new Font("'Lucida Grande', 'Trebuchet MS', Arial, Helvetica, sans-serif",13,"bold");	this.inputLabelFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",11,"normal");	this.tabPaneBgImages = new Array("images/TabL.gif","images/Tab.gif","images/TabR.gif");	this.activeTabPaneBgImages = new Array("images/ActiveTabL.gif","images/ActiveTab.gif","images/ActiveTabR.gif");	this.tabHeight = 23;	this.tabBorderWidth = 8;	this.tabFont = new Font("'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif",12,"normal");	this.tabPadding = 5;	this.tabInnerPadding = 3;}function Font(family,size,weight,color) {	this.family = family;	this.size = size;	this.weight = weight;	if(color)		this.color = color;	else		this.color = "black";	this.lineHeight = null;}Font.prototype.GetType = function() {	return "Font";}Font.prototype.ApplyFont = function(elm) {	elm.style.fontFamily = this.family;	elm.style.fontSize = this.size+"px";	elm.style.fontWeight = this.weight;	if(this.color)		elm.style.color = this.color;	if(this.lineHeight)		elm.style.lineHeight = this.lineHeight+"px";}var JSTheme = new Theme();var DefaultTheme = new Theme();var MacTheme = new Theme();MacTheme.titleBarBGImage = "images/titleBarGrey.gif";MacTheme.borderTopBGImage = "images/borderTopBgBrey.gif";MacTheme.titleBarSideBGImageLeft = "images/titleBarGreySideL.gif";MacTheme.titleBarSideBGImageRight = "images/titleBarGreySideR.gif";MacTheme.closeButtonImage = "images/osxclose.png";MacTheme.maximizeButtonImage = "images/osxmax.png";MacTheme.windowBorder.color = "#8D8D8D";MacTheme.titleBarFont = new Font("'Lucida Grande', Arial, Helvetica, sans-serif",14,"bold");MacTheme.titleBarActiveText = "black";MacTheme.titleBarInactiveText = "gray";MacTheme.closeButtonSize = 22;MacTheme.maximizeButtonSize = 22;var S7Theme = new Theme();S7Theme.titleBarBGImage = "images/s7tb.gif";S7Theme.borderTopBGImage = "images/s7bt.gif";S7Theme.windowBorder.color = "black";S7Theme.titleBarActiveText = "black";S7Theme.titleBarInactiveText = "gray";S7Theme.titleBarFont = new Font("Chicago, 'Lucida Grande', Arial, Helvetica, sans-serif",12,"normal");S7Theme.menuBarFont = new Font("Chicago,'Lucida Grande', Arial, Helvetica, sans-serif",12,"normal");S7Theme.buttonFont = new Font("Chicago,'Lucida Grande', Arial, Helvetica, sans-serif",12,"normal");S7Theme.iconLabelFont = new Font("Chicago,'Lucida Grande', Arial, Helvetica, sans-serif",12,"normal");S7Theme.iconLabelFont.color = "white";S7Theme.iconLabelFont.lineHeight = 16;S7Theme.windowBorder.width = 1;S7Theme.closeButtonImage = "images/s7close.gif";S7Theme.maximizeButtonImage = "images/s7max.gif";S7Theme.closeButtonSize = 22;S7Theme.maximizeButtonSize = 22;S7Theme.titleBarTextBackground = "white";var S7ThemeNoChicago = new Theme();S7ThemeNoChicago.titleBarBGImage = "images/s7tb.gif";S7ThemeNoChicago.borderTopBGImage = "images/s7bt.gif";S7ThemeNoChicago.windowBorder.color = "black";S7ThemeNoChicago.titleBarActiveText = "black";S7ThemeNoChicago.titleBarInactiveText = "gray";S7ThemeNoChicago.iconLabelFont.color = "white";S7ThemeNoChicago.windowBorder.width = 1;S7ThemeNoChicago.closeButtonImage = "images/s7close.gif";S7ThemeNoChicago.maximizeButtonImage = "images/s7max.gif";S7ThemeNoChicago.closeButtonSize = 22;S7ThemeNoChicago.maximizeButtonSize = 22;S7ThemeNoChicago.titleBarTextBackground = "white";S7ThemeNoChicago.titleBarPadding = 0;S7ThemeNoChicago.titleBarFont.weight =  "bold";var LeopardTheme = new Theme();LeopardTheme.titleBarBGImage = "images/leotb.gif";LeopardTheme.borderTopBGImage = "images/leotop.gif";LeopardTheme.titleBarSideBGImageLeft = "images/leoside.gif";//LeopardTheme.titleBarSideBGImageRight = "images/leoside.gif";LeopardTheme.titleBarHeight = 17;LeopardTheme.titleBarFont = new Font("'Lucida Grande', Arial, Helvetica, sans-serif",11,"bold");LeopardTheme.titleBarActiveText = "black";LeopardTheme.titleBarInactiveText = "gray";LeopardTheme.windowBorder.color = "black";LeopardTheme.windowBorder.width = 1;var GrayTheme = new Theme();GrayTheme.titleBarBGImage = "images/gray_tb.gif";GrayTheme.borderTopBGImage = "images/gray_top.gif";GrayTheme.windowBorder.color = "#959595";GrayTheme.titleBarSideBGImageLeft = "images/gray_side.gif";GrayTheme.titleBarSideBGImageRight = "images/gray_side.gif";GrayTheme.windowBorder.width = 2;GrayTheme.titleBarActiveText = "black";GrayTheme.titleBarInactiveText = "#626575";GrayTheme.titleBarFont = new Font("'Lucida Grande', 'Trebuchet MS', Arial, Helvetica, sans-serif",13,"bold");GrayTheme.titleBarPadding = -1;GrayTheme.closeButtonImage = "images/gray_closeup.gif";GrayTheme.closeButtonImagePressed = "images/gray_closedown.gif";GrayTheme.closeButtonSize = 22;GrayTheme.maximizeButtonImage = "images/gray_maxup.gif";GrayTheme.maximizeButtonImagePressed = "images/gray_maxdown.gif";GrayTheme.maximizeButtonSize = 22;function Dialog(Parent) {	this.Parent = Parent;	this.myWindow = new Window(this.Parent);	this.myWindow.resizeable = false;	this.myWindow.closeButton = false;	this.myWindow.myDialog = this;	this.myWindow.myApp = this;	this.myWindow.size = new Coordinates(300,180);	this.myWindow.disableFade = true;	this.myWindow.CenterWindowOnDesktop();	this.modal = true;	this.icon = null;	this.iconSize = new Coordinates(52,52);	this.message = null;	this.messageFont = new Font("'Lucida Grande', Arial, Helvetica, sans-serif", 12, "normal");	this.modalDiv = this.newDiv();	this.buttons = new Array();	this.buttonDiv = this.newDiv();	this.evenlySpaceButtons = false;}Dialog.prototype = new Control();Dialog.prototype.GetType = function() {	return "Dialog";	}Dialog.prototype.Paint = function() {	if(this.buttons.length > 0) {		this.buttonDiv.style.width = "100%";		this.buttonDiv.style.left = "0px";		this.buttonDiv.style.height = "50px";		this.buttonDiv.style.top = (this.myWindow.windowContentSize.y - 50)+"px"; /* "50px" */		this.buttonTable = new Table(this);		this.buttonTable.percentWidth = true;		this.buttonTable.size = new Coordinates(100,50);		this.buttonTable.elm.style.width = "100%";		this.buttonTable.border = new Border(this.buttonTable,0,"solid","white");		this.buttonRow = new TableRow(this.buttonTable);		if(this.evenlySpaceButtons)			this.buttonRow.SpaceEvenly();		this.buttonRow.defaultAlignment = "center";		this.buttonRow.defaultBorder = new Border(this.buttonRow,0,"solid","white");		var i=0;		var newCell;		for(i=0;i<this.buttons.length;i++) {			newCell = new TableCell(this.buttonRow);			newCell.elm.appendChild(this.buttons[i].elm);			//newCell.elm.style.width = (Math.round(100 / this.buttons.length))+"%";			newCell.value = "";			this.buttonRow.cells.push(newCell);		}		this.buttonTable.AddRow(this.buttonRow);		this.buttonTable.Paint();		this.buttonDiv.appendChild(this.buttonTable.elm);		this.myWindow.windowContent.appendChild(this.buttonDiv);	}	if(this.icon) {		this.iconDiv = this.newDiv();		this.iconDiv.style.width = this.iconSize.x+"px";		this.iconDiv.style.height = this.iconSize.y+"px";		this.iconDiv.style.top = "15px";		this.iconDiv.style.left = "15px";		this.iconDiv.style.backgroundImage = "url("+this.icon+")";		this.myWindow.windowContent.appendChild(this.iconDiv);	}	if(this.message) {		this.messageDiv = this.newDiv();		var messageWidth = this.myWindow.windowContentSize.x;		var messagePosition = new Coordinates(15,15);		var messagePadding = 15;		if(this.icon) {			messageWidth -= this.iconSize.x + 30;			messagePosition.x += this.iconSize.x+15;		}		this.messageDiv.style.top = messagePosition.y+"px";		this.messageDiv.style.left = messagePosition.x+"px";		this.messageDiv.style.width = messageWidth-messagePadding+"px";		this.messageDiv.style.paddingRight = messagePadding+"px";		this.messageDiv.innerHTML = this.message;		this.messageDiv.style.textAlign = "left";		this.messageFont.ApplyFont(this.messageDiv);		this.myWindow.windowContent.appendChild(this.messageDiv);	}	this.SetStyles();}Dialog.prototype.SetStyles = function() {	if(this.buttons.length > 0)  		this.buttonDiv.style.top = (this.myWindow.windowContentSize.y - 50)+"px"; /* "50px" */		//alert(this.buttonDiv.style.top);	if (this.myApp) {		try {			this.myApp.SetStyles();		} 		catch (e) {				}	}}Dialog.prototype.Kill = function(noMyApp) {	if(noMyApp!=null) {		this.myWindow.KillMe();		return;	}	try {		this.myApp.myWindow.KillMe();	} catch(e) {		this.myWindow.KillMe();	}}function TaskBar(Parent) {	this.Parent = Parent;	this.size = new Coordinates(window.myDesktop.size.x,30);	this.position = new Coordinates(0,window.myDesktop.size.y - this.size.y);	if(window.myDesktop.errorConsole)		this.position.y-=window.myDesktop.errorConsole.size.y;	this.elm = this.newDiv();	this.color = JSTheme.taskBarColor;	this.font = JSTheme.taskBarFont;	this.borderTop = JSTheme.taskBarBorderTop;	this.logoffButton = new Button("Logoff");	this.logoffButtonPosition = new Coordinates(this.size.x - 70,3);		this.Paint();}TaskBar.prototype = new Control(this.Parent);TaskBar.prototype.GetType = function() {	return "TaskBar";	}TaskBar.prototype.Paint = function() {	this.elm.style.height = this.size.y+"px";	this.elm.style.left = this.position.x+"px";	this.elm.style.backgroundColor = this.color;	this.font.ApplyFont(this.elm);	this.elm.style.borderTop = this.borderTop.CSS();	this.logoffButton.elm.style.position = "absolute";	this.logoffButton.elm.style.top = this.logoffButtonPosition.y+"px";	this.logoffButton.elm.style.textAlign = "center";	this.logoffButton.handler = User.Logoff;	this.logoffButton.SetEvents();	this.SetStyles();	document.body.appendChild(this.elm);	this.elm.appendChild(this.logoffButton.elm);}TaskBar.prototype.SetStyles = function() {	this.size.x = this.Parent.browserWindow.size.x;	this.Parent.browserWindow.size.y -= this.size.y;	this.position.y = this.Parent.browserWindow.size.y;	this.elm.style.width = this.size.x+"px";	this.elm.style.top = this.position.y-this.borderTop.width+"px";	this.logoffButtonPosition.x = this.size.x - 70;	this.logoffButton.elm.style.left = this.logoffButtonPosition.x+"px";	if(window.myDesktop.errorConsole)		this.position.y -= window.myDesktop.errorConsole.size.y;}function Pane(Parent) {	this.Parent = Parent;	this.size = new Coordinates(null,null);	this.position = new Coordinates(null,null);	this.elm = this.newDiv();	this.font = null;	this.bgColor = null;	this.border = null;	this.bgImage = null;	this.innerHTML = null;	this.textAlign = "left";	this.percentWidth = false;	this.relativePosition = false;}Pane.prototype = new Control(this.Parent);Pane.prototype.GetType = function() {	return "Pane"	}Pane.prototype.Paint = function() {	this.SetStyles();}Pane.prototype.SetStyles = function() {	if(this.size.x != null && this.size.y != null)		this.UpdateSize();	if(this.position.x != null && this.position.y != null)		this.UpdatePosition();	if(this.font)		this.font.ApplyFont(this.elm);	if(this.bgColor)		this.elm.style.backgroundColor = this.bgColor;	if(this.border)		this.elm.style.border = this.border.CSS();	if(this.bgImage)		this.elm.style.backgroundImage = "url("+this.bgImage+")";	if(this.innerHTML)		this.elm.innerHTML = this.innerHTML;	if(this.textAlign)		this.elm.style.textAlign = this.textAlign;	else		this.elm.style.textAlign = "left";	if(this.relativePosition)		this.elm.style.position = "relative";}Pane.prototype.UpdateLeft = function() {	if(this.position.x!=null)		this.elm.style.left = this.position.x+"px";	}Pane.prototype.UpdateTop = function() {	if(this.position.y!=null)		this.elm.style.top = this.position.y+"px";}Pane.prototype.UpdateWidth = function() {	if(this.size.x!=null)		if(this.size.x >=0) 			if(this.percentWidth)				this.elm.style.width = this.size.x+"%";			else				this.elm.style.width = this.size.x+"px";	}Pane.prototype.UpdateHeight = function() {	if(this.size.y >=0 && this.size.y!=null)		this.elm.style.height = this.size.y+"px";	}Pane.prototype.UpdatePosition = function() {	this.UpdateTop();	this.UpdateLeft();}Pane.prototype.UpdateSize = function() {	this.UpdateWidth();	this.UpdateHeight();}Pane.prototype.appendChild = function(child) {	if(child.elm)		child = child.elm;	this.elm.appendChild(child);}Pane.prototype.UpdateInnerHTML = function() {	this.elm.innerHTML = this.innerHTML;}Pane.prototype.UpdateFont = function() {	this.font.ApplyFont(this.elm);}Pane.prototype.SetInnerHTML = function(html) {	this.innerHTML = html;	this.UpdateInnerHTML();}Pane.prototype.SetToolTip = function(tooltip) {	this.elm.title = tooltip;}function TabbedPane(Parent,container) {	this.Parent = Parent;		this.labelElm = new Pane(this);	this.tabs = new Array();	this.activeTab = 0;	this.container = container;	this.resizing = false;	}TabbedPane.prototype = new Control(this.Parent);TabbedPane.prototype.GetType = function() {	return "TabbedPane"	}TabbedPane.prototype.Paint = function() {	var i;	for(i=0;i<this.tabs.length;i++)		this.tabs[i].Paint();	this.labelElm.percentWidth = true;	this.labelElm.size = new Coordinates(100,JSTheme.tabHeight+(JSTheme.tabPadding*2));	this.labelElm.position = new Coordinates(0,0);	this.labelElm.SetStyles();	this.container.appendChild(this.labelElm.elm);	this.SetStyles();	this.SetEvents();	this.tabs[0].MakeActive();}var TabbedPaneTimeout;var ResizingTabbedPane;TabbedPane.prototype.SetStyles = function() {	clearTimeout(TabbedPaneTimeout);	this.resizing = true;	ResizingTabbedPane = this;	this.tabs[this.activeTab].SetStyles();	setTimeout("ResizingTabbedPane.SetStylesNonActiveTabs()",1000);}TabbedPane.prototype.SetStylesNonActiveTabs = function() {	if(this.resizing) {		this.resizing = false;		var i;		for(i=0;i<this.tabs.length;i++)			if(i!=this.activeTab)				this.tabs[i].SetStyles();	}}TabbedPane.prototype.SetEvents = function() {	var i;	for(i=0;i<this.tabs.length;i++)		this.tabs[i].SetEvents();}TabbedPane.prototype.AddTab = function(label,bgColor,alignment) {	var newTab = new Tab(this,label);	newTab.index = this.tabs.length;	if(bgColor != null)		newTab.elm.bgColor = bgColor;	if(alignment != null)		newTab.elm.elm.align = alignment;	this.tabs.push(newTab);	return newTab;}TabbedPane.prototype.UpdateLefts = function() {	var i;	var left=JSTheme.tabPadding;	for(i=0;i<this.tabs.length;i++) {		if(this.tabs[i].label.elm.elm.offsetWidth)			if(this.tabs[i].label.elm.elm.offsetWidth>0) {				this.tabs[i].label.left = left;				this.tabs[i].label.UpdateLefts();				left+= this.tabs[i].label.elm.elm.offsetWidth + (JSTheme.tabBorderWidth*2);			}	}}TabbedPane.prototype.MakeAllInactive = function(except) {	var i;	for(i=0;i<this.tabs.length;i++)		if(i!=except)			this.tabs[i].MakeInactive();}function Tab(Parent,label) {	this.Parent = Parent;	this.elm = new Pane(this);		this.elm.elm.myApp = this;		this.label = new TabLabel(this,label);	this.border = new Border();	this.index = 0;	this.isActive = false;}Tab.prototype = new Control(this.Parent);Tab.prototype.GetType = function() {	return "Tab"	}Tab.prototype.Paint = function() {	this.label.Paint();	this.elm.position = new Coordinates(JSTheme.tabPadding,JSTheme.tabHeight+JSTheme.tabPadding);	this.elm.border = this.border;	this.elm.elm.style.padding = JSTheme.tabPadding+"px";	this.Parent.container.appendChild(this.elm.elm);	this.elm.SetStyles();}Tab.prototype.SetStyles = function() {	this.elm.size = new Coordinates(parseInt(this.Parent.container.style.width) - (JSTheme.tabPadding*4)-2,		parseInt(this.Parent.container.style.height) - JSTheme.tabHeight - (JSTheme.tabPadding*4)-3);		//this.elm.SetStyles();	this.elm.UpdateSize();	this.label.SetStyles();	if(this.myApp)		try {			this.myApp.SetStyles();		} catch(e) {alert(e)}}Tab.prototype.SetEvents = function() {	this.label.SetEvents();	}Tab.prototype.MakeActive = function() {	this.isActive = true;	this.Parent.MakeAllInactive(this.index);	setOpacity(this.elm.elm,10);	this.label.MakeActive();	this.SetStyles();	this.elm.elm.style.zIndex = "5";	this.Parent.activeTab = this.index;}Tab.prototype.MakeInactive = function() {	this.isActive = false;	setOpacity(this.elm.elm,0);	this.label.MakeInactive();	this.elm.elm.style.zIndex = "1";}Tab.prototype.appendChild = function(child) {	this.elm.appendChild(child);}function TabLabel(Parent,label) {	this.Parent = Parent;	this.elm = new Pane(this);	this.elmL = new Pane(this);	this.elmR = new Pane(this);	this.label = label;	this.left = 0;	this.width = 0;}TabLabel.prototype = new Control(this.Parent);TabLabel.prototype.GetType = function() {	return "TabLabel"	}TabLabel.prototype.Paint = function() {	this.elm.font = JSTheme.tabFont;	this.elm.textAlign = "center";	this.elm.innerHTML = this.label;	this.padding = Math.round(JSTheme.tabHeight / 2) - Math.round(JSTheme.tabFont.size / 2)-2;	this.elm.elm.style.paddingTop = this.padding + "px";	this.elm.position = new Coordinates(0,JSTheme.tabPadding);	this.elmL.position = new Coordinates(0,JSTheme.tabPadding);	this.elmR.position = new Coordinates(0,JSTheme.tabPadding);	this.elmL.bgImage = JSTheme.tabPaneBgImages[0];	this.elm.bgImage = JSTheme.tabPaneBgImages[1];	this.elmR.bgImage = JSTheme.tabPaneBgImages[2];	this.elmL.size = new Coordinates(JSTheme.tabBorderWidth,JSTheme.tabHeight);	this.elmR.size = new Coordinates(JSTheme.tabBorderWidth,JSTheme.tabHeight);	this.elm.size.y = JSTheme.tabHeight - this.padding;	this.elm.elm.style.paddingLeft = JSTheme.tabInnerPadding+"px";	this.elm.elm.style.paddingRight = JSTheme.tabInnerPadding+"px";	this.disableSelection(this.elm.elm);	this.elm.elm.MozUserSelect = "none";		this.Parent.Parent.labelElm.appendChild(this.elmL.elm);	this.Parent.Parent.labelElm.appendChild(this.elm.elm);	this.Parent.Parent.labelElm.appendChild(this.elmR.elm);	this.SetStyles();}TabLabel.prototype.SetStyles = function() {	this.elm.SetStyles();	this.elm.UpdateHeight();	this.elmL.SetStyles();	this.elmR.SetStyles();	if(this.elm.elm.offsetWidth)		if(this.elm.elm.offsetWidth > 0)			this.Parent.Parent.UpdateLefts();}TabLabel.prototype.SetEvents = function() {	this.elm.elm.myself = this;	this.elmL.elm.myself = this;	this.elmR.elm.myself = this;	this.elm.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		this.myself.Parent.MakeActive();	}	this.elmL.elm.onmousedown = this.elm.elm.onmousedown;	this.elmR.elm.onmousedown = this.elm.elm.onmousedown;}TabLabel.prototype.UpdateLefts = function() {	this.elmL.position.x = this.left+JSTheme.tabPadding;	this.elm.position.x = this.elmL.position.x + JSTheme.tabBorderWidth;	this.elmR.position.x = this.elm.position.x + this.elm.elm.offsetWidth;	this.width = this.elmR.position.x + JSTheme.tabBorderWidth;	this.elmL.SetStyles();	this.elm.SetStyles();	this.elmR.SetStyles();}TabLabel.prototype.MakeActive = function() {	this.elmL.bgImage = JSTheme.activeTabPaneBgImages[0];	this.elm.bgImage = JSTheme.activeTabPaneBgImages[1];	this.elmR.bgImage = JSTheme.activeTabPaneBgImages[2];	this.elmL.SetStyles();	this.elm.SetStyles();	this.elmR.SetStyles();}TabLabel.prototype.MakeInactive = function() {	this.elmL.bgImage = JSTheme.tabPaneBgImages[0];	this.elm.bgImage = JSTheme.tabPaneBgImages[1];	this.elmR.bgImage = JSTheme.tabPaneBgImages[2];		this.elmL.SetStyles();	this.elm.SetStyles();	this.elmR.SetStyles();	}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;   }function dhtmlLoadScript(url){   var e = document.createElement("script");   e.src = url;   e.type="text/javascript";   document.getElementsByTagName("head")[0].appendChild(e);}function number_format( number, decimals, dec_point, thousands_sep ) {    // http://kevin.vanzonneveld.net    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +     bugfix by: Michael White (http://getsprink.com)    // +     bugfix by: Benjamin Lupton    // +     bugfix by: Allan Jensen (http://www.winternet.no)    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)    // +     bugfix by: Howard Yeend    // +    revised by: Luke Smith (http://lucassmith.name)    // *     example 1: number_format(1234.56);    // *     returns 1: '1,235'    // *     example 2: number_format(1234.56, 2, ',', ' ');    // *     returns 2: '1 234,56'    // *     example 3: number_format(1234.5678, 2, '.', '');    // *     returns 3: '1234.57'     var n = number, prec = decimals, dec = dec_point, sep = thousands_sep;    n = !isFinite(+n) ? 0 : +n;    prec = !isFinite(+prec) ? 0 : Math.abs(prec);    sep = sep == undefined ? ',' : sep;     var s = n.toFixed(prec),        abs = Math.abs(n).toFixed(prec),        _, i;     if (abs > 1000) {        _ = abs.split(/\D/);        i = _[0].length % 3 || 3;         _[0] = s.slice(0,i + (n < 0)) +              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');         s = _.join(dec || '.');    }     return s;}function is_array(o) {	if(o != null && typeof o == 'object') {		return (typeof o.push == 'undefined') ? false : true;	} else		return false;}function JSDResizeGrabber(Parent) {	this.Parent = Parent;	this.elm = new Pane(this);	this.posCalculator = new Coordinates();	this.sizeCalculator = new Coordinates();	this.vertical = true;	this.resizing = false;	this.myApp = this.Parent.Parent;	this.minimumSize = 10;	//must define these functions for each instance	this.GetSize = null;	this.SetSize = null;		if(!this.myApp.grabbers)		this.myApp.grabbers = new Array();	this.myApp.grabbers.push(this);		this.SetEvents();}JSDResizeGrabber.prototype = new Control(this.Parent);JSDResizeGrabber.prototype.GetType = function() {	return "JSDResizeGrabber";}JSDResizeGrabber.prototype.Paint = function() {	//this.elm.elm.style.backgroundColor = "red";	this.myApp.myWindow.windowContent.appendChild(this.elm.elm);}JSDResizeGrabber.prototype.SetStyles = function() {	this.elm.size.x = this.sizeCalculator.x(this);	this.elm.size.y = this.sizeCalculator.y(this);	this.elm.position.x = this.posCalculator.x(this);	this.elm.position.y = this.posCalculator.y(this);	this.elm.SetStyles();}JSDResizeGrabber.prototype.SetEvents = function() {	if(this.vertical)		this.elm.elm.style.cursor = "e-resize";	else		this.elm.elm.style.cursor = "n-resize";	this.elm.elm.myApp = this;	this.elm.elm.onmousedown = function(e) {		if(window.event)			e = window.event;		e.cancelBubble = true;		this.myApp.MoveStart(e);	}	if(!this.Parent.Parent.myWindow.windowContent.onmousemove) {		this.Parent.Parent.myWindow.windowContent.onmousemove = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;			if(this.myWindow.myApp)				this.myWindow.myApp.ResizeGrabbers(e);		}	}	if(!this.myApp.myWindow.windowContent.onmouseup) {		this.myApp.myWindow.windowContent.onmouseup = function(e) {			if(window.event)				e = window.event;			e.cancelBubble = true;			this.myWindow.myApp.StopResizing();		}	}}JSDResizeGrabber.prototype.MoveStart = function(e) {	if(this.vertical)		this.startPos = e.clientX;	else		this.startPos = e.clientY;	this.startSize = this.GetSize();	this.resizing = true;}JSDResizeGrabber.prototype.Update = function(x,y) {	if(this.resizing) {		//window.myDesktop.errorConsole.Add(x+", "+y);		if(this.vertical)			var diff = x - this.startPos;		else			var diff = y - this.startPos;		//window.myDesktop.errorConsole.Add(this.startSize);		if(this.startSize+diff >= this.minimumSize)			this.SetSize(this.startSize+diff);		for(var i=0;i<this.myApp.grabbers.length;i++)			this.myApp.grabbers[i].SetStyles();	}}JSDResizeGrabber.prototype.StopResizing = function() {	this.resizing = false;}function JSDExpandableList(Parent) {	this.Parent = Parent;	this.elm = new Pane(this);}JSDExpandableList.prototype = new Control(this.Parent);JSDExpandableList.prototype.GetType = function() {	return "JSDExpandableList";}