//www.difnet.it  

function popup(url)
{
	newwindow=window.open(url,'name','height=600,width=600');
}




 function gonomesito(targ,selObj,restore){ 
			   url='/?mod=AREA_CSR&id_provincia=' + selObj.options[selObj.selectedIndex].value + '';
			   eval(targ+".location='"+url+"'");
			   if (restore) selObj.selectedIndex=0;
			 }





function confirmDel()
{
var is_confirmed = confirm('Confermi di voler cancellare ?');
return is_confirmed;
} // end of the 'confirmLink()' function


 function gourl(targ,selObj,restore,mod,mod2){ 
			   url='?mod=' + mod + '&mod2=' + mod2 + '&id_cat=' + selObj.options[selObj.selectedIndex].value + '';
			   eval(targ+".location='"+url+"'");
			   if (restore) selObj.selectedIndex=0;
			 }



/***********************************************
* Dynamic Ajax Content
***********************************************/

var bustcachevar=0 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){


var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}




function check_altro(selObj,quale,nome_div){
hideDiv(nome_div);
var id = selObj.options[selObj.selectedIndex].value;
	if (id==quale){
	showDiv(nome_div);
	}
}

function accendi_div(selObj,nome_div,quanti){
var id = selObj.options[selObj.selectedIndex].value;
  	if (document.getElementById){
		if (document.getElementById(id + '_' + nome_div)) {
			for (var i = 1; i <= quanti; i++) {
				if (document.getElementById(i + '_' + nome_div)) { hideDiv(i + '_' + nome_div);}
				else {i = quanti;}
			}
			showDiv(id + '_' + nome_div);
		}
	}
}


function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

function getById(id) { 
	return document.getElementById?document.getElementById(id):(document.all?document.all(id):null); 
	}

function hideDiv(id) { 
	getById(id).style.visibility = "hidden";        
	getById(id).style.display = "none"; 
	}
	
function showDiv(id) {
	getById(id).style.visibility = ""; 
	getById(id).style.display = ""; 
}

function show_div_reg(id) {
	getById(id).style.visibility = ""; 
	getById(id).style.display = ""; 
}


function trova_cat2(selObj) {
theStr ='<select name="tmp" id="tmp"><option value="">Attendere...</option></select>';
document.getElementById('cat2_div').innerHTML=theStr;
var cat2=selObj.options[selObj.selectedIndex].value;
ajaxpage('/ajax_mod.php?op=cerca_cat2&idcat=' + cat2 + '', 'cat2_div');
}

function visualizza_articolo(id_articolo) {
theStr ='';
document.getElementById('art_' + id_articolo).innerHTML=theStr;
ajaxpage('/ajax_mod.php?op=visualizza_articolo&id_articolo=' + id_articolo + '', 'art_' + id_articolo + '');
}

function novisualizza_articolo(id_articolo) {
theStr ='';
document.getElementById('art_' + id_articolo).innerHTML=theStr;
}

 function MM_jumpMenu(targ,selObj,restore){ //v3.0
			   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
			   if (restore) selObj.selectedIndex=0;
			 }