if(top.location==this.location){
	questa=String(this.location);
	pagina=questa.substr(questa.lastIndexOf('/')+1,questa.length);
	if(pagina!='sitemap.htm'){
		this.location='index.htm?'+pagina;
	}
}

function archImg(apri,fol){
	document.getElementById('archiveImg').src='img/spacer.gif';
	imgUrl="archive/"+fol+"/big/img"+(apri)+".jpg";
	document.getElementById('archiveImg').src=imgUrl;
}

function cambiaImmagine(numImg){
	addressImg=document.getElementById('archiveImg').src;
	posizione=addressImg.lastIndexOf('/');
	addressImg=addressImg.substr(0,posizione+1)+numImg+'.jpg';
	document.getElementById('archiveImg').src=addressImg;
}

function changeLang(){
	questa=String(this.location);
	//alert(questa);
	if(questa.lastIndexOf('ita_')!=-1){
		vaiA=questa.replace('ita_','eng_');
	} else {
		vaiA=questa.replace('eng_','ita_');
	}
	//alert(vaiA);
	window.location.href = vaiA;
}

function controlloAudio(){
	stato=top.frames.audioFrame.document.getElementById('statoAudio').value;
	if (stato=='acceso'){
		document.getElementById('spe').style.display='block';
	} else {
		document.getElementById('acc').style.display='block';
	}
}

function csImg(apri,csNum){
	imgUrl="clienti/cs_"+csNum+"/big/img"+(apri)+".jpg";
	aperto=document.getElementById('aperto').value;
	if(apri!=aperto){
		if(aperto!=''){
			document.getElementById('imgBig').src='img/spacer.gif';
			//document.getElementById('dida_'+aperto).style.display='none';	
		}
		document.getElementById('imgBig').src=imgUrl;
		//document.getElementById('dida_'+apri).style.display='block';
		document.getElementById('aperto').value=apri;
	}
}

function csBrowse(pagina){
	indirizzo=String(window.location);
	posizione=indirizzo.lastIndexOf('0');
	indirizzo=indirizzo.substr(0,(posizione+1));
	indirizzo += pagina + '.php'
	window.location.href = indirizzo;
}

