
localhost = '/mildb/';
//localhost = '/database/';
if (top.frames.length!=0) {top.location ="./";} 







function nothing(){
}
function submitAction(a){
   o=document.getElementById("form1");
   if(o) {
       if (a) o.action = a;
       o.submit();
   } 
}

function IsNumeric(sText){
   var ValidChars = "0123456789"; // .
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)  { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {
         IsNumber = false;
         }
      }
   return IsNumber;
}
function limpiahtml(s){
   if(s){   
         p=s.indexOf('>'); 
         if(p){
            s=s.substring(p+1);
            p=s.indexOf('<');    
            if(p)
                 s=s.substring(0,p);
         }
   }
   return s;   
}
 


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}
function mytrim(str){
      return str.replace(/^\s*|\s*$/g,"");
}      
function trimNumber(s) {
  while (s.length>1 && (s.substr(0,1) == '0' || s.substr(0,1) == ' ') ) { s = s.substr(1,9999); }
  return s;
}


function clspars(s){
	while (s.indexOf('%')>=0)
		s = s.replace('%',' '); 
	while (s.indexOf('?')>=0)
		s = s.replace('?','%3F'); 
	while (s.indexOf('&')>=0)
		s = s.replace('&','%26'); 
	while (s.indexOf('=')>=0)
		s = s.replace('=','%3D'); 
	while (s.indexOf('\n')>=0)
		s = s.replace('\n',' '); 
	while (s.indexOf('#')>=0)
		s = s.replace('#','%23'); 
return s;
}



function gourl(path,s){
      if (s && s!=0) {
	    window.location = path + s;
      }       
}
function jmpurl(p){
	if(p){
		window.location = localhost + p;
	}
}

function ajaxupd(div,curl,pars,usaget){
      if (!div) {  return; };
      if (!curl) {   return; };
      if (!pars) pars='';
      if (!usaget) met='post'; else met='get';
      if (div) $(div).innerHTML = 'Loading...';
      var url =  localhost + curl;
      var myAjax = new Ajax.Updater(
			div, 
			url, 
			{
				method: met, 
				parameters: pars,
				evalScripts: true
			});
}



function sepvar(url){
      if(url) 
            return url + "&"; 
      else
            return "?";
}
function showdiv(d){
      var o = $(d); if(o) o.style.visibility = 'visible';
}
function hidediv(d){
      var o = $(d); if(o) o.style.visibility = 'hidden';
}

function searchdb(){
	  var s=$('searchdb');
	  if (!s.value) { alert('Please specify word to search' ); return; }
	  window.location = localhost + "db/?s=" + s.value;
}

