// Property of Brent Cole Consulting
// Global Script
// Version: 1.7
// Dated: 9/21/2006

incompatibleURL = 'incompatible.htm';
is = new DomSniffer();
debugRunning = false;

function DomSniffer() {
	var browser,version,thestring,os;
	var detect = navigator.userAgent.toLowerCase();
	var checkIt = function(string){
		place = detect.indexOf(string)+1;
		thestring = string;
		return place;
	}
	this.afterLoad = function(minWidth, minHeight) {
		this.domStrict = (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth>0)?true:false;
		this.domQuirk = (!this.domStrict)?true:false;
		this.minWidth = minWidth;
		this.minHeight = minHeight;
		if (this.browser=='Safari') {
			this.domStrict = false;
			this.domQuirk = false;
			this.domOdd = true;
		}
		if (this.browser=='Opera') {
			this.domStrict = false;
			this.domQuirk = true;
			this.domOdd = false;
		}
		if (this.domStrict) {
			this.clientOrigWidth = document.documentElement.clientWidth;
			this.clientOrigHeight = document.documentElement.clientHeight;
		}else if (this.domQuirk) {
			this.clientOrigWidth = document.body.clientWidth;
			this.clientOrigHeight = document.body.clientHeight;
		}else if (this.domOdd) {
			this.clientOrigWidth = window.innerWidth;
			this.clientOrigHeight = window.innerHeight;
		}else {
			window.location.href = incompatibleURL;
		}
		if (this.clientOrigWidth < minWidth) {
			this.clientWidth = minWidth;
		}else{
			this.clientWidth = this.clientOrigWidth;
		}
		if (this.clientOrigHeight < minHeight) {
			this.clientHeight = minHeight;
		}else{
			this.clientHeight = this.clientOrigHeight;
		}
		if(!debugRunning) runDebug();
	}
	this.ua = detect;
	if (checkIt('konqueror')) browser = "Konqueror";
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV"
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('camino')) browser = "Camino"
	else if (checkIt('firefox')) browser = "FireFox"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (checkIt('netscape6')) browser = "Netscape6"
	else if (checkIt('netscape')) browser = "Netscape"
	else if (checkIt('rv')) browser = "Mozilla"
	else browser = "Other";
	this.browser = browser;
	version = detect.substr(place+thestring.length, 3);
	if (browser == "Safari") {
		if (version<100) version = '1.0'
		else if (version<200) version = '1.1'
		else if (version<300) version = '1.2'
		else if (version<400) version = '1.3'
		else version = '2.0';
	}
	this.version = version;
	if (checkIt('linux')) os = "Linux"
	else if (checkIt('x11')) os = "Unix"
	else if (checkIt('mac')) os = "Mac"
	else if (checkIt('win')) os = "Windows"
	else os = "Other";
	this.os = os;
	if ((this.browser=="Opera") && (this.version<7)) this.browser = "Opera6";
	this.dom = (document.getElementById && document.createElement && (this.browser!='Netscape6') && (this.browser!='Opera6'))?true:false;
	this.domStrict = false;
	this.domQuirk = false;
	this.domOdd = false;
	if (!this.dom) {
		window.location.href = incompatibleURL;
	}
}

function getStyleSheetItem(sheetNum, classID, style) {
	if (is.browser=='Opera') return '';
	var ss = document.styleSheets[sheetNum];
	var res = -1;
	var tmp = '';
	if (is.browser=='Internet Explorer') {
		var tot = ss.rules.length;
		var pre = (is.os=='Mac')?'*':'';
		for (i=0;i<tot;i++) {
			tmp = pre+'.'+classID;
			if (ss.rules[i].selectorText.toLowerCase()==tmp.toLowerCase()) res = i;
		}
		if (res>=0) {
			return eval('ss.rules[res].style.'+style);
		}else{
			return '';
		}
	}else{
		var tot = ss.cssRules.length;
		for (i=0;i<tot;i++) {
			tmp = '.'+classID
			if (ss.cssRules[i].selectorText.toLowerCase()==tmp.toLowerCase()) res = i;
		}
		if (res>=0) {
			return eval('ss.cssRules['+res+'].style.'+style);
		}else{
			return '';
		}
	}
}