function diaryImg(apri){
	document.getElementById('imgBig').src='img/spacer.gif';
	document.getElementById('dida_'+apri).style.display='block';
	aperto=document.getElementById('aperto').value;
	imgUrl="diary/big/img"+(apri+1)+".jpg";
	document.getElementById('imgBig').src=imgUrl;
	if(aperto!=''){
		document.getElementById('dida_'+aperto).style.display='none';
	}
	document.getElementById('aperto').value=apri;
	document.getElementById('dida_'+apri).style.display='block';
}
function fl_caseStudies(lingua){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="976" height="178">\n');
    document.write('<param name="wmode" value="transparent">\n');
    document.write('<param name="movie" value="case_studies_ok.swf?lng='+lingua+'">\n');
    document.write('<param name=quality value=high>\n');
    document.write('<embed wmode="transparent" src="case_studies_ok.swf?lng='+lingua+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="976" height="178"></embed>\n');
    document.write('</object>\n');
}
function fl_diary(ln){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="570" height="270">\n');
    document.write('<param name="wmode" value="transparent">\n');
    document.write('<param name="movie" value="diary.swf?lang='+ln+'">\n');
    document.write('<param name=quality value=high>\n');
    document.write('<embed wmode="transparent" src="diary.swf?lang='+ln+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="570" height="270"></embed>\n');
    document.write('</object>\n');
}
function fl_clock(){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="38" height="39">\n');
    document.write('<param name="movie" value="clock.swf">\n');
    document.write('<param name="wmode" value="transparent">\n');
    document.write('<param name=quality value=high>\n');
    document.write('<embed wmode="transparent" src="clock.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="38" height="39"></embed>\n');
    document.write('</object>\n');
}

function gestAudio(act){
	stato=top.audioFrame.document.getElementById('statoAudio').value;
	if (stato=='spento'){
		document.getElementById('acc').style.display='none';
		document.getElementById('spe').style.display='block';
		top.audioFrame.location='siaudio.htm';
	}
	if (stato=='acceso' || act=="spegni"){
		document.getElementById('acc').style.display='block';
		document.getElementById('spe').style.display='none';
		top.audioFrame.location='noaudio.htm';
	}
}

function imgArchive(totImg){
	indirizzo=String(window.location);
	posizione=indirizzo.lastIndexOf('.');
	numero=indirizzo.substr((posizione-2),2);
	tabella='';
	tabella += '<table border="0" cellspacing="0" cellpadding="0"><tr>';
	for(i=1; i<=totImg; i++){
		tabella += '<td width="41">';
		tabella += '<a href="#" onMouseOver="cambiaImmagine(\'img'+i+'\'); return false"><img src="archive/'+numero+'/img'+i+'.jpg" width="41" height="26" hspace="0" vspace="0" border="0"></a>';
		MM_preloadImages('archive/'+numero+'/img'+i+'.jpg');
		tabella += '</td>';
		if(i!=totImg){
			tabella += '<td width="2"><img src="img/spacer.gif" width="2" height="2"></td>';
		}
	}
	tabella += '</tr></table>';
	document.write(tabella);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
	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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	myWin=window.open(theURL,winName,features);
	myWin.focus();
}

function MM_openCoWindow(theURL,winName,features) { //v2.0
	communication=window.open(theURL,winName,features);
	communication.focus();
}

function MM_openCrWindow(theURL,winName,features) { //v2.0
	credit=window.open(theURL,winName,features);
	credit.focus();
}

function MM_openVideo(theURL,winName,features) { //v2.0
	myVideo=window.open(theURL,winName,features);
	myVideo.focus();
}

function MM_openWrWindow(theURL,winName,features) { //v2.0
	works=window.open(theURL,winName,features);
	works.focus();
}

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 MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function showBorder(divName){
	document.getElementById(divName).style.borderColor="white";
}
function hideBorder(divName){
	document.getElementById(divName).style.borderColor="#99060A";
}

function showNews(imgPath){
	var newImage = "<img  src="+imgPath+" border='0' width='484' height='305'>";
	newImage = newImage +"</img>";
	document.getElementById('slideShow').style.display='none';
	document.getElementById('television').style.display='block';
	document.getElementById('television').innerHTML=newImage;
}
function showTVImage(imgPath){
	var newImage = "<img  src="+imgPath+" border='0' width='484' height='305'>";
	newImage = newImage +"</img>";
	document.getElementById('television').innerHTML=newImage;
}

function showTVImageND(imgPath){
    var newImage = "<img  src="+imgPath+" border='0'>";
	newImage = newImage +"</img>";
	document.getElementById('television').innerHTML=newImage;
}

function restoreSlideNoBorder(){
	document.getElementById('slideShow').style.display='block';
	document.getElementById('television').style.display='none';
}	

function restoreAreas(){
  document.getElementById('textAreas').innerHTML=" ";
}

function hideBordeAll(id,tot){
  for (i=1;i<=tot;i++)
  {
  var divName = "text"+i;
  if (divName != id)
   {
   document.getElementById(divName).style.borderColor="#99060A";
   }
  }
}

function hideAllButId(id,tot){
  document.getElementById(id).style.display='block';
  for (i=1;i<=tot;i++)
  {
    var divName = "text"+i;
    if (divName != id)
     {
      document.getElementById(divName).style.display='none';
     }
  }
  
}

function cursor_wait(){
  document.body.style.cursor = 'wait';
}

function cursor_clear(){
  document.body.style.cursor = '';
}

function wBrowser(url){
  var browser=navigator.appName;
  if (browser != "Microsoft Internet Explorer")
  {
      var myLocation = "http://www.italiabimbi.com/upgrade2009fs/globalplanning.it/www/";
	  myLocation=myLocation+url+".php";
	  alert(myLocation);
	  window.location=myLocation;
  }
}

function changeStyleFF(id,newStyle){
var browser=navigator.appName;
  if (browser != "Microsoft Internet Explorer")
  {
     document.getElementById(id).className=newStyle;  
  }
}

function hideTwo(id1,id2){
	document.getElementById(id1).style.display='none';
	document.getElementById(id2).style.display='none';
}

function showElement(divName){
	document.getElementById(divName).style.display='block';
}

function hideElement(divName){
	document.getElementById(divName).style.display='none';
}
