//GLOBALS
var w3c = (document.getElementById) ? 1:0
var ns4 = (document.layers) ? 1:0  //browser detect for NS4 & W3C standards

function getObject(sObj) {
var theObj;
	if (w3c)
		theObj = document.getElementById(sObj);
	else if (ns4)
		theObj = eval("document." + sObj);
	return theObj;
}

/*
function visual(aa) {
if (document.getElementById){
	if(document.getElementById(aa).style.display=='none'){
		document.getElementById(aa).style.display='';
	}else{
		document.getElementById(aa).style.display='none';
	}
}
}
*/


function visual(aa){
var obj;
	obj=getObject(aa);
	if (obj){
		if(obj.style.display=='none'){
			obj.style.display='';
		}else{
			obj.style.display='none';
		}
	}
}




function motorericerca()
  {
  var tro=document.motore.f_cerca;
  if(tro.value=="")
    {
    alert('Devi inserire un testo per la ricerca');
    tro.focus();
    return (false);
    }
  else
    {
    return(true);
    }
  }

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function gb_inner(aaa,bbb){

	obj=getObject(aaa);
	obj.innerHTML = bbb;

}

function vai(url){
	if (confirm('Confermi la cancellazione?')){
	location.replace(url);
	}else{
	}
}



function apriPop(foto) {
	msg=open("","DisplayWindows"," toolbar=no,directories=no,menubar=no,resizable=no");
	d=msg.document;
	d.write("<head><SCRIP"+"T>");
	d.write("function ridimensiona(){");
	d.write("window.resizeTo(");
	d.write("document.im1.width+11,");
	d.write("document.im1.height+29);");
	d.write("};document.title=document.im1.src;</SCRIP"+"T></head>");
	d.write("<body topmargin=0 leftmargin=0 scroll=no>");
	d.write("<img id='im1' src='"+foto+"' name='im1' onLoad='ridimensiona()'>");
	d.write("</body>");
	d.close();
	msg.focus();
}


function window_open(theurl,w_width,w_height){
  window.open(theurl, '', 'width='+w_width+',height='+w_height+',left=0,top=0,resizable=yes,menubar=no,toolbar=no, scrollbars=yes,locations=no,status=no');
}



/*prova ajax per glossario*/
var ricerca_pro;
var counter;

function CercaParola(id)
{
var valorecampo;

	 	if (window.XMLHttpRequest) {
  		ricerca_pro = new XMLHttpRequest();
  		ricerca_pro.onreadystatechange = ricevi;
  
  		valorecampo="cercagloss.php?id="+id;
//  		alert(valorecampo);
  		ricerca_pro.open("GET", valorecampo , true);
  		ricerca_pro.send(null);
  		// per IE 
		} else if (window.ActiveXObject) {
			ricerca_pro = new ActiveXObject("Microsoft.XMLHTTP");
			if (ricerca_pro) {
			ricerca_pro.onreadystatechange = ricevi;
			valorecampo="cercagloss.php?id="+id;
			//alert(valorecampo);
			ricerca_pro.open("GET", valorecampo , true);
			ricerca_pro.send();
		}
	}
}

function ricevi() {
var strRes;
var arrValori;
	if (ricerca_pro.readyState == 4) {
		strRes=ricerca_pro.responseText;
    arrValori=strRes.split("|");
		
    
    ddrivetip('<h3>'+arrValori[0]+'</h3><br>'+arrValori[1],'#FFFFFF',300);
        
	}else{
		//alert("Problemi con la ricerca!");
		//alert("State:"+ ricerca_pro.readyState + " Status:" + ricerca_pro.status + " "+ ricerca_pro.statusText+"\r\n");
	}
}
/*fine prova ajax per glossario*/