function LayerObj(id) {
	this.obj = document.getElementById(id);	
	this.id = id;
	this.obj.layerObj = this;
	if (is.browser=='Safari') {
		this.zIndex = getStyleSheetItem(0, this.id, 'zIndex');
		var tmp = getStyleSheetItem(0, this.id, 'visibility');
		this.visible = (tmp == 'visible' || tmp == 'inherit' || tmp == '');
		this.cursor = getStyleSheetItem(0, this.id, 'cursor');
	}else if (window.getComputedStyle) {
		this.zIndex = window.getComputedStyle(this.obj,null).getPropertyValue("z-index");
		var tmp = window.getComputedStyle(this.obj,null).getPropertyValue("visibility");
		this.visible = (tmp == 'visible' || tmp == 'inherit' || tmp == '');
		this.cursor = window.getComputedStyle(this.obj, null).getPropertyValue("cursor");
	}else if (this.obj.currentStyle) {
		this.zIndex = this.obj.currentStyle.zIndex;
		var tmp = this.obj.currentStyle.visibility;
		this.visible = (tmp == 'visible' || tmp == 'inherit' || tmp == '');
		this.cursor = this.obj.currentStyle.cursor;
	}else {
		this.zIndex = 0;
		this.visible = true;
		this.cursor = 'fail';
	}
	if (this.cursor=='' || this.cursor=='default') this.cursor = 'auto';
	if (this.cursor=='hand') this.cursor = 'pointer';

	this.left = this.obj.offsetLeft;
	this.top = this.obj.offsetTop;
	this.width = this.obj.offsetWidth;
	this.height = this.obj.offsetHeight;
	this.right = this.left + this.width;
	this.bottom = this.top + this.height;
	this.resizeSet = false;		

	this.setLeft = function(posLeft) {
		var dist = posLeft - this.left;
		this.left = posLeft;
		this.right = this.right + dist;
		this.obj.style.left = this.left+'px';
	}
	this.setRight = function(posRight) {
		var dist = posRight - this.right;
		this.right = posRight;
		this.left = this.left + dist;
		this.obj.style.left = this.left+'px'
	}
	this.setTop = function(posTop) {
		var dist = posTop - this.top;
		this.top = posTop;
		this.bottom = this.bottom + dist;
		this.obj.style.top = this.top+'px';
	}
	this.setBottom = function(posBottom) {
		var dist = posBottom - this.bottom;
		this.bottom = posBottom;
		this.top = this.top + dist;
		this.obj.style.top = this.top+'px';
	}
	this.setPos = function(posLeft, posTop) {
		var dist = posLeft - this.left;
		this.left = posLeft;
		this.right = this.right + dist;
		this.obj.style.left = this.left+'px';
		var dist = posTop - this.top;
		this.top = posTop;
		this.bottom = this.bottom + dist;
		this.obj.style.top = this.top+'px';
	}
	this.setWidth = function(newWidth) {
		this.width = newWidth;
		this.right = this.left + this.width;
		this.obj.style.width = this.width+'px';
	}
	this.setHeight = function(newHeight) {
		this.height = newHeight;
		this.bottom = this.top + this.height;
		this.obj.style.height = this.height+'px';
	}
	this.setSize = function(newWidth, newHeight) {
		this.width = newWidth;
		this.right = this.left + this.width;
		this.obj.style.width = this.width+'px';
		this.height = newHeight;
		this.bottom = this.top + this.height;
		this.obj.style.height = this.height+'px';
	}
	this.setVisible = function(state) {
		if (state) {
			this.visible = true;
			this.obj.style.visibility = "visible";
		}else{
			this.visible = false;
			this.obj.style.visibility = "hidden";
		}
	}
	this.setZindex = function(newZindex) {
		this.zIndex = newZindex;
		this.obj.style.zIndex = newZindex;
	}
	this.setCursor = function(cursor) {
		this.cursor = cursor;
		if (cursor=='pointer' && is.browser=='Internet Explorer' && is.domQuirk) {
			cursor = 'hand';
		}
		this.obj.style.cursor = cursor;
	}
	this.setCenter = function() {
		var par = this.obj.parentNode;
		var newL = Math.round((par.offsetWidth-this.width)/2);
		var newT = Math.round((par.offsetHeight-this.height)/2);
		this.setPos(newL, newT);
	}
	this.setCenterH = function() {
		var par = this.obj.parentNode;
		var newL = Math.round((par.offsetWidth-this.width)/2);
		this.setLeft(newL);
	}
	this.setCenterV = function() {
		var par = this.obj.parentNode;
		var newT = Math.round((par.offsetHeight-this.height)/2);
		this.setTop(newT);
	}
	this.initResizeContainer = function(origContentWidth, origContentHeight) {
		contentObj = this;
		this.origWidth = origContentWidth;
		this.origHeight = origContentHeight;
		this.origRatio = (origContentWidth / origContentHeight);
	}
	this.initResize = function(origLeft, origTop, origWidth, origHeight, constrain) {
		this.origLeft = origLeft;
		this.origTop = origTop;
		this.origWidth = origWidth;
		this.origHeight = origHeight;
		this.constrain = constrain;
		this.resizeSet = true;		
	}
	this.resize = function(center) {
		var nRatio = (contentObj.width / contentObj.height);
		var wRatio = (contentObj.width / contentObj.origWidth);
		var hRatio = (contentObj.height / contentObj.origHeight);
		if (this.constrain && (nRatio < contentObj.origRatio)) hRatio = wRatio;
		if (this.constrain && (nRatio > contentObj.origRatio)) wRatio = hRatio;
		this.setSize(Math.round(this.origWidth*wRatio), Math.round(this.origHeight*hRatio));
		if (center) {
			this.setCenter(contentObj);
		} else {
			this.setPos(Math.round(this.origLeft*wRatio), Math.round(this.origTop*hRatio));
		}
	}
	this.textResize = function(fs, lh) {
		defRat = this.origWidth/this.origHeight;
		var maxHeight = (this.width/this.height < defRat)?(this.width/defRat):this.height;
		var maxWidth = (this.width/this.height > defRat )?(this.height*defRat):this.width;
		lhRat = this.origHeight/lh;
		fsRat = this.origWidth/fs;
		lhNew = Math.round(maxHeight/lhRat);
		fsNew = Math.round(maxWidth/fsRat);
		this.obj.style.lineHeight = lhNew+'px';
		this.obj.style.fontSize = fsNew+'px';
	}
}

