function openNewWindow(sURL, sName, iWidth, iHeight, bResizable, bScrollbars) {
	var iTop  = (screen.height - iHeight) / 2 ;
	var iLeft = (screen.width  - iWidth) / 2 ;
	
	var sOptions = "toolbar=no, status=no, menubar=no" ;
	    sOptions += ",width=" + iWidth ; 
	    sOptions += ",height=" + iHeight ;
	    sOptions += ",resizable="  + (bResizable  ? "yes" : "no") ;
	    sOptions += ",scrollbars=" + (bScrollbars ? "yes" : "no") ;
	    sOptions += ",left=" + iLeft ;
	    sOptions += ",top=" + iTop ;
	
	var oWindow = window.open(sURL, sName, sOptions)
	oWindow.focus();
	
	return oWindow ;
}

function openInnerUrl(url,id,bpopup) {
	if(bpopup==2) {
		openNewWindow(url,"", 660, 540, true, true);
		return false;
	}
	return true;
}

function openPopup(url) {
	openNewWindow(url,"", 660, 540, true, true);
}

function openNews(path,id,item) {
    var url = path+"/news.php?id="+id+"&item="+item;
	openPopup(url);
	return false;
}

function openExternalUrl(url,bpopup) {
	return true;
}

function openDocument(docR_Id) {
	return true;
}

function preview(id,lng) {
    var url = "/_backOffice/preview.php?id="+id;
	openPopup(url);
}

function fsearch() {
	var searchText = document.searchform.searchtext.value;
	if(searchText.length<2) return;
    document.searchform.submit();
}

function trim(str) {
	var re1 = new RegExp("^ *","g");
	var re2 = new RegExp(" *$","g");
	return str.replace(re1,"").replace(re2,"");   
}

