	function getPosX(obj) {
			var curleft = 0;
			if (obj.offsetParent) {
			while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
			}
			}
			else if (obj.x)
			curleft += obj.x;
			return curleft;
	}
	
	function getPosY(obj) {
			var curtop = 0;
			if (obj.offsetParent) {
			while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
			}
			}
			else if (obj.y)
			curtop += obj.y;
			return curtop;
	}

	function showSubReparti(divname, theX, theY){
			deltaX=18;
			deltaY=24;
			//alert(document.getElementById(divname).style.left + ">>>" +(theX-deltaX));
			document.getElementById(divname).style.visibility='visible'; 	
			document.getElementById(divname).style.left = (parseInt(theX)-deltaX) + "px";
			document.getElementById(divname).style.top = (parseInt(theY)+deltaY) + "px";
			document.getElementById(divname).style.zIndex = 1000;
	}
		
	function hideSubReparti(){
			arrDiv = new Array();
			arrDiv[0]="subIrpinia";
			arrDiv[1]="subSport";
			
			for (i=0; i<arrDiv.length; i++){
				document.getElementById(arrDiv[i]).style.visibility='visible'; 	
				document.getElementById(arrDiv[i]).style.visibility='hidden';
				document.getElementById(arrDiv[i]).style.left = "-3000px";
				document.getElementById(arrDiv[i]).style.top = "-3000px";
			}
	}

function highlightText(searchString, tagId){
			
			arrSearchString=searchString.split(" ");
			inH=document.getElementById(tagId).innerHTML;

			for(i=0; i<arrSearchString.length; i++)
			{
					theWord=arrSearchString[i].toLowerCase();
					inHtemp=inH.toLowerCase();
					n=71; // numero di caratteri aggiunti dalla parte "<span style='background-color:#FFFF00';font-weight:bold;></span>"
					len=theWord.length;
					pos=-(n+len); // inizializzo la posizione nella inH
					posTemp=0;	 // inizializzo la posizione nella inHtemp
					while (inHtemp.indexOf(theWord)>-1)
					{
							posTemp=inHtemp.indexOf(theWord)
							pos=pos+(n+len)+posTemp;

							theWrittenWord=inH.substr(pos,len);

							inHtemp=inHtemp.substring(posTemp+len);

							if (!(inHtemp.indexOf(">") < inHtemp.indexOf("<")))
							{ // sostituisce solo se non siamo all'interno di un tag
								pre=inH.substr(0,pos);
								
								post=inH.substring(pos+len);
								//alert(pre)
								//alert(theWrittenWord)
								//alert(post)
								inH = pre + "<span style='background-color:#FFFF00';font-weight:bold;><b>"+theWrittenWord+"</b></span>" + post;

							}
							else
							{
								pos=pos-n; // poiché non ha sostituito, scalo incremento n
							}

					}
			}
			document.getElementById(tagId).innerHTML=inH;
	}

function writeSwf(str, w, h){
	if(h>0){theH=" height='"+h+"'";}else{theH="";}
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+w+"'"+theH+" align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+str+"' /><PARAM NAME=wmode VALUE=transparent> <param name='quality' value='high' /><param name='bgcolor' /><embed src='"+str+"' wmode=transparent quality='high' width='"+w+"'"+theH+" align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>");
}