function getEventObj(e) {
	if (!e) e = window.event;
	var trg = null;
	if (e.target) {trg = e.target;}else if(e.srcElement){trg = e.srcElement;}
	return trg;
}

var globalNumb = '0123456789';
var globalNumbpunc = '.+-$';
var globalLwr = 'abcdefghijklmnopqrstuvwxyz';
var globalUpr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function isValid(parm,val) {
	if (parm == "") return true;
	for (i=0; i<parm.length; i++) {
		if (val.indexOf(parm.charAt(i),0) == -1) return false;
	}
	return true;
}
function isNum(parm) {return isValid(parm,globalNumb);}
function isDec(parm) {return isValid(parm, globalNumb+globalNumbpunc);}
function isLower(parm) {return isValid(parm,globalLwr);}
function isUpper(parm) {return isValid(parm,globalUpr);}
function isAlpha(parm) {return isValid(parm,globalLwr+globalUpr);}
function isAlphaNum(parm) {return isValid(parm,globalLwr+globalUpr+globalNumb);}

function numToDblStr(num) {
	num = '0'+num;
	return num.substr(num.length-2, 2);
}

function fixDec(num) {
	if (isNaN(num) || (num < 0)) num = 0;
	var tmp = ''+Math.round(num*100);
	if (tmp.length==1) tmp = '00'+tmp;
	if (tmp.length==2) tmp = '0'+tmp;
	return tmp.substr(0, tmp.length-2) + '.' + tmp.substr(tmp.length-2, 2);
}

function activateObj(s) {
	document.writeln(s);
}

function updateScreen() {  // REQUIRES USER TO ALLOW POPUPS - DO NOT USE UNLESS NECESSARY
	var dialogScript = "window.setTimeout(function() { window.close(); }, 1);";
	var result = window.showModalDialog('javascript:document.writeln("<script>' + dialogScript + '</script>")');
}

// cursors:	auto, pointer, crosshair, default, help, move, progress, text, wait

//function runDebug() {}

