// browser detection
function client()       {
        this.dom = (document.getElementById) ? 1 : 0;
        this.d_all = (document.all) ? 1 : 0;
        this.d_layers = (document.layers) ? 1 : 0;
        return this;
}

function ie_get_fromAll(inID, inDiv)    {
        return document.all[inID] || null;
}

function dom_getImgById(inID, inDiv)    {
        var elem = (document.getElementById(inID) || document.images[inID]);
        return elem;
}

function ns_getImgById(inID, inDiv)     {
        if (inDiv != "") {
                var lay = document.getElementById(inDiv);
                return lay.document.images[inID];
        } else {
                return document.images[inID];
        }
}

var b = new client();

document.getImageById = b.d_all ? ie_get_fromAll : (b.d_layers ? ns_getImgById : dom_getImgById);

// image swap
function PicOver(i) {
        var img = document.getImageById('pic'+i);
        img.src = eval('over'+i).src;
}

function PicOut(i) {
        var img = document.getImageById('pic'+i);
        img.src = eval('off'+i).src;
}

// usage: $target = "onClick=\"openChild('fullinfo.php?catnr=".$catnr."','fi',387,549,'center','center','no','auto','no','no','no');\"";
// new window open method
function openChild(childUrl,childName,childWidth,childHeight,childLeft,childTop,childStatus,childScrollbars,childLocation,childTollbar,childMenubar) {

	var newChild = null;
	if (childLeft=='center') {	
		childPosLeft = Math.floor((screen.width - childWidth) / 2);
		if (childTop=='center'||childTop=='middle')
			childPosTop = Math.floor((screen.height - childHeight) / 2);
    	else if (childTop=='top')
			childPosTop = 0;
		else
			childPosTop = screen.height - childHeight-30;
	}
	else if (childLeft=='left') {	
		childPosLeft = 0;
		if (childTop=='center'||childTop=='middle')
			childPosTop = Math.floor((screen.height - childHeight) / 2);
    	else if (childTop=='top')
			childPosTop = 0;
		else
			childPosTop = screen.height - childHeight-30;
	}
	else {	
		childPosLeft = screen.width - childWidth-10;
		if (childTop=='center'||childTop=='middle')
			childPosTop = Math.floor((screen.height - childHeight) / 2);
    	else if (childTop=='top')
			childPosTop = 0;
		else
			childPosTop = screen.height - childHeight-30;
	}
	newChild = window.open(childUrl,childName,'width='+childWidth+',height='+childHeight+',innerwidth='+childWidth+',innerheight='+ childHeight+',top='+childPosTop+',left='+childPosLeft+',status='+childStatus+',scrollbars='+childScrollbars+',location='+childLocation+',toolbar='+childTollbar+',menubar='+childMenubar);
	if (newChild != null){
			newChild.window.focus();
				}
}


/**
 * enables highlight of rows in data tables
 *
 */
function tableruler(){
	
if (document.getElementById && document.createTextNode){
	var tables=document.getElementsByTagName('table');
	for (var i=0;i<tables.length;i++){
		if(tables[i].className=='ruler'){
			var trs=tables[i].getElementsByTagName('tr');
			for(var j=0;j<trs.length;j++){
				if(trs[j].className!="norule"){
					trs[j].onmouseover=function(){this.className='ruled';return false}
					trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}
window.onload=function(){tableruler();}
		