function MyAlert(topHeading,SUBMIT,CLOSE){//MyAlert Class, represents alert box within application 
	//Container Div id for Alert Box
	this.alertBag = "alertBag";
	this.topHeading = topHeading;
	this.SUBMIT = SUBMIT;
	this.CLOSE = CLOSE; 
	//this.Open = function(Heading,Text,Action,ActionName)
	this.Open = function(Heading,Text,Action,ActionName,Code){//Shows Alert Box
		if (!Action) Action = "myAlert0.style.display=\'none\';myAlert0.parentElement.style.display=\'none\';";
		if (!Code) Code = ']';		
		//if (!ActionName)
			//ActionName = this.SUBMIT;
			//ActionName = "OK";
		//this.myAlert(this.topHeading,Heading,Text,Action,ActionName,this.alertBag);
		this.myAlert(topHeading,Heading,Text,Action,ActionName,this.alertBag,Code);
	}
	//Gives parameters to myAlertOne (TopHeading-text in window bar, MainHeding-headline text, Action-action function, ActionName-action button text, DisplayDiv-alert box container div id)
	this.myAlert = function(TopHeding,MainHeding,Text,Action,ActionName,DisplayDiv,code){
		this.myAlertOne(TopHeding,MainHeding,Text,Action,ActionName,DisplayDiv,code);
	}
	//Creates alert box
	this.myAlertOne = function (TopHeding,MainHeding,Text,Action,ActionName,DisplayDiv,code){
		try{
		if (TopHeding=="")
			TopHeding = "Alert";
		if (MainHeding=="")
			MainHeding = "Alert";
		if (Text=="")
			Text = "No text to display";
		/*if (MYALERT_CLOSE_MSG==null)
			MYALERT_CLOSE_MSG = "Close";*/
		if(Action==null && ActionName==null)
			this.CLOSE = this.SUBMIT;
			//MYALERT_CLOSE_MSG = msg55;
		//Imgcode
		myAlertHTML = 
		'<div class="moveme" id="myAlert0">'+
		'<table class="alertTable" border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="100%" class="alertTopHeading" id="myAlertTopHading">'+
		'<div onmouseup="moveme_onmouseup();" onmousemove="moveme_onmousemove();" onmousedown="moveme_onmousedown()" unselectable="on">&nbsp;&nbsp;&nbsp;<strong class="normal">'+TopHeding+'</strong></div></td>'+
		'</tr><tr><td width="100%" valign="top" class="colonebg"><table border="1" cellpadding="10" cellspacing="0" class="alertMain" width="100%"><tr><td width="25%" align="center" id="myAlertImage" class="GuideSymbol400" valign="top"><span class="darkFont">&nbsp;</span></td>'+
		'<td class="bgwhite" width="75%" valign="top" id="myAlertMain"><h4>'+MainHeding+'</h4>'+
		'<p class="normal">'+Text+'</p><hr class="alertMainHR">'+
		'<div align="right">';
		if(Action!=null && ActionName!=null)
			if (Action.length>0 && ActionName.length>0)
				myAlertHTML +='<button class="Button1Class" onclick="'+Action+'">'+ActionName+'</button>';
		myAlertHTML +='&nbsp;&nbsp;&nbsp;<button class="Button1Class" onclick="myAlert0.style.display=\'none\';myAlert0.parentElement.style.display=\'none\';" ID="closeAlertButton">'+this.CLOSE+'</button></div>'+
		'</td></tr></table></td></tr></table></div>';
		if (document.all[DisplayDiv]){
			document.all[DisplayDiv].innerHTML = myAlertHTML;
			if (document.all[DisplayDiv].style.display == "none")
				document.all[DisplayDiv].style.display = "";
		}
		if (document.all["myAlert0"]){
			if (document.all["myAlert0"].style.display == "none")
				document.all["myAlert0"].style.display = "";
			this.doCenter(document.all["myAlert0"],200,75);
		}
		}catch(e){//alert(e.description);
			return;
		}
	}
	this.doCenter = function (divId,wdivId,hdivId){//Centers alert box
		divId.style.top  = (document.body.offsetHeight/2) - hdivId + 30;
		divId.style.left = (document.body.offsetWidth/2) - wdivId - 200;
	}
	this.Close = function(){//Closes alert box
		try{
			document.all["myAlert0"].style.display='none';
			document.all["myAlert0"].parentElement.style.display='none';
		}catch(e){
			error = e.description;
		}
	}
}
var tempx, tempy, offsetx, offsety;
function beginDrag(el){
	offsetx = event.clientX;
	offsety = event.clientY;
	tempx=parseInt(el.style.left);
	tempy=parseInt(el.style.top);
	document.onmousemove=moveme_onmousemove;
}		
function doDrag(){
	if (objMM.dragObject && event.button==1) {
		try{
			objMM.dragObject.style.left=tempx+event.clientX-offsetx;
			objMM.dragObject.style.top=tempy+event.clientY-offsety;
		}
		catch(e){//alert(e.description)
		}
	}
}
function endDrag(){
	if(objMM.dragObject){
		objMM.dragObject.releaseCapture();
		objMM.dragObject = null;
	}
	document.onmousemove=null;
}
function MoveMe(){
	this.checkZIndex = true;
	this.dragObject = null;
	this.tx;
	this.ty;
	this.ie5 = document.all != null && document.getElementsByTagName != null;
}
var objMM = new MoveMe();
function getReal(el){
	temp = el;
	while ((temp != null) && (temp.tagName != "BODY")) {
		if ((temp.className == "moveme") || (temp.className == "handle")){
			el = temp;
			return el;
		}
		temp = temp.parentElement;
	}
	
	return el;
}
function moveme_onmousedown(){
	el = getReal(window.event.srcElement)
	if (!(el.className == "moveme" || el.className == "handle")){	
		objMM.dragObject = null;
		return;
	}
	if (el.className == "handle"){
		tmp = el.getAttribute("handlefor");
		if (tmp == null) {
			objMM.dragObject = null;
			return;
		}
		else
			objMM.dragObject = eval(tmp);
	}
	else 
		objMM.dragObject = el;
	if (objMM.checkZIndex) makeOnTop(objMM.dragObject);
	objMM.ty = window.event.clientY - getTopPos(objMM.dragObject);
	objMM.tx = window.event.clientX - getLeftPos(objMM.dragObject);
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	objMM.dragObject.setCapture(false);
	beginDrag(objMM.dragObject);
}
function moveme_onmouseup() {
	endDrag();
}
function moveme_onmousemove() {
	if (objMM.dragObject) {
		doDrag(objMM.dragObject);
	}
}
function getLeftPos(el) {
	return ((!objMM.ie5) ? el.style.pixelLeft : ((el.currentStyle.left == "auto") ? 0 : parseInt(el.currentStyle.left)));
}
function getTopPos(el) {
	return ((!objMM.ie5) ? el.style.pixelTop : ((el.currentStyle.top == "auto") ? 0 : parseInt(el.currentStyle.top)));
}
function makeOnTop(el) {
	var daiz;
	var max = 0;
	var da = document.all;
	for (var i=0; i<da.length; i++) {
		daiz = da[i].style.zIndex;
		if (daiz != "" && daiz > max)
			max = daiz;
	}
	el.style.zIndex = max + 1;
}
function MyEdit(topHeding,CLOSE){//MyEdit Class, represents edit box within application
	this.editBag = "editBag";
	this.topHeding = topHeding;
	//this.SUBMIT = SUBMIT;
	this.CLOSE = CLOSE;
	this.Open = function(Heading,Text,Action,ActionName,Code){//Shows Edit box
			if(!Code) Code = '[';
			this.myEdit(topHeding,Heading,Text,Action,ActionName,this.editBag,Code);
	}
	this.myEdit = function(topHeding,Heading,Text,Action,ActionName,DisplayDiv,code){//Paramterizes myEditOne function
			width = "500";
			this.myEditOne(topHeding,Heading,Text,Action,ActionName,DisplayDiv,code,width)
	}
	this.myEditOne = function(TopHeding,MainHeding,Text,Action,ActionName,DisplayDiv,code,width){//Creates Edit box
		myEditHTML = 
		'<div class="moveme" id="myEdit0" width="+width+">'+
		'<table border="1" cellpadding="0" cellspacing="0" class="alertTable" width="100%"><tr><td width="100%" class="alertTopHeading" id="myEditTopHading">'+
		'<div onmouseup="moveme_onmouseup();" onmousemove="moveme_onmousemove();" onmousedown="moveme_onmousedown()" unselectable="on">&nbsp;&nbsp;&nbsp;<b class="normal">'+TopHeding+'<b></div></td></tr><tr>'+
		'<td width="100%" valign="top" class="bgwhite"><table border="1" cellpadding="10" cellspacing="0" class="alertMain" width="100%"><tr>'+
		'<td width="100%" valign="top" id="myEditMain">'+
		'<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top" class="GuideSymbol400">&nbsp;</td>'+
		'<td valign="top" align="center"><h4 align="center">'+MainHeding+'</h4></td></tr></table>'+
		'<p class="normal">'+Text+'</p><hr class="alertMainHR">'+
		'<div align="right">';
		
		if (Action.length>0 && ActionName.length>0)
			myEditHTML +='<button class="Button1Class" onclick="'+Action+'">'+ActionName+'</button>';
		
		myEditHTML +='&nbsp;&nbsp;&nbsp;<button class="Button1Class" onclick="myEdit0.style.display=\'none\';myEdit0.parentElement.style.display=\'none\';" ID="closeEditButton">'+this.CLOSE+'</button></div>'+
		'</td></tr></table></td></tr></table></div>';
		try{
			if (document.all[DisplayDiv]){
				document.all[DisplayDiv].innerHTML = myEditHTML;
				document.all[DisplayDiv].style.display = "";
			}
		}catch(e){//alert(e.description);
			return;
		}
		if (document.all["myEdit0"]){
			if (document.all["myEdit0"].style.display == "none")
				document.all["myEdit0"].style.display = "";
			this.doCenter(document.all["myEdit0"],200,150);
		}
	}
	this.doCenter = function (divId,wdivId,hdivId){//Centers alert box
		divId.style.top  = (document.body.offsetHeight/2) - hdivId + 30;
		divId.style.left = (document.body.offsetWidth/2) - wdivId - 150;
	}
	this.Close = function (){//Closes edit box
		try{
			document.all["myEdit0"].style.display = 'none';
			document.all["myEdit0"].parentElement.style.display='none';
		}
		catch(e){error = e.description;
		}
	}
}