function checkUnCheck(cb) {
	n = cb.name;
	n = n.substr(0,n.length-2);
	cb.form[n].value=(cb.checked)?1:0;
	}

lastFocusedCol = -1;
focusColumnName = 'focusColumn';
focusColumnNameLen = focusColumnName.length;

function shInline(o) {
	lyObj = document.getElementById(o);
	lyObj.style.display=(lyObj.style.display&&lyObj.style.display=='inline')?'none':'inline';
	}
function focusThis(nw,rw,n,col) {
	stepsSpeed = 5;
	stepsCount = 20;
	if (lastFocusedCol==col) {
		// reset columns
		//actualWidths, resultWidths and speedWidths all exist
		narrowW = rw/n;
		wideW = rw/n;
		for (i=0;i<n;i++) {
			resultWidths[i] = wideW;
			speedWidths[i] = (resultWidths[i]-actualWidths[i])/stepsCount;
			}
		lastFocusedCol = -1;
		}
	else if (lastFocusedCol!=-1) {
		// set columns from previous set
		//actualWidths, resultWidths and speedWidths all exist
		narrowW = nw;
		wideW = rw-((n-1)*narrowW);
		for (i=0;i<n;i++) {
			if (col==i) {
				resultWidths[i] = wideW;
				speedWidths[i] = (resultWidths[i]-actualWidths[i])/stepsCount;
				}
			else {
				resultWidths[i] = narrowW;
				speedWidths[i] = (resultWidths[i]-actualWidths[i])/stepsCount;
				}
			}
		lastFocusedCol = col;
		}
	else {
		// set columns from start
		resultWidths = new Array();
		actualWidths = new Array();
		speedWidths = new Array();
		actualW = rw/n;
		narrowW = nw;
		wideW = rw-((n-1)*narrowW);
		for (i=0;i<n;i++) {
			actualWidths[i] = actualW;
			if (col==i) {
				resultWidths[i] = wideW;
				speedWidths[i] = (resultWidths[i]-actualWidths[i])/stepsCount;
				}
			else {
				resultWidths[i] = narrowW;
				speedWidths[i] = (resultWidths[i]-actualWidths[i])/stepsCount;
				}
			}
		lastFocusedCol = col;
		}
	actualCols = new Array();
	for (i=0;i<n;i++) actualCols[i] = new Array();
	tdObjs = document.getElementsByTagName('td');
	countCols = 0;
	var fcre = /\bfocusColumn\b/;
	for (i in tdObjs) {
		cn = tdObjs[i].className;
		if (cn) {
			if (cn.substr(0,focusColumnNameLen)==focusColumnName) {
			//if (fcre.test(cn)) {
				id=parseInt(cn.substr(focusColumnNameLen));
				actualCols[id].push(tdObjs[i]);
				children = tdObjs[i].childNodes;
				for (c in children) {
					childCn = children[c].className
					if (childCn) {
						if (childCn.substr(0,focusColumnNameLen)==focusColumnName) actualCols[id].push(children[c])
						}
					}
				}
			}
		}
	//alert(resultWidths + ' - ' + actualWidths + ' - ' + speedWidths);
	focusThisSet()
	}
function focusThisSet() {
	for (i in actualCols) {
		//alert(actualCols[i].length)
		if (speedWidths[i]>0) {
			if (actualWidths[i]+speedWidths[i]<resultWidths[i]) actualWidths[i]+=speedWidths[i];
			else {
				actualWidths[i] = resultWidths[i];
				speedWidths[i] = 0;
				}
			}
		else if (speedWidths[i]<0) {
			if (actualWidths[i]+speedWidths[i]>resultWidths[i]) actualWidths[i]+=speedWidths[i];
			else {
				actualWidths[i] = resultWidths[i];
				speedWidths[i] = 0;
				}
			}
		for (j in actualCols[i]) actualCols[i][j].style.width = actualWidths[i]+'px';
		}
	doaction = false;
	for (s in speedWidths) if (speedWidths[s]!=0) doaction=true;
	if (doaction) t=setTimeout("focusThisSet()",stepsSpeed);
	}

// image and xml preview
function previewScrollImages(start) {
	browserwh();
	//alert(bw);
	s=(!start)?0:start;
	trObj = findobject('imagepreview')
	if (trObj) {
		if (trObj.style.display=='none'||typeof(start)!='undefined') {
			trObj.style.display='table-row';
			url = pagepath + '//gethtmlupdate/previewimages/bw-'+bw+'/start-'+s;
			//alert(url);
			getform2htmlpageupdate(url,'imagepreview');
			}
		else trObj.style.display='none';
		}
	}
function closeViewXml(xml) {
	obj = findobject('previewcontent')
	obj.innerHTML = '';
	obj.style.display = 'none';
	}
function viewXml(xml) {
	browserwh();
	width = Math.min(600,bw-400);
	height = bh-100;
	viewXmlObj = findobject('previewcontent')
	viewXmlObj.style.top = '0px';
	width = Math.min(600,bw-400);
	viewXmlObj.style.left = '200px';
	viewXmlObj.style.width = width + 'px';
	viewXmlObj.style.height = '0px';
	url = pagepath + '//gethtmlupdate/previewxml/xml-'+xml+'/bw-'+width+'/bh-'+height;
	viewXmlObj.style.display = 'block';
	alert(url);
	viewXmlTimer = setTimeout('viewXmlOpen('+height+')',1);
	getform2htmlpageupdate(url,'previewcontent');
	}
function viewXmlOpen(height) {
	h = parseInt(viewXmlObj.style.height);
	if (h<height) {
		h += 10;
		taObj = findobject('previewcontentTA');
		if (taObj && h>40) taObj.style.height = (h-30)+'px';
		viewXmlObj.style.height = h + 'px';
		viewXmlTimer = setTimeout('viewXmlOpen('+height+')',5);
		}
	}
	
// for numbers view
var full = 0;
fullarr = new Array(1,0);
function changeimage(f,img) {
	imagearr = new Array('_fullimages/','_images/');
	document.images[f].src = numberspath +  imagearr[full] + curimg;
	full = fullarr[full];
	}
function changenewimage(img,t) {
	curimg = img;
	document.images['theimg'].src = numberspath + '_images/' + img;
	full = 0;
	findobject('textdiv').innerHTML=t;
	}
function popupwin(varURL,vartitle,varwindow,varmovex,varmovey,remote) {
var textwindow = window.open(varURL,vartitle,varwindow);
if ((varmovex!=0) & (varmovey!=0)) { textwindow.moveTo(varmovex,varmovey); }
if (remote==1) { textwindow.opener = this.window; }
}
