function gGetElementById(s) { 
	var o = (document.getElementById ? document.getElementById(s) : document.all[s]); 
	return o == null ? false : o; 
	}
function toggleVisibility(id) { 
	var o = gGetElementById(id); 
	if (o != null) { 
	if (o.style.display == 'none') 
	o.style.display = 'block'; 
	else 
	o.style.display = 'none'; } 
	}
	
function setOnOff(id1, id2) {
      changeObjectDisplay(id1, 'block');
      changeObjectDisplay(id2, 'none');
}

function tabsDisplay(tabON, tabOFF1, tabOFF2) {
      	changeObjectDisplay(tabON, 'block');
      	changeObjectDisplay(tabOFF1, 'none');
		changeObjectDisplay(tabOFF2, 'none');
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}	

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function validateForm(){
	var query = document.searchForm.query.value;
	query = trim(query);
	if(query!="")
		return true;
	
	return false;
}

function validateAndSubmit(){
	if(validateForm()){
		document.searchForm.submit();
		return true;
	}
	return false;
}



function smgPopup(url, name, options){
	newwindow=window.open(url, name, options);
	if (window.focus) {
		newwindow.focus()
	}
	return false;
}


function isValidVfsResourceName(path){
	
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var atom=validChars + '+';
	var word="(" + atom + ")";
	// The following pattern describes the structure of the user
	var pathPattern=new RegExp("^" + word + "(\\." + word + ")*$");
	if (path.match(pathPattern)==null) return false;
	return true;
	

}

