function new_window(url,h,w,m,o){  
  var variables="width="+w+",height="+h+",resizable="+m+",scrollbars="+m+",left=100,top=100";
  if(o!="0"){
  variables+=",toolbar=0,location=1,status=1,menubar=1";
  }  	
  window.open(url,get_random_num(),variables);  
  return false;
}

function get_random_num()
{
    var ranNum = Math.floor(Math.random()*5);
    return ranNum;
}

function printpage() {
	window.print();
	return false;
}

function toggleDiv(idDiv,idBut,toClass,vel)
{
	$("#"+idBut).toggleClass(toClass);					
	$("#"+idDiv).toggle(vel);
}	

function sanit(){
	var s=document.semanticSearch.pregunta.value;
	document.semanticSearch.pregunta.value=s.replace(/[<>\"\'%;()&+]/g,"");
	return true;
}

function searchSubmit(){
	sanit();
	document.semanticSearch.submit();
}

function validar_entrada(){
        if (document.formulario.usuario.value=='' || document.formulario.password.value==''){
			alert('Debe introducir usuario y contraseņa');
		}else{
			document.formulario.submit();
		}
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
    obj.addEventListener(evType, fn, true); 
    return true; 
 } else if (obj.attachEvent){ 
    var r = obj.attachEvent("on"+evType, fn); 
    return r; 
 } else { 
    return false; 
 } 
} 

