function createWindow(what) {
    var URL = what.URL.value;

    var windowName = what.windowName.value;

    var features =
        'width='        + what.width.value +
        ',height='      + what.height.value +
        ',directories=' + (what.directories.checked - 0) +
        ',location='    + (what.location.checked - 0) +
        ',menubar='     + (what.menubar.checked - 0) +
        ',scrollbars='  + (what.scrollbars.checked - 0) +
        ',status='      + (what.status.checked - 0) +
        ',toolbar='     + (what.toolbar.checked - 0) +
        ',resizable='   + (what.resizable.checked - 0);

    child = window.open (URL, windowName, features);
	if (child.opener == null) child.opener = window; 
	child.opener.name = "tmfaq_pop";
}

function createWindowURL(URL, width, height, name) {
    var windowName = name;

    var features =
        'width= ' + width +
        ',height= ' + height + 
        ',scrollbars=1' +
        ',menubar=no' + 
        ',toolbar=no'  + 
        ',resizable=1,copyhistory=no';

    child = window.open(URL, windowName, features);
	if (child.opener == null) child.opener = window; 
	child.opener.name = "tmfaq_pop";
}

function popupWindow(url) {
  child = window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=550,height=450,screenX=150,screenY=150,top=150,left=150')
	if (child.opener == null) child.opener = window; 
	child.opener.name = "tmfaq__pop";	
}

var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS4 || IE4) ? true : false;

function expandIt(el) {
	if (!ver4) return;
	if (IE4) {expandIE(el)} else {expandNS(el)}
}
function expandIE(el) { 
	whichEl = eval(el + "Child");
	if (whichEl.style.display == "none") {
		whichEl.style.display = "block";
	}
	else {
		whichEl.style.display = "none";
	}
}
function expandNS(el) {
	whichEl = eval("document." + el + "Child");
	if (whichEl.visibility == "hide") {
		whichEl.visibility = "show";
	}
	else {
		whichEl.visibility = "hide";
	}
}

function getWindowX()
{
	if (document.layers) { return window.screenX }
	else if (document.all) { return window.top.screenLeft }
	else {return window.screenX }
}

function getWindowY()
{
	if (document.layers) { return window.screenY }
	else if (document.all) { return window.top.screenTop }
	else {return window.screenY }
}

function getWindowWidth()
{
	if (document.layers) { return window.innerWidth }
	else if (document.all) { return window.top.document.body.clientWidth }
	else {return window.innerWidth }
}

function getWindowHeight()
{
	if (document.layers) { return window.innerHeight }
	else if (document.all) { return window.top.document.body.clientHeight }
	else {return window.innerHeight }
}

function resizeWindowTo(new_width, new_height)
{
	var dW = new_width - getWindowWidth();
	var dH = new_height - getWindowHeight();
	
	if (document.layers)
	{
		if (dW > 0) { window.innerWidth = new_width }
		if (dH > 0) { window.innerHeight = new_height }
	}
	
	else if (document.all)
	{
		window.top.document.body.clientWidth;
		if (dW > 0) { window.top.resizeBy(dW, 0) }
		if (dH > 0) { window.top.resizeBy(0, dH) }
	}
	
	else
	{
		if (dW > 0) { window.innerWidth = new_width }
		if (dH > 0) { window.innerHeight = new_height }
	}
}

function moveWindowBy(dX, dY)
{
	if (document.layers)
	{
		if (getWindowX() + dX >= 0) { window.moveBy(dX, 0) }
			else { window.moveBy(-getWindowX(), 0) }
		if (getWindowY() + dY >= 0) { window.moveBy(0, dY) }
			else { window.moveBy(0, -getWindowY()) }
	}
	
	else if (document.all)
	{
		if (getWindowX() + dX >= 0) { window.top.moveBy(dX, 0) }
			else { window.top.moveBy(-getWindowX(), 0) }
		if (getWindowY() + dY >= 0) { window.top.moveBy(0, dY) }
			else { window.top.moveBy(0, -getWindowY()) }
	}
	
	else
	{
		if (getWindowX() + dX >= 0) { window.moveBy(dX, 0) }
			else { window.moveBy(-getWindowX(), 0) }
		if (getWindowY() + dY >= 0) { window.moveBy(0, dY) }
			else { window.moveBy(0, -getWindowY()) }
	}
}

function adjustWindow(req_width, req_height)
{
	resizeWindowTo(req_width, req_height);
	if (getWindowX() + getWindowWidth() > screen.availWidth) { moveWindowBy(screen.availWidth - (getWindowX() + getWindowWidth()), 0) }
	if (getWindowY() + getWindowHeight() > screen.availHeight) { moveWindowBy(0, screen.availHeight - (getWindowY() + getWindowHeight())) }
}