// varie ed eventuali sript a supporto della applicazione IMS EaimsVari.js
// per e-utile rosangela valenti
// 11.04 prima versione

function miafunzione() {
		parent.ricerche.document.location = appDir + "asp/ricerca.asp?layer="+LayerName[ActiveLayerIndex]
		}

function livellivedi() { 
    parent.MapFrame.clickFunction('livelli');
}

function legendavedi() { 
    parent.MapFrame.clickFunction('legend');
}

function showImage() {
     document.nome.src="images/provacartaweb.bmp";
}

// get the Map Image width
function getMapWidth () {
    mapFrameWidth = thePageDoc.body.clientWidth;
	return mapFrameWidth;
}

function setBorder (obj, action) {
	obj.style.border = action;
}

 //get the Map Image height
function getMapHeight () {
    mapFrameHeight = thePageDoc.body.clientHeight;
	return mapFrameHeight;
}

function revertToolPic() {
	 if (parent.MapFrame.useZoomIn) document.zoomin.src="images/zoomin.jpg";
	 if (parent.MapFrame.useZoomOut) document.zoomout.src="images/zoomout.jpg";
	 if (parent.MapFrame.usePan) document.pan.src="images/pan.jpg";
	 document.identify.src="images/identifica.jpg";
	 document.dovesono.src="images/dovesono.jpg";
	 document.centometri.src="images/buffer.jpg";
	 document.ctr.src="images/ctc.jpg";
	 document.measure.src="images/measure.jpg";
}
function setToolPic(functName) {

     var stringCom;
     var t_find;
     
     if (parent.MapFrame) {
				t_find = parent.MapFrame;
			} 
			
	 revertToolPic();
	 parent.MapFrame.focus();
	 if (functName=="Zoom In") {
		document.zoomin.src="images/zoomin.jpg";
	    stringCom = "Aumenta";
	 } else if (functName=="Zoom Out") {
		document.zoomout.src="images/zoomout.jpg";
		stringCom = t_find.modeList[1];
	 } else if (functName=="Pan") {
		document.pan.src="images/pan.jpg";
		stringCom = t_find.modeList[2];
	 } else if (functName=="Identify") {
		document.identify.src="images/identifica.jpg";
		stringCom = t_find.modeList[3];
	 } else if (functName=="DoveSono") {
		document.dovesono.src="images/dovesono.jpg";
		stringCom = t_find.modeList[22];
	 } else if (functName=="CentoMetri") {
		document.centometri.src="images/buffer.jpg";
		stringCom = t_find.modeList[23];
	 } else if (functName=="ctr") {
		document.ctr.src="images/ctc.jpg";
		stringCom = t_find.modeList[24];
	 } else if (functName=="Measure") {
		document.measure.src="images/measure.jpg";
		stringCom = t_find.modeList[12];
	 } 
	 document.f1.casella.value = stringCom;
}

function cambia(a) {              
             if (a == "uno" ) {
                  document.getElementById('uno').style.backgroundColor = "#eaf3fa";
                  document.getElementById('due').style.backgroundColor = "#cdd3dd";
              }
              else if (a == "due" ) {
                  document.getElementById('uno').style.backgroundColor = "#cdd3dd";
                  document.getElementById('due').style.backgroundColor = "#eaf3fa";
              }
}


//funzione che chiude la pop up
function chiudi(element){ 
  window.close();
}

//funzione che chiude la pop up
function chiudif(element){ 
  window.parent.close();
}

//funzione che torna indietro di 1
function up() { 
      location.href='javascript:history.go(-1)'; 
}


//funzione che apre una finestra a tutto video
function apriWin(strUrl){

          var w = (Math.floor(screen.width)-10);
          var h = (Math.floor(screen.height)-90);
          var l = 0;
          var t = 0;
          var feature1="resizable=yes, location=no, status=yes, menubar=no, scrollbars=no, width="+w+", height="+h+",left=0,top=0";
          window.open(strUrl,"mappa",feature1); 
}
//funzione che apre una date le dimesione
function apriWin1(strUrl,w,h,winName){
          var winName = "Help";
          var w = w;
	  var h = h;
          var feature1="resizable=yes, location=no, status=no, menubar=no, scrollbars=yes, width="+w+", height="+h+",left=0,top=0";
          window.open(strUrl,winName,feature1); 
} 


//apre ad una data scala
function DoScala(scala) {
		var x  = (t.eLeft + t.eRight) / 2.;
		var y  = (t.eTop + t.eBottom) / 2.;
		var dx = ((scala+0.5) * t.iWidth) / 100. / (567./15.);
		var dy = ((scala+0.5) * t.iHeight) / 100. / (567./15.);
		t.eLeft   = x - dx/2;
		t.eRight  = x + dx/2;
		t.eBottom = y - dy/2;
		t.eTop    = y + dy/2;
		t.sendMapXML();
}