// DEBUG / LAYOUT SCRIPT - REMOVE FROM FINAL PRODUCTION

function runDebug() {
	debugRunning = true;
	var par = document.body;
	
	var elm01 = document.createElement('DIV');
	elm01.id = 'debugDiv';
	elm01.style.position = 'absolute';
	par.insertBefore(elm01,par.firstChild);
	dbDiv = new LayerObj('debugDiv');
	dbDiv.setPos(25,25);
	dbDiv.setSize(250,250);
	dbDiv.setZindex(100);
	dbDiv.setVisible(false);

	dbPlate = appendElem('IMG', 'debugPlate', dbDiv.obj);
	dbPlate.obj.src = 'scripts/debugplate.gif';
	dbPlate.obj.border = '3px';
	dbPlate.setPos(0,0);
	dbPlate.setSize(245,245);
	
	dbClose = appendElem('IMG', 'debugClose', dbDiv.obj);
	dbClose.obj.src = 'scripts/debugclose.gif';
	dbClose.setPos(221,5);

	dbResize = appendElem('IMG', 'debugResize', dbDiv.obj);
	dbResize.obj.src = 'scripts/debugresize.gif';
	dbResize.setPos(194,5);

	dbLabel1 = appendText('debugLabel1', dbDiv.obj, 'Id');
	dbLabel1.setPos(30,5);
	dbEdit1 = appendElem('INPUT', 'debugEdit1', dbDiv.obj);
	dbEdit1.obj.type = 'text';
	dbEdit1.obj.readOnly = true;
	dbEdit1.setPos(50,5);
	dbEdit1.setSize(100,14);

	dbLabel2 = appendText('debugLabel2', dbDiv.obj, 'Parent');
	dbLabel2.setPos(5,27);
	dbEdit2 = appendElem('INPUT', 'debugEdit2', dbDiv.obj);
	dbEdit2.obj.type = 'text';
	dbEdit2.obj.readOnly = true;
	dbEdit2.setPos(50,27);
	dbEdit2.setSize(100,14);

	dbLabel3 = appendText('debugLabel3', dbDiv.obj, 'Lt');
	dbLabel3.setPos(5,55);
	dbEdit3 = appendElem('INPUT', 'debugEdit3', dbDiv.obj);
	dbEdit3.obj.type = 'text';
	dbEdit3.obj.readOnly = true;
	dbEdit3.setPos(53,55);
	dbEdit3.setSize(30,14);

	dbLabel5 = appendText('debugLabel5', dbDiv.obj, 'Top');
	dbLabel5.setPos(100,55);
	dbEdit5 = appendElem('INPUT', 'debugEdit5', dbDiv.obj);
	dbEdit5.obj.type = 'text';
	dbEdit5.obj.readOnly = true;
	dbEdit5.setPos(155,55);
	dbEdit5.setSize(30,14);

	dbLabel9 = appendText('debugLabel9', dbDiv.obj, 'Width');
	dbLabel9.setPos(5,77);
	dbEdit9 = appendElem('INPUT', 'debugEdit9', dbDiv.obj);
	dbEdit9.obj.type = 'text';
	dbEdit9.obj.readOnly = true;
	dbEdit9.setPos(53,77);
	dbEdit9.setSize(30,14);

	dbLabel10 = appendText('debugLabel10', dbDiv.obj, 'Height');
	dbLabel10.setPos(100,77);
	dbEdit10 = appendElem('INPUT', 'debugEdit10', dbDiv.obj);
	dbEdit10.obj.type = 'text';
	dbEdit10.obj.readOnly = true;
	dbEdit10.setPos(155,77);
	dbEdit10.setSize(30,14);

	dbLabel4 = appendText('debugLabel4', dbDiv.obj, 'Rt');
	dbLabel4.setPos(5,105);
	dbEdit4 = appendElem('INPUT', 'debugEdit4', dbDiv.obj);
	dbEdit4.obj.type = 'text';
	dbEdit4.obj.readOnly = true;
	dbEdit4.setPos(53,105);
	dbEdit4.setSize(30,14);

	dbLabel6 = appendText('debugLabel6', dbDiv.obj, 'Bot');
	dbLabel6.setPos(100,105);
	dbEdit6 = appendElem('INPUT', 'debugEdit6', dbDiv.obj);
	dbEdit6.obj.type = 'text';
	dbEdit6.obj.readOnly = true;
	dbEdit6.setPos(155,105);
	dbEdit6.setSize(30,14);

	dbLabel7 = appendText('debugLabel7', dbDiv.obj, 'Ofs Rt');
	dbLabel7.setPos(5,127);
	dbEdit7 = appendElem('INPUT', 'debugEdit7', dbDiv.obj);
	dbEdit7.obj.type = 'text';
	dbEdit7.obj.readOnly = true;
	dbEdit7.setPos(53,127);
	dbEdit7.setSize(30,14);

	dbLabel8 = appendText('debugLabel8', dbDiv.obj, 'Ofs Bot');
	dbLabel8.setPos(100,127);
	dbEdit8 = appendElem('INPUT', 'debugEdit8', dbDiv.obj);
	dbEdit8.obj.type = 'text';
	dbEdit8.obj.readOnly = true;
	dbEdit8.setPos(155,127);
	dbEdit8.setSize(30,14);

	dbLabel11 = appendText('debugLabel11', dbDiv.obj, 'z-Index');
	dbLabel11.setPos(5,155);
	dbEdit11 = appendElem('INPUT', 'debugEdit11', dbDiv.obj);
	dbEdit11.obj.type = 'text';
	dbEdit11.obj.readOnly = true;
	dbEdit11.setPos(53,155);
	dbEdit11.setSize(30,14);

	dbLabel12 = appendText('debugLabel12', dbDiv.obj, 'Cl-W');
	dbLabel12.setPos(5,210);
	dbEdit12 = appendElem('INPUT', 'debugEdit12', dbDiv.obj);
	dbEdit12.obj.type = 'text';
	dbEdit12.obj.readOnly = true;
	dbEdit12.setPos(53,210);
	dbEdit12.setSize(30,14);

	dbLabel13 = appendText('debugLabel13', dbDiv.obj, 'Cl-H');
	dbLabel13.setPos(100,210);
	dbEdit13 = appendElem('INPUT', 'debugEdit13', dbDiv.obj);
	dbEdit13.obj.type = 'text';
	dbEdit13.obj.readOnly = true;
	dbEdit13.setPos(155,210);
	dbEdit13.setSize(30,14);

	dbRadioDiv = appendElem('DIV', 'debugRadioDiv', dbDiv.obj);
	dbRadioDiv.setPos(5,183);
	var innObj = dbRadioDiv.obj;
	innObj.innerHTML = 'Position ';
	innObj.innerHTML = innObj.innerHTML + '<input name="debugRadio" type="radio" id="debugRadio1" checked>';
	innObj.innerHTML = innObj.innerHTML + 'Size';
	innObj.innerHTML = innObj.innerHTML + '<input name="debugRadio" type="radio" id="debugRadio2">';
	dbRadio1 = document.getElementById('debugRadio1');
	dbRadio2 = document.getElementById('debugRadio2');

	dbClearDiv = appendElem('DIV', 'debugClearDiv', dbDiv.obj);
	dbClearDiv.setPos(167, 4);
	var innObj2 = dbClearDiv.obj;
	innObj2.innerHTML = '<input type="button" id="debugClearButton" value="Clr">';
	dbClearBut = new LayerObj('debugClearButton');
	dbClearBut.setSize(27,27);

	debugMoveState = false;
	debugLayoutMode = true;
	document.onkeydown=debugProcessKey;
	debugHide();
}

