ie4ver=false

zz_all = "all"
zz_style = "style"
zz_document = "document"
zz_images = "images"
zz_preview = "preview"
zz_div = "div"
zz_window = "window"
zz_dot = "."
zz_status = "status"
zz_img = "img"
zz_complete = "complete"
zz_height = "height"
zz_width = "width"
zz_allobjects = "allobjects"
zz_selected = "selected"
zz_visibility = "visibility"
zz_show = "show"
zz_backgroundColor = "backgroundColor"
zz_transparent = "transparent"
zz_onresize = "onresize"
zz_plabel = "plabel"
zz_label = "label"
zz_pimage = "pimage"
zz_image = "image"
zz_prectangle = "prectangle"
zz_rectangle = "rectangle"
zz_GetSize = "GetSize"
zz_RectFgColor = "RectFgColor"
zz_RectBgColor = "RectBgColor"
zz_FgColor = "FgColor"
zz_BgColor = "BgColor"
zz_background = "background"
zz_border = "border"
zz_line = "line"
zz_divofsize = "divofsize"
zz_objwidth = "objwidth"
zz_objheight = "objheight"
zz_length = "length"
zz_text = "text"
zz_textboxofsize = "textboxofsize"
zz_src = "src"
zz_parsheet = "parsheet"
 
zz_size = "size"
zz_dspecs = "dspecs"
zz_addoredit = "addoredit"
zz_action = "action"
zz_target = "target"
zz_value = "value"
zz_step2 = "step2"
zz_pdf = "pdf"
zz_designwidth = "designwidth"
zz_designheight = "designheight"

zz_PR = "PR"
zz_R = "R"
zz_PI = "PI"
zz_I = "I"
zz_PL = "PL"
zz_L = "L"

zz_zIndex = "zIndex"
zz_left = "left"
zz_top = "top"
zz_align = "align"
zz_right = "right"
zz_center = "center"

zz_ptfill = "ptfill" 
zz_pstyle = "pstyle" 
zz_palign = "palign" 
zz_ptresize = "ptresize"
zz_pdelete = "pdelete" 
zz_pduplicate = "pduplicate"
zz_ptextarea = "ptextarea"
zz_pfontname = "pfontname"
zz_pfontsize = "pfontsize"
zz_phimage = "phimage"  
zz_pchangeimage = "pchangeimage" 
zz_pchangebarcode = "pchangebarcode" 
zz_pchangenumbering = "pchangenumbering" 


zz_textfield = "textfield"

zz_vbackground = "vbackground"
zz_background2 = "background2"
zz_templatespecs = "templatespecs"
zz_toolBox = "toolBox"
zz_FewLinks = "FewLinks"

zz_divproof = "divproof"

zz_pleading = "pleading"
zz_prule = "prule"
zz_textboxofleading = "textboxofleading"
zz_divofleading = "divofleading"
zz_checkboxofrule = "checkboxofrule"
zz_lineHeight = "lineHeight"
zz_emptydiv = "emptydiv"
zz_leading = "leading"

zz_templatetext = "templatetext"
zz_templatetextfield = "templatetextfield"
zz_bgnestref = "document.background.document"
zz_divnestref = "document.background.document.div" 
zz_dotdoc = ".document"

decreasefontsize=true

function getRS() {
	var xstr="", kk;
	xnestref = getRS.arguments[0];

	for (kk=1;kk<getRS.arguments.length;kk++) {
		xstr = xstr + getRS.arguments[kk];
		if (getRS.arguments[kk].length > 0) {
			if (kk < getRS.arguments.length-1) {
				xstr = xstr + zz_dot;
			}
		}
	}
	if (ns4dom) {
		if (xnestref.length > 0) {
			xstr = xstr.split("document.all.").join(xnestref+zz_dot);
			xstr = xstr.split("document.images.").join(xnestref+zz_dot+"document.images.");
		}
		xstr = xstr.split("document.all.").join("document.layers.");
		xstr = xstr.split("document.document.").join("document.");
		xstr = xstr.split(".style").join("");
	}
	

	var styleflag=false;
	if (ns6dom) {
		var allflag = false;
		if (xstr.indexOf('.all.') >= 0 || xstr.indexOf('.images.') >= 0) {
			allflag=true;
		}
		xstr = xstr.split("document.all.").join('');
		xstr = xstr.split("document.images.").join('');

		if (allflag) {
			if (xstr.indexOf(".style") >= 0) styleflag = true;
			xstr = xstr.split(".style").join("");

			var xrsdom = document.getElementById(xstr);
			if (styleflag) {
				xrsdom = xrsdom.style;
			}
		}
		else {
			var xrsdom = eval(xstr);
		}
	}
	showalert=false;
	if (ns6dom) return xrsdom;
	else return eval(xstr);	
}

