// 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;
}

// 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();
}

