function checkAll() {
af=-1;
for (t in document.forms) if (document.forms[t].method=='post' && af==-1) af=t;
	fmobj = document.forms[af];
 	 
	for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if ( (e.name != 'all') && (e.type=='checkbox') && (!e.disabled) ) {
      e.checked = fmobj.all.checked;
    }
  }
}

function OpenImagePopup(imgPath, title, alt, rightside) {
    var win = window.open('','preview',
    'width=50,height=50,left=0,top=0,screenX=0,screenY=0,resizable=1,scrollbar=0,status=0');
    
    var winDoc = win.document;
    if (title == undefined) title = 'My Image, Click to Close';
    if (alt   == undefined) alt   = 'My Image, Click to Close';
    var content = '<html><head><title>' + title + '</title>' +
    			  '<style>body{overflow: hidden;margin:0;}img{border:0;}</style>' +
    			  '</head><body><a href="javascript:self.close()">' +
    			  '<img alt="' + alt + '" id="image" src="' + imgPath + '" /></a></body></html>'
    win.document.write(content);
    
    winDoc.body.onload = function() {
    	var obj = winDoc.getElementById('image');
    	var w = obj.width, h = obj.height;
    	var iHeight= document.body.clientHeight, iWidth = self.innerWidth;
    	
    	var left;
    	if (!rightside)
    		left = (self.opera ? iWidth : screen.availWidth)/2 - w/2;
    	else
    		left = (self.opera ? iWidth : screen.availWidth);
    	var top =  (self.opera ? iHeight : screen.availHeight)/2 - h/2;
    	win.resizeTo(w+10, h+65);
    	win.moveTo(left, top);
    }
    
    win.onload = winDoc.body.onload; // special for Mozilla
    
    // !!! Important statement: popup onload won't execute without it!
    win.document.close();
    win.focus();
}

function changeVisibility(objId, display) {
	object = document.getElementById(objId);
	//object.style.display = (object.style.display == 'none' || object.style.display == '') ? 'block' : 'none';
	object.style.display = display ? 'inline' : 'none';
	return;
}