function appendElem(type, id, par) {
	var tmp = document.createElement(type);
	tmp.id = id;
	tmp.style.position = 'absolute';
	par.appendChild(tmp);
	return new LayerObj(id);
}

function appendText(id, par, text) {
	var div = appendElem('DIV', id, par);
	var txt = document.createTextNode(text);
	div.obj.appendChild(txt);
	return div;
}

function debugShow(e) {
	debugClear();
	dbDiv.setVisible(true);
	dbEdit12.obj.value = is.clientWidth;
	dbEdit13.obj.value = is.clientHeight;
	document.onclick=debugProcessMouse;
}

function debugHide() {
	dbDiv.setVisible(false);
	document.onclick=null;
	debugClear();
}

function debugResize() {
	var winW = is.minWidth + 200;
	var winH = is.minHeight + 300;
	window.resizeTo(winW, winH);
	winW = document.documentElement.clientWidth;
	winH = document.documentElement.clientHeight;
	winW = winW-is.minWidth;
	winH = winH-is.minHeight;
	winW = is.minWidth + 200 - winW;
	winH = is.minHeight + 300 - winH;
	window.resizeTo(winW, winH);
	Load();
	dbEdit12.obj.value = is.clientWidth;
	dbEdit13.obj.value = is.clientHeight;
}