function joinParam() {
	var xstr="", kk;
	for (kk=0;kk<joinParam.arguments.length;kk++) {
		xstr = xstr + joinParam.arguments[kk];
	}
	return xstr;
}
function ChangeInnerHTML(yobject, ystr, yself) {
	var xdom;
	if (ns4dom) {
		xnestref = 'background'
		if (yself) {
			xnestref=null
		}
		if (xnestref != null) {
			xdom = eval('document["background"].document["'+yobject+'"].document')
		}
		else {
			xdom = document.layers[yobject].document
		}
		xdom.open()
		xdom.write(ystr)
		xdom.close()
	}
	else {
		xdom = getRS('',zz_document, zz_all, yobject)
		xdom.innerHTML = ystr
	}
}
function jshtmlencode(ystr){
	ystr = ystr.split("&gt;").join(">")
	ystr = ystr.split("&lt;").join("<")
	ystr = ystr.split("&quot;").join("\"")
	ystr = ystr.split("&amp;").join("&")

	ystr = ystr.split("&").join("&amp;")
	ystr = ystr.split("\"").join("&quot;")
	ystr = ystr.split("<").join("&lt;")
	ystr = ystr.split(">").join("&gt;")
	return ystr;
}
/*~replace~*/
function fetchXyz() {
	if (fetchXyz.arguments.length <= 0) {
		return
	}
	var xstr="", kk;
	for (kk=0;kk<fetchXyz.arguments.length;kk++) {
		xstr = xstr + lookupstring[parseInt(fetchXyz.arguments[kk])]    
	}
	return xstr;
}
if (ns6dom){
	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode) {
		switch (where){
		case 'beforeBegin':	this.parentNode.insertBefore(parsedNode,this); break;
		case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break;
		case 'beforeEnd': this.appendChild(parsedNode);	break;
		case 'afterEnd': if (this.nextSibling){	this.parentNode.insertBefore(parsedNode,this.nextSibling);} 
		else {this.parentNode.appendChild(parsedNode);}
			break;
		}
	};
	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr){
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML);
	};
	HTMLElement.prototype.insertAdjacentText = function(where,txtStr){

		var parsedText = document.createTextNode(txtStr);
		this.insertAdjacentElement(where,parsedText);
	};
}

