function f0() {}
function lookupArea(areas,pos) {
  // es: areas=new Array("horizontal",new Object({from:0,to:103,name:"options"}),new Object({from:104,to:123,name:"openclose"}));
  var type=areas[0];
  var v=type=="horizontal" ? pos.x : pos.y;
  var j=-1;
  for (var i=1;i<areas.length;i++) {
    if (v>=areas[i].from && v<areas[i].to) {
      j=i;
      break;
    }
  }
  return j==-1 ? null : areas[j].name;
}
function getBrowserSize() {
  var bodyWidth = document.documentElement.clientWidth;
  var bodyHeight = document.documentElement.clientHeight;
  if (self.innerHeight){ // all except Explorer 
    bodyWidth = self.innerWidth; 
    bodyHeight = self.innerHeight; 
  } else if (document.documentElement && document.documentElement.clientHeight) {
    // Explorer 6 Strict Mode 		 
    bodyWidth = document.documentElement.clientWidth; 
    bodyHeight = document.documentElement.clientHeight; 
  } else if (document.body) {// other Explorers 		 
    bodyWidth = document.body.clientWidth; 
    bodyHeight = document.body.clientHeight; 
  }
  return [bodyWidth,bodyHeight];
}
function repositionMaximizedComp(comp) {
  comp.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
  comp.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
  var brSize = getBrowserSize();
  var bodyWidth = brSize[0];
  var bodyHeight = brSize[1];
  comp.style.width = bodyWidth + 'px';
  comp.style.height = bodyHeight + 'px';
}
function repositionComp(comp,x,y) {
  comp.style.top = Math.max(y+document.body.scrollTop,y+document.documentElement.scrollTop) + 'px';
  comp.style.left = Math.max(x+document.body.scrollLeft,x+document.documentElement.scrollLeft) + 'px';
}
function ea_addEvent(whichObject,eventType,functionName,suffix) { 
  if(!suffix)suffix = '';
  if(whichObject.attachEvent){ 
    whichObject['e'+eventType+functionName+suffix] = functionName; 
    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
  } else {
    whichObject.addEventListener(eventType,functionName,false);
  }
}
function getObj(n,d) {
  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=getObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}
