maxL=600;
var bName = navigator.appName;

function closetracking(value, tracking) {
	var conferma = window.confirm("Il sinistro con tracking "+tracking+" verrà chiuso e verrà mandata una comunicazione email a Pluriass. Confermi?");
	if (conferma) {
		window.location.href = "chiuditracking.asp?Id=" +value +"&trackingID='" + tracking +"'";
	}
	else {
		return conferma;
	}
	}

function eliminasinistro(value, tracking) {
	var conferma = window.confirm("Il sinistro con tracking "+tracking+" presenta un errore di trasmissione e verrà eliminato dall'elenco. Confermi?");
	if (conferma) {
		window.location.href = "deletesin.asp?Id=" +value +"&trackingID='" + tracking +"'";
	}
	else {
		return conferma;
	}
	}


function toggleLayer( whichLayer ){  
var elem, vis;  
if( document.getElementById ) // this is the way the standards work    
	elem = document.getElementById( whichLayer );  
else if( document.all ) // this is the way old msie versions work
	elem = document.all[whichLayer];  
else if( document.layers ) // this is the way nn4 works    
	elem = document.layers[whichLayer];  
	vis = elem.style;  // if the style.display value is blank we try to figure it out here  
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)   
	 vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';  
	 vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	 }

/* Popup per mappa stradale */	
function OpenMap(StartCity, sDestination) 	{
	f_open_window_map("/showmap.asp?StartCity="+StartCity+"&Destination="+sDestination, "map");
}

function openWindow(url, height, width, name, parms) {
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, "_new", winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}

function getSelected(select) {
 //ritorna il valore dell’elemento selezionato
 return select.options[select.selectedIndex].value;
 }

function f_open_window_map( aURL, aWinName )
{
   var wOpen;
   var sOptions;

   sOptions = 'status=yes,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
   sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}

function lyteflash(url,width,height,ftitle) {
   var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lyteframe');
   objLink.setAttribute('rev','width:'+width+';height:'+height+';')
   objLink.setAttribute('title',ftitle);
   myLytebox.start(objLink, false, true);
}    

function lytegroup(url, ftitle,igroupname) {
   var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lytebox[' + igroupname+ ']');
   objLink.setAttribute('title',ftitle);
   myLytebox.start(objLink, false, true);
}

/* Popup per fotogallery degli allestimenti */	
function openDett(cUrl) { 
	openWindow(cUrl,450,600,"", "resizable=yes, scrollbars=no"); 
    } 
	
/* player per i video */
function ShowPlayerV(cUrl) { 
	openWindow(cUrl,500,600,"", "resizable=no, scrollbars=no"); 
    } 
	
function roll_over(img_name, img_src)
   {
   document[img_name].src = img_src;
   }
 
function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
	}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",400)
	}
	window.onload = startBlink;
	
var IE = (document.all) ? 1 : 0;
var NS = (document.layers) ? 1 : 0;

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_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 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_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_setTextOfLayer(objName,x,newText) 
{ //v3.0
  if ((obj=MM_findObj(objName))!=null)
  	with (obj)
    	if (navigator.appName=='Netscape') 
		{
			document.write(unescape(newText)); document.close();
		}
	    else
			innerHTML = unescape(newText);
}

function MyImgRestore() { 
  var i;
  for(i=0; i<arguments.length; i++)
  {
  	eval("document." + arguments[i] + ".src='/images/blank.gif'");
  }	
}

function ABImgRestore() {
  var i;

  for(i=0; i<arguments.length; i++)
  {
    var str = arguments[i];
	c1 = str.charAt(0);
	c2 = str.charAt(1);
  	eval("document." + arguments[i] + ".src='/images/" + c1 + c2 + ".gif'");
  }
}     

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function OnMouse(img, el, ancor, el1, stile, action) {
	if ( action=='over' ) {
		el.className=stile + 'over'
		el1.className=stile + 'over'
		ancor.className=stile + 'over'
		img.className='vison'
	} else {
		el.className=stile
		el1.className=stile
		ancor.className=stile
		img.className='visoff'
	}
}

// Change an element's css class
//
function swpClass (obj,cssClass) {
    if (obj)  
    {
      if (obj.className) {
        obj.className = cssClass;
     }
    }
}

// Private function for creating functions that change an element's css class
//
function _ClosureSetClassName (css) {
    return function (id) {
        if (document.getElementById) {
            var element = document.getElementById(id);
	    swpClass(element,css);
        }
    }
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
	if (objCnt) {
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}
function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}
	