function CB_insertAdjacentHTML(yid, ycontent, ynestref, yzindex, yleft, ytop, ywidth, yheight, ymultilayer, ymethod) {
	if(!yzindex) yzindex = 0;
	if(!yleft) yleft = 0;
	if(!ytop) ytop = 0;
	if(!ywidth) ywidth = 0;
	if(!yheight) yheight = 0;
	if (ns4dom) {
		if (ymultilayer) {			if (ynestref) {				var lyr = eval("document.layers."+ynestref+".document."+yid+" = new Layer(ywidth, document.layers."+ynestref+")");			}
			else {
				var lyr = document.layers[yid] = new Layer(ywidth);
				eval("document."+yid+" = lyr");
			}		}
		else {
			var lyr = document.layers[yid] = new Layer(ywidth);
			eval("document."+yid+" = lyr");
		}
		lyr.name = yid;
		lyr.position = "absolute";		ytop = ''+ytop; yleft = ''+yleft; ywidth = ''+ywidth; yheight = ''+yheight;		if (ytop.charAt(0)=='.') { ytop = '0'+ytop; }		if (yleft.charAt(0)=='.') { yleft = '0'+yleft; }		if (ywidth.charAt(0)=='.') { ywidth = '0'+ywidth; }		if (yheight.charAt(0)=='.') { yheight = '0'+yheight; }		lyr.left = parseInt(yleft);		lyr.top = parseInt(ytop);		lyr.width = parseInt(ywidth);
		lyr.height = parseInt(yheight);
		lyr.zIndex = parseInt(yzindex);
		if (ycontent) {
			lyr.document.open();
			lyr.document.write(ycontent);
			lyr.document.close();		}	}	else if (ie4dom || ns6dom ) {		
		xdom = getRS('',zz_document, zz_all, ynestref);
		var xstr = "";
		if (ns6dom) {
			var xtmpstr="";			if (yheight > 0) xtmpstr = xtmpstr + "height:"+yheight+"px;";
			if (ywidth > 0) xtmpstr = xtmpstr + "width:"+ywidth+"px;";			
			xstr = xstr + '<DIV id="'+yid+'" style="position:absolute; left:'+yleft+'px; top:'+ytop+'px;'+xtmpstr+'visibility:hidden;z-Index:'+yzindex+';">'+((ycontent)?ycontent:'')+'</DIV>';		}		else {
			if (ie4ver || aol) {
				var xtmpstr="";				if (yheight > 0) xtmpstr = xtmpstr + "height:"+yheight+"px;";
				if (ywidth > 0) xtmpstr = xtmpstr + "width:"+ywidth+"px;";
				xstr = xstr + '<DIV id="'+yid+'" style="position:absolute; left:'+yleft+'px; top:'+ytop+'px;'+xtmpstr+'visibility:hidden;z-Index:'+yzindex+';">'+((ycontent)?ycontent:'')+'</DIV>';			}
			else {				xstr = xstr + '<DIV id="'+yid+'" style="position:absolute; left:'+yleft+'px; top:'+ytop+'px; width:'+ywidth+'px; height:'+yheight+'px; visibility:hidden;z-Index:'+yzindex+';">'+((ycontent)?ycontent:'')+'</DIV>';
			}		}		if (ymethod == "BB") {
			xdom.insertAdjacentHTML("beforeBegin",xstr);		}		else {			xdom.insertAdjacentHTML("beforeEnd",xstr);
		}
	}
}
function CB_setbgcolor(ydom, ycolor) {
	if (ns4dom) {
		if (ycolor != zz_transparent) {
			if (ycolor == "" || ycolor == "#") {
			} else {
				ydom.bgColor = ycolor;
			}
		}
	}
	else {
		if (ycolor == "" || ycolor == "#") {
		} else {
				ydom.backgroundColor = ycolor;
		}
	}
}
function CB_clientHeight(ydom) {
	var xheight;
	if (ns4dom) {
		xheight = ydom[zz_clientHeight]
	}
	else if (ns6dom) {
		xheight = parseInt(document.defaultView.getComputedStyle(ydom, "").getPropertyValue("height"));
	}
	else {
		xheight = ydom[zz_clientHeight]
	}
	return xheight;
}


function CB_moveTo(ydom, x, y) {
	if (ns4dom) {
		ydom.moveTo(x, y)
	}
	else {
		ydom.left = x
		ydom.top = y
	}
}
function isobjectvisible(ydom) {
	var xstate;
	xstate = ydom.visibility
	if ((xstate == zz_visible) || (xstate == zz_show)) return true;
	else return false;
}
function hidetheobject(ydom) {
	var xstate;
	if (ydom) {
		xstate = ydom.visibility
		if ((xstate == zz_visible) || (xstate == zz_show)) {
			ydom[zz_visibility] = zz_hidden
		}
	}
}
function showtheobject(ydom) {
	if (ydom) {
		ydom[zz_visibility] = zz_visible
	}
}

