function doStatusPageRefresh(){
	var secs = $F("refresh");
	var scroll = $F("scroll");	

	if(secs <= -1){
	
	}else{
		if(scroll != null && scroll != ""){
			setScrollHeight(scroll);
		}
		setInterval(function(){      
			statusPageRefresh(secs);	
		 }, secs*1000 );
	}
	
}

function statusPageRefresh(refresh){

	var doRefresh = 1;
	var boxes = document.getElementsByTagName("input");
	var nodes = $A(boxes);

	updateScroll();
	$("refresh").value = refresh;
	$("formList").submit();
}
function updateScroll(){
	$("scroll").value = getScrollHeight();		
}


function getScrollHeight()
{
	var h = 0;
	offsets = document.viewport.getScrollOffsets();
	if(offsets){
		h = offsets.top;
	}

	return h;	
}


function setScrollHeight(value)
{		
	window.scrollTo(0, value);
}


/******************************************************************************
* This function return the value of the variable embeded in the query string.
* (i.e. window.location.search)
*****************************************************************************/
function getParameter ( queryString, parameterName ) {
        // Add "=" to the parameter name (i.e. parameterName=value)
        var parameterName = parameterName + "=";
        if ( queryString.length > 0 ) {
                // Find the beginning of the string
                begin = queryString.indexOf ( parameterName );
                // If the parameter name is not found, skip it,
                //otherwise return the value
                if ( begin != -1 ) {
                        // Add the length (integer) to the beginning
                        begin += parameterName.length;
                        // Multiple parameters are separated by the "&" sign
                        end = queryString.indexOf ( "&" , begin );
                        if ( end == -1 ) {
                                end = queryString.length
                        }
                        // Return the string
                        return unescape ( queryString.substring( begin, end ));
                }
                // Return "null" if no parameter has been found
                return null;
        }
        return null;
}



function setPreviewImage(src){
	if(src){
		$("preview_img").src = src;
	}
}