var timeoutIDs = new Array();	
//
// ************************
// layer utility routines *
// ************************

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function getForm() {
    return getStyleObject("searchform");
}

function getMenuForm() {
    return getStyleObject("searchformup");
}

function getForumForm() {
    return getStyleObject("form");
}

function newWin(file, width, height)
	{
        if (width==null) width=600;
        if (height==null) height=520;
	window.open(file,'text', 'width='+width+', height='+height+', menubar=no, location=no, resizable=yes');
	}

function changeListImage(liitem, image, color){
	liitem.style.listStyleImage = 'url('+image+')';
	liitem.style.color = color;
	//alert("image: "+liitem.style.color)
}

function showLayer(layerName)
	{
		changeObjectDisplaying(layerName, 'block');
	}

function hideLayer(layerName)
	{	
		changeObjectDisplaying(layerName, 'none');
	}

function changeObjectDisplaying(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.style.display = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
}

function setLayerCoords(LayerName, x, y) {
        //alert(LayerName);
	if (y+"" != "undefined")
	{
		getStyleObject(LayerName).style.top = y;
		//alert(LayerName+" "+x+","+y);
	} 
        if(getStyleObject(LayerName)){
            getStyleObject(LayerName).style.left = x;
            //alert(LayerName);
        }
}

function setLayerPos(LayerName, x, y) {
	getStyleObject(LayerName).style.top = y+2;
	getStyleObject(LayerName).style.left = x;
    
}

function MouseOverEvent(layerNum, imgNum)
	{	
		timeoutID = timeoutIDs[layerNum];
		clearTimeout(timeoutID);
		x = getPictureXCoord(imgNum);
		y = getPictureYCoord(imgNum);
		setLayerPos(layerNum, x, y);
		showLayer(layerNum);
	}
	
	function MouseOutEvent(layerNum, imgNum)
	{	
		timeoutID = setTimeout('hideLayer(\''+layerNum+'\')', 100);
		timeoutIDs[layerNum] = timeoutID;
	}


function getPictureXCoord(pictureID) {
   var styleObject = getStyleObject(pictureID);
    if(styleObject) {
		x = 0;
		obj = styleObject;
		while (obj.offsetParent != null) {
		  x += obj.offsetLeft;
		  obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	} else {return 10;}

}

function getPictureYCoord(pictureID) {
        var styleObject = getStyleObject(pictureID);
        if(styleObject) {
                  // alert(styleObject.currentStyle.top);
                    y = 0;
                    obj = styleObject;
                    while (obj.offsetParent!=null) {
                      y += obj.offsetTop;
                      //alert(obj.offsetTop);
                      obj = obj.offsetParent;
                    }
                    y += obj.offsetTop;
					y += styleObject.height
                    return y;
         } else {return 10;}
}

function checkAll(element){
    var formT = element.form;
    alert(formT.id);
    elems = formT.elements;
    for(i=0; i<elems.length; i++){
        if (elems[i].type=="checkbox") elems[i].checked = true;
        //alert(elems[i].type);
    }
}

function loadinparent(url){
    self.opener.location = url;	
}