function debugProcessMouse(e) {
	var obj = getEventObj(e);
	if(debugMoveState){
		debugStopMove(e);
	}else if(obj==dbClose.obj){
		debugHide();
	}else if(obj==dbResize.obj){
		debugResize();
	}else if(obj.id=='debugClearButton'){
		debugClear();
	}else if(obj.id=='debugRadio1'){
		debugLayoutMode = true;
		obj.blur();
	}else if(obj.id=='debugRadio2'){
		debugLayoutMode = false;
		obj.blur();
	}else if(obj.parentNode.id=='debugDiv'){
		if(obj.id=='debugPlate') debugStartMove(e);
	}else{
		if (obj.parentNode.nodeName=='#document'){
			dbEdit1.obj.value = 'BODY'
			dbEdit2.obj.value = 'HTML'
		}else if(obj.parentNode.nodeName=='BODY'){
			dbEdit1.obj.value = obj.id;
			dbEdit2.obj.value = 'BODY'
		}else{
			dbEdit1.obj.value = obj.id;
			dbEdit2.obj.value = obj.parentNode.id;
		}
		if(dbEdit1.obj.value=='BODY'){
			dbEdit3.obj.value = '';
			dbEdit4.obj.value = '';
			dbEdit5.obj.value = '';
			dbEdit6.obj.value = '';
			dbEdit7.obj.value = '';
			dbEdit8.obj.value = '';
			dbEdit9.obj.value = is.clientWidth;
			dbEdit10.obj.value = is.clientHeight;
			dbEdit11.obj.value = '';
			dbEdit12.obj.value = is.clientWidth;
			dbEdit13.obj.value = is.clientHeight;
		}else{
			dbEdit3.obj.value = obj.layerObj.left;
			dbEdit4.obj.value = obj.layerObj.right;
			dbEdit5.obj.value = obj.layerObj.top;
			dbEdit6.obj.value = obj.layerObj.bottom;
			if (obj.parentNode.nodeName=='BODY'){
				dbEdit7.obj.value = is.clientWidth-(obj.layerObj.right);
				dbEdit8.obj.value = is.clientHeight-(obj.layerObj.bottom);
			}else{
				dbEdit7.obj.value = obj.parentNode.offsetWidth-(obj.layerObj.right);
				dbEdit8.obj.value = obj.parentNode.offsetHeight-(obj.layerObj.bottom);
			}
			dbEdit9.obj.value = obj.layerObj.width;
			dbEdit10.obj.value = obj.layerObj.height;
			dbEdit11.obj.value = obj.layerObj.zIndex;
			dbEdit12.obj.value = is.clientWidth;
			dbEdit13.obj.value = is.clientHeight;
		}
	}
}

