function openWin(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	return win = window.open(mypage,myname,settings)
}

function winClose(){
	window.close();
	return false;
}

function openURL(url){
	window.location.href = url;	
}

function currencyWin(){
	openWin('/resources/currency.php','currency',470,520,'yes');
}

function slibWin(){
	openWin('http://www.brainmass.com/libsearch/','slib',800,600,'yes');
}

function otaProfile(ota_id){
	openWin('/resources/otaprofile.php?ota_id='+ota_id,'otaprofile',600,500,'yes');
}

String.prototype.trim=function(){
    return this.replace(/^\s*|\s*$/g,'');
}

String.prototype.ltrim=function(){
    return this.replace(/^\s*/g,'');
}

String.prototype.rtrim=function(){
    return this.replace(/\s*$/g,'');
}

function chkboxAllNone(form, checked) {
	for(var i=0; i<form.length; i++){
		if(form[i].type == 'checkbox'){
			form[i].checked = checked;
		}
	}
}

function chkboxGetChecked(form){
	var arr = new Array();
	for(var i=0,j=0; i<form.length; i++){
		if(form[i].type == 'checkbox' && form[i].checked){
			arr[j++] = form[i].value;
		}
	}
	return arr;
}