
// expand arrows
var arrow_right = new Image();
arrow_right.src = "/images/layout/right.gif";
var arrow_down = new Image();
arrow_down.src = "/images/layout/down.gif";


// expand functions
function showExpandNoArrow(objToShow) 
{

    var nScrollHeight = document.getElementById(objToShow).scrollHeight;
    var nActualHeight = document.getElementById(objToShow).offsetHeight;


    if (nActualHeight < nScrollHeight) 
    {
        sizeObjectVertical(objToShow, nScrollHeight, "null");
    }
    else 
    {
        sizeObjectVertical(objToShow, 1, "null");
    }

}

function showExpand(title, objToShow) 
{

	var nScrollHeight = document.getElementById(objToShow).scrollHeight;
	var nActualHeight = document.getElementById(objToShow).offsetHeight;
	var arrow = title + "_arrow";


	if (nActualHeight < nScrollHeight)
	{
	    sizeObjectVertical(objToShow, nScrollHeight, "null");
		document.getElementById(title).className = "expand-selected";
		document.getElementById(arrow).src = arrow_down.src;
	}
	else
	{
	    sizeObjectVertical(objToShow, 1, "null");
		document.getElementById(title).className = "expand-normal";
		document.getElementById(arrow).src = arrow_right.src;
    }
	
}


function showExpandFirmware(title, objToShow) 
{

	var nScrollHeight = document.getElementById(objToShow).scrollHeight;
	var nScrollHeight2 = document.getElementById('divSoftwareDownloads').scrollHeight;


	var nActualHeight = document.getElementById(objToShow).offsetHeight;
	var arrow = title + "_arrow";
	

	if (nActualHeight < nScrollHeight)
	{
	    sizeObjectVertical(objToShow, nScrollHeight, "null");
		sizeObjectVertical('divSoftwareDownloads', nScrollHeight + nScrollHeight2, "null");
		document.getElementById(title).className = "expand-selected";
		document.getElementById(arrow).src = arrow_down.src;
	}
	else
	{
	    sizeObjectVertical(objToShow, 1, "null");
		sizeObjectVertical('divSoftwareDownloads', nScrollHeight2 - nScrollHeight, "null");
		document.getElementById(title).className = "expand-normal";
		document.getElementById(arrow).src = arrow_right.src;
    }
	
}


function hoverExpand(title,hover)
{
    if (document.getElementById(title).className != "expand-selected")
	{
		if (hover)
		{ 
			document.getElementById(title).className = "expand-hover";
		}
		else
		{ 
			document.getElementById(title).className = "expand-normal";
		}
	}
}


function sizeObjectVertical(objToShow, showSize, completeFunction)
{
	new Rico.Effect.Size(document.getElementById(objToShow),null,showSize,20,10,completeFunction);	
}


function sizeObjectHorizontal(objToShow,showSize,completeFunction)
{
	new Rico.Effect.Size(document.getElementById(objToShow),showSize,null,20,10,completeFunction);	
}


function fadeObjectVertical(objToFade, opacity, completeFunction)
{
	new Rico.Effect.FadeTo(document.getElementById(objToFade),opacity,500,10,completeFunction);
}


// Popup window function
function newWindow(url, width, height) 
{
    popupWindow = window.open(url,'popUpWindow','height=' + height + ',width=' + width + ',left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=yes');
}