function debugProcessKey(e) {
	if (!e) e = window.event;
	if(e.ctrlKey && (e.keyCode==68 || e.keyCode==100)) {
		(dbDiv.visible)?debugHide():debugShow();
	} else if(e.keyCode>36 && e.keyCode<41 && dbDiv.visible && dbEdit1.obj.value!='') {
		var obj = document.getElementById(dbEdit1.obj.value).layerObj;
		if (debugLayoutMode) {
			switch(e.keyCode) {
				case 37:
					obj.setLeft(obj.left-1);
					dbEdit3.obj.value = obj.left;
					dbEdit4.obj.value = obj.right;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit7.obj.value = is.clientWidth-(obj.right);
					}else{
						dbEdit7.obj.value = obj.obj.parentNode.offsetWidth-(obj.right);
					}
					break;
				case 38:
					obj.setTop(obj.top-1);
					dbEdit5.obj.value = obj.top;
					dbEdit6.obj.value = obj.bottom;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit8.obj.value = is.clientHeight-(obj.bottom);
					}else{
						dbEdit8.obj.value = obj.obj.parentNode.offsetHeight-(obj.bottom);
					}
					break;
				case 39:
					obj.setLeft(obj.left+1);
					dbEdit3.obj.value = obj.left;
					dbEdit4.obj.value = obj.right;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit7.obj.value = is.clientWidth-(obj.right);
					}else{
						dbEdit7.obj.value = obj.obj.parentNode.offsetWidth-(obj.right);
					}
					break;
				case 40:
					obj.setTop(obj.top+1);
					dbEdit5.obj.value = obj.top;
					dbEdit6.obj.value = obj.bottom;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit8.obj.value = is.clientHeight-(obj.bottom);
					}else{
						dbEdit8.obj.value = obj.obj.parentNode.offsetHeight-(obj.bottom);
					}
					break;
			}
		}else{
			switch(e.keyCode) {
				case 37:
					obj.setWidth(obj.width-1);
					dbEdit4.obj.value = obj.right;
					dbEdit9.obj.value = obj.width;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit7.obj.value = is.clientWidth-(obj.right);
					}else{
						dbEdit7.obj.value = obj.obj.parentNode.offsetWidth-(obj.right);
					}
					break;
				case 38:
					obj.setHeight(obj.height-1);
					dbEdit6.obj.value = obj.bottom;
					dbEdit10.obj.value = obj.height;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit8.obj.value = is.clientHeight-(obj.bottom);
					}else{
						dbEdit8.obj.value = obj.obj.parentNode.offsetHeight-(obj.bottom);
					}
					break;
				case 39:
					obj.setWidth(obj.width+1);
					dbEdit4.obj.value = obj.right;
					dbEdit9.obj.value = obj.width;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit7.obj.value = is.clientWidth-(obj.right);
					}else{
						dbEdit7.obj.value = obj.obj.parentNode.offsetWidth-(obj.right);
					}
					break;
				case 40:
					obj.setHeight(obj.height+1);
					dbEdit6.obj.value = obj.bottom;
					dbEdit10.obj.value = obj.height;
					if (obj.obj.parentNode.nodeName=='BODY'){
						dbEdit8.obj.value = is.clientHeight-(obj.bottom);
					}else{
						dbEdit8.obj.value = obj.obj.parentNode.offsetHeight-(obj.bottom);
					}
					break;
			}
		}
	}
}

function debugClear() {
	dbEdit1.obj.value = '';
	dbEdit2.obj.value = '';
	dbEdit3.obj.value = '';
	dbEdit4.obj.value = '';
	dbEdit5.obj.value = '';
	dbEdit6.obj.value = '';
	dbEdit7.obj.value = '';
	dbEdit8.obj.value = '';
	dbEdit9.obj.value = '';
	dbEdit10.obj.value = '';
	dbEdit11.obj.value = '';
	dbEdit12.obj.value = '';
	dbEdit13.obj.value = '';
	dbRadio1.checked = true;
	debugLayoutMode = true;
}

function debugStartMove(e){
	var dbPosX = 0;
	var dbPosY = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY){
		dbPosX = e.pageX;
		dbPosY = e.pageY;
	}else if (e.clientX || e.clientY){
		dbPosX = e.clientX + document.body.scrollLeft;
		dbPosY = e.clientY + document.body.scrollTop;
	}
	dbDiffX = dbPosX-dbDiv.left;
	dbDiffY = dbPosY-dbDiv.top;
	dbDiv.setCursor('move');
	document.onmousemove=debugMove;
	debugMoveState = true;
}

function debugMove(e){
	var dbPosX = 0;
	var dbPosY = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY){
		dbPosX = e.pageX;
		dbPosY = e.pageY;
	}else if (e.clientX || e.clientY){
		dbPosX = e.clientX + document.body.scrollLeft;
		dbPosY = e.clientY + document.body.scrollTop;
	}
	dbDiv.setLeft(dbPosX-dbDiffX);	
	dbDiv.setTop(dbPosY-dbDiffY);	
}

function debugStopMove(e){
	dbDiv.setCursor('auto');
	document.onmousemove=null;
	debugMoveState = false;
}