if (ns4dom) {
	zz_visible = "show"
	zz_hidden = "hide"
	zz_pixelLeft = "left"
	zz_pixelTop = "top"
	zz_pixelWidth = "width"
	zz_pixelHeight = "height"
	zz_clientHeight = "clientHeight"
	zz_clientWidth = "clientWidth"
}
else {
	zz_visible = "visible"
	zz_hidden = "hidden"
	if (ns6dom) {
		zz_pixelLeft = "left"
		zz_pixelTop = "top"
		zz_pixelWidth = "width"
		zz_pixelHeight = "height"
		zz_clientHeight = "offsetHeight"
		zz_clientWidth = "offsetWidth"
	}
	else {
		zz_pixelLeft = "pixelLeft"
		zz_pixelTop = "pixelTop"
		zz_pixelWidth = "pixelWidth"
		zz_pixelHeight = "pixelHeight"
		zz_clientHeight = "clientHeight"
		zz_clientWidth = "clientWidth"
	}
}
function trim_(ystr) {
	var xfound = false
	if (ystr.length == 0) return ""
	for (var k=0; k<ystr.length;k++) {
		if (!xfound) {
			if (ystr.charAt(k) == " ") {
			}
			else {
				ystr = ystr.substring(k, ystr.length)
				xfound = true
				break
			}
		}
	}
	if (!xfound) ystr = ""
	
	xfound = false
	if (ystr.length == 0) return ""
	for (k=ystr.length-1; k>=0;k--) {
		if (!xfound) {
			if (ystr.charAt(k) == " ") {
			}
			else {
				ystr = ystr.substring(0, k+1)
				xfound = true
				break
			}
		}
	}
	if (!xfound) ystr = ""
	return ystr
}

function HextoDec(yhex) {
	HextoDec1 = convdigit(yhex.substring(0, 1)) * 16 * 16 * 16 * 16 *16
	HextoDec1 = HextoDec1 + convdigit(yhex.substring(1, 2)) * 16 * 16 * 16 * 16 
	HextoDec1 = HextoDec1 + convdigit(yhex.substring(2, 3)) * 16 * 16 * 16 
	HextoDec1 = HextoDec1 + convdigit(yhex.substring(3, 4)) * 16 * 16 
	HextoDec1 = HextoDec1 + convdigit(yhex.substring(4, 5)) * 16 
	HextoDec1 = HextoDec1 + convdigit(yhex.substring(5, 6))
	return HextoDec1 
}

function convdigit(ycurrdigit) {
	var xcurrnum = 0
	if (ycurrdigit == "0") xcurrnum = 0;
	else if (ycurrdigit == "1") xcurrnum = 1;
	else if (ycurrdigit == "2") xcurrnum = 2;
	else if (ycurrdigit == "3") xcurrnum = 3;
	else if (ycurrdigit == "4") xcurrnum = 4;
	else if (ycurrdigit == "5") xcurrnum = 5;
	else if (ycurrdigit == "6") xcurrnum = 6;
	else if (ycurrdigit == "7") xcurrnum = 7;
	else if (ycurrdigit == "8") xcurrnum = 8;
	else if (ycurrdigit == "9") xcurrnum = 9;
	else if (ycurrdigit == "A") xcurrnum = 10;
	else if (ycurrdigit == "B") xcurrnum = 11;
	else if (ycurrdigit == "C") xcurrnum = 12;
	else if (ycurrdigit == "D") xcurrnum = 13;
	else if (ycurrdigit == "E") xcurrnum = 14;
	else if (ycurrdigit == "F") xcurrnum = 15;
	return xcurrnum;
}

function round_(ynum, ydec) {
	var xstr = "1";
	var xnum, xinter;
	for (k=0;k<ydec;k++) {
		xstr = xstr + "0";
	}
	xnum = parseFloat(xstr);
	xinter = Math.round(ynum*xnum);
	return (xinter/xnum);
}
function SuffixZeros(ynum, ydec) {
	ynum = round_(ynum, ydec)
	ystr = ynum + ""
	if (ystr.indexOf(".") < 0) {
		ystr = ystr + "."
	}
	xpos = ystr.indexOf(".")
	xlen = ystr.length
	xst = xlen - xpos
	for (var k=xst; k<= ydec;k++) {
		ystr = ystr + "0"
	}
	return ystr;
}
function WindowDimensions(xpercent) {
	xwidth = screen.width * xpercent * 0.01
	xheight = screen.height * xpercent * 0.01
	xleft = (screen.width - xwidth) / 2
	xtop = (screen.height - xheight) / 2
	
	return 'left='+xleft+',top='+xtop+',width='+xwidth+',height='+xheight
}
function WindowCenter(ywidth, yheight) {
	xwidth = ywidth 
	xheight = yheight 
	xleft = (screen.width - xwidth) / 2
	xtop = (screen.height - xheight) / 2
	
	return 'left='+xleft+',top='+xtop+',width='+xwidth+',height='+xheight
}