function getStyleObj(elem,parent) {
  if (document.layers) {
    if (parent) {
      return "document."+parent+".document."+elem;
    } else {
      return "document."+elem + ".style";
    }
  } else if (document.all) {
    return "document.all['"+elem+ "'].style";
  } else if (document.getElementById) {
    return "document.getElementById('"+elem+"').style";
  } else {
    return null;
  }
}
function getObject(id) {
  return eval(getObj(id));
}
function getStyleObject(id) {
  if (getObject(id)!=null) {
    return eval(getStyleObj(id));
  } else {
    return null;
  }
}
function setObjectClass(id,className) {
  var object=getObject(id);
  if (object!=null) {
    object.className=className;
  }
}
function hideCompById(id) {
  var style=getStyleObject(id);
  if (style!=null) {
    style.display="none";
  }
}
function showCompById(id,withStyle) {
  var style=getStyleObject(id);
  if (withStyle==null) withStyle="block";
  if (style!=null) {
    style.display=withStyle;
	}
}
function swapDisplay(id){
  if (getStyleObject(id).display=='block' || getStyleObject(id).display==''){
    hideCompById(id);
  } else {
    showCompById(id,'');
  }
}
function msie() {
  return navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
}
function msie6() {
  return navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1;
}
function encodeFormFields(form) {
  var s="";
  var elements=form.elements;
  for (var i=0;i<elements.length;i++) {
    var e=elements[i];
    if (i!=0) {
      s+="&";
    }
    if (e.name != null && e.value != null) {
      s+=e.name+"="+escape(e.value);
    }
  }
  return s;
}
// http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp
function getStylePropertyValue(el, propertyName) {
  if (!document.getElementById) {
    return null;
  } else {
    var value = el.style[toCamelCase(propertyName)];
    if (!value) {
      if (document.defaultView) {
        value = document.defaultView.getComputedStyle(el, "").getPropertyValue(propertyName);
      } else if (el.currentStyle) {
        value = el.currentStyle[toCamelCase(propertyName)];
      }
    }
    return value;
  }
}
function hasBarFrame01() {
  return parent && parent.barFrame ? 1 : 0;
}
// http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp
function toCamelCase( sInput ) {
  var oStringList = sInput.split('-');
  if (oStringList.length == 1) {
    return oStringList[0];
  }
  var ret = sInput.indexOf("-") == 0 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
  for (var i = 1, len = oStringList.length; i < len; i++) {
    var s = oStringList[i];
    ret += s.charAt(0).toUpperCase() + s.substring(1)
  }
  return ret;
}
function eventGetTarget(e) {
	var targ;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
  return targ;
}
// restituisce la posizione relativa al target dell'evento
function eventRelativeXY(e,comp) {
  var mouseXY=eventClientXY(e);
  if (comp==null) {
    comp=eventGetTarget(e);
  }
  var x=mouseXY.x - absoluteOffsetLeft(comp);
  var y=mouseXY.y - comp.offsetTop;
  var xperc=Math.round(x*100/comp.clientWidth);
  var yperc=Math.round(y*100/comp.clientHeight);
  return new Object({x:x,y:y,xperc:xperc,yperc:yperc});
}
function absoluteOffsetLeft(comp) {
  return comp==null ? 0 : comp.offsetLeft + absoluteOffsetLeft(comp.offsetParent);
}
function eventClientXY(e) {
  var x,y;
  if (document.all) { // grab the x-y pos.s if browser is IE
    x = event.clientX+document.body.scrollLeft;
    y = event.clientY+document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    x = e.pageX;
    y = e.pageY;
  }  
  // catch possible negative values in NS4
  if (x < 0){x = 0}
  if (y < 0){y = 0}
  return new Object({x:x,y:y});
}
function iwFlashGoto(flashId,componentId,label) {
  var flash=getObject(flashId);
  if (flash!=null && flash.TGotoLabel) {
    try {
      flash.TGotoLabel(componentId+".jsActions",label);
    } catch (e) {
      // ignore
    }
  }
}
function iwFlashSetVariable(flashId,varPath,valueString) {
  var flash=getObject(flashId);
  if (flash!=null && flash.SetVariable) {
    try {
      flash.SetVariable(varPath,""+valueString);
    } catch (e) {
      // ignore
    }
  }
}
var iwGo_interval=null;
function iwGo_schedule(url,target,whenMillis) {
  iwGo_interval=window.setInterval("iwGo_exec('"+url+"','"+target+"')",whenMillis);
}
function iwGo_cancel() {
  if (iwGo_interval!=null) {
    window.clearInterval(iwGo_interval);
  }
}
function iwGo_exec(url,target) {
  iwGo_cancel();
  var tw=toTargetWindow(target);
  if (tw!=null) {
    tw.location=url;
  } else {
    window.open(url);
  }
}
function toTargetWindow(t) {
  var res=null;
  if (t==null || t=='' || t=='_self') {
    res=self;
  } else if (t=='_top') {
    res=top;
  } else if (t=='_parent') {
    res=parent;
  } else if (t=='_blank') {
    res=null;
  } else {
    res=window.frames[t];
  }
  return res;
}

function iwOpenZoomPopup(theURL, winName) {
  var w = screen.width - 40;
  var h = screen.height - 100;
  var features = 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width='+w+',height='+h+',screenX=15,screenY=20,left=15,top=20';
  window.open(theURL+'&width='+(w-100)+'&height='+(h-140),winName,features);
}

function iwGenerateClick(dest) {
  if (document.createEvent) {
    var evObj = document.createEvent('MouseEvents');
    evObj.initEvent('click', true, true);
    dest.dispatchEvent(evObj);
  } else if (document.createEventObject) {
    dest.fireEvent('onclick');
  } else {
    alert("Sorry: Unknown browser -- Unable to propagate click -- please contact support");
  }
}
