

// function to open Comments window
function openCommentsWindow(p_imageID, p_imageDisplayType) {
	var scrwidth=350;
	var scrheight=500;
	
	var newstr = '/frame_comments.asp?imageID=' + p_imageID + '&imageDisplayType=' + p_imageDisplayType;
	openCenteredWindow(newstr,scrwidth,scrheight,'winComments','resizable=1,scrollbars=0,menubar=0');
}


//function to open a window centered in display monitor
//Example: openCenteredWindow('http://www.versys.com', 300, 200, 'faqts', 'resizable=1,scrollbars=1')
function openCenteredWindow (url, width, height, windowName, featureString) {
	if (!windowName)
		windowName = '';
	if (!featureString)
		featureString = '';
	else
		featureString = ',' + featureString;
	var x = Math.round((screen.availWidth - width) / 2);
	var y = Math.round((screen.availHeight - height) / 2);
	featureString = 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + featureString;
	return open (url, windowName, featureString);
}

// Trim functions
function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return "";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;
	
	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
	}
	else{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
	}
	iTemp = iTemp-1;
	
	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space) {
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
	iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function
