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_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_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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function page_Over(idImage,message) {	
	if (document.getElementById(idImage)) {
		myImage = document.getElementById(idImage).src;
		document.getElementById(idImage).src = myImage.replace('.gif','Over.gif');
		document.getElementById('pageMessage').innerHTML = message;
	}
}

function page_Out(idImage,message) {
	if (document.getElementById(idImage)) {
		myImage = document.getElementById(idImage).src;
		document.getElementById(idImage).src = myImage.replace('Over.gif','.gif');
		document.getElementById('pageMessage').innerHTML = message;
	}
}


loaderIDSelected = 0;

function OpenCloseMenu(me) {

		if (loaderIDSelected!=me) {

			//document.getElementById('Menu02Icon' + me).src = "img_struct/arrow.Menu02.Selected.gif";
			document.getElementById('PMenu' + me).style.display = "";
			loaderIDSelected = me;
		
		} else {
			//document.getElementById('Menu02Icon' + me).src = "img_struct/arrow.Menu02.gif";
			document.getElementById('PMenu' + me).style.display = "none";
			loaderIDSelected = -1;
		
		}

}

function calendarSendAction(myLink) { 

	//alert("Check: "+myIDCheck + ": "+myLink);
	
	//Metto lo stato del CHECK in Pausa
	//document.getElementById(myIDCheck).src = "img_struct/checkQuery.gif";
	document.getElementById('calendarTitle').innerHTML="<img src=\"system/img_struct/loaderCircle.gif\" border=\"0\" />";

    var httpCheck = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        httpCheck = new XMLHttpRequest();
        if (httpCheck.overrideMimeType) {
            httpCheck.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            httpCheck = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                httpCheck = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

	
	//Rifinisco la stringa di Link
	var myLink = myLink + "&callNumber="+Math.random();

    if (!httpCheck) {
		//Nel caso il browser non supporti l'oggetto XMLHttpRequest eseguo un semplice redirect
		return false;
	}

	//alert("Check: "+myIDCheck + ": "+myLink);
	
    httpCheck.open('GET', myLink); 
    httpCheck.onreadystatechange = function() { calendarResponse(httpCheck); };
    httpCheck.send(null);  
}

function calendarResponse(httpCheck) {  

    if (httpCheck.readyState == 4) {
    
    	if (httpCheck.status == 200) {
    	
    		//alert(httpCheck.responseText);
    	    var response = httpCheck.responseText;  
       	 	var update = new Array();  
       	 	
        	if (response == "LOGOUT") {  
  		  		window.location="actionphp/logout.php";
  		  	} else {
	        	if (response.indexOf('|' != -1)) {
	            	//Aggiorno il contenuto lista
	            	document.getElementById('calendarArea').innerHTML = response;
   		        }
    	
    		}
            
        }  
        
    }  
    
}





var gmarkers = [];
var htmls = [];
var map;
var locationsHintsCache = new Object();

var line=null; //DANIEL

/********** DANIEL *********/
//poligono
//VARIABLES
var poly0=[];
var poly1=[];
var poly2=[];
var poly3=[];
var poly4=[];
var poly5=[];
var poly6=[];
//POLIGONOS
//POLIGONOS
poly0.push(new GLatLng(37.16907157713011,-6.800537109375));
poly0.push(new GLatLng(36.70365959719453,-6.492919921875));
poly0.push(new GLatLng(36.465471886798134,-6.1962890625));
poly0.push(new GLatLng(36.03133177633187,-5.625));
poly0.push(new GLatLng(36.412441535356415,-5.185546875));
poly0.push(new GLatLng(36.659606226479696,-4.493408203125));
poly0.push(new GLatLng(36.730079507078415,-4.0869140625));
poly0.push(new GLatLng(36.712467243386264,-3.515625));
poly0.push(new GLatLng(36.76529191711623,-2.70263671875));
poly0.push(new GLatLng(36.86204269508728,-1.95556640625));
poly0.push(new GLatLng(37.26530995561875,-1.7578125));
poly0.push(new GLatLng(37.544577320855815,-1.373291015625));
poly0.push(new GLatLng(37.68382032669382,-0.911865234375));
poly0.push(new GLatLng(38.10862766432127,-0.703125));
poly0.push(new GLatLng(38.479394673276445,-0.296630859375));
poly0.push(new GLatLng(38.80547022317744,0.076904296875));
poly0.push(new GLatLng(38.99357205820944,-0.186767578125));
poly0.push(new GLatLng(39.351290355267025,-0.3515625));
poly0.push(new GLatLng(39.65645604812829,-0.28564453125));
poly0.push(new GLatLng(40.069664523297774,0.010986328125));
poly0.push(new GLatLng(40.622291783092706,0.54931640625));
poly0.push(new GLatLng(40.697299008636755,0.791015625));
poly0.push(new GLatLng(40.78885994449482,0.736083984375));
poly0.push(new GLatLng(40.99648401437787,0.823974609375));
poly0.push(new GLatLng(41.28606238749825,1.77978515625));
poly0.push(new GLatLng(41.335575973123895,2.109375));
poly0.push(new GLatLng(41.475660200278206,2.208251953125));
poly0.push(new GLatLng(41.631867410697474,2.548828125));
poly0.push(new GLatLng(41.75492216766298,2.9443359375));
poly0.push(new GLatLng(41.95949009892464,3.2080078125));
poly0.push(new GLatLng(42.512601715736665,3.0322265625));
poly0.push(new GLatLng(43.17313537107136,3.153076171875));
poly0.push(new GLatLng(43.5326204268101,3.97705078125));
poly0.push(new GLatLng(43.6122167681757,4.493408203125));
poly0.push(new GLatLng(43.48481212891601,4.954833984375));
poly0.push(new GLatLng(43.34116005412307,5.416259765625));
poly0.push(new GLatLng(43.117024121350475,6.13037109375));
poly0.push(new GLatLng(43.50075243569041,6.92138671875));
poly0.push(new GLatLng(43.8503744993026,7.66845703125));
poly0.push(new GLatLng(44.43377984606822,8.8330078125));
poly0.push(new GLatLng(44.03232064275081,10.0634765625));
poly0.push(new GLatLng(43.028745251348795,10.546875));
poly0.push(new GLatLng(41.681117562906515,12.23876953125));
poly0.push(new GLatLng(41.20345619205129,13.77685546875));
poly0.push(new GLatLng(40.6723059714534,14.249267578125));
poly0.push(new GLatLng(40.68896903762434,14.732666015625));
poly0.push(new GLatLng(40.26276066437183,14.930419921875));
poly0.push(new GLatLng(40.06546068206551,15.589599609375));
poly0.push(new GLatLng(39.20671884491848,16.072998046875));
poly0.push(new GLatLng(38.85682013474361,16.2158203125));
poly0.push(new GLatLng(38.56964280859043,15.88623046875));
poly0.push(new GLatLng(38.40194908237822,15.9136962890625));
poly0.push(new GLatLng(38.1215932716592,15.66650390625));
poly0.push(new GLatLng(37.92686760148135,15.9136962890625));
poly0.push(new GLatLng(38.12591462924154,16.1883544921875));
poly0.push(new GLatLng(38.40194908237822,16.5399169921875));
poly0.push(new GLatLng(38.792626957868904,16.578369140625));
poly0.push(new GLatLng(38.976492485539396,17.138671875));
poly0.push(new GLatLng(39.35978526868998,17.105712890625));
poly0.push(new GLatLng(39.495563360594694,16.962890625));
poly0.push(new GLatLng(39.631076770083666,16.6387939453125));
poly0.push(new GLatLng(39.854937988531276,16.5234375));
poly0.push(new GLatLng(40.057052221322,16.611328125));
poly0.push(new GLatLng(40.23760536584023,16.7816162109375));
poly0.push(new GLatLng(40.526326510744006,17.0013427734375));
poly0.push(new GLatLng(40.371658891506094,17.1990966796875));
poly0.push(new GLatLng(40.308854425637634,17.60009765625));
poly0.push(new GLatLng(40.22921818870117,17.9296875));
poly0.push(new GLatLng(40.10328591293439,17.9901123046875));
poly0.push(new GLatLng(39.91394967016643,18.0560302734375));
poly0.push(new GLatLng(39.812755695478124,18.3306884765625));
poly0.push(new GLatLng(39.88445017823439,18.3966064453125));
poly0.push(new GLatLng(40.12009038025332,18.292236328125));
poly0.push(new GLatLng(40.23341190711505,18.2098388671875));
poly0.push(new GLatLng(40.325607999732064,18.1549072265625));
poly0.push(new GLatLng(40.455307212131466,17.9132080078125));
poly0.push(new GLatLng(40.52215098562377,17.77587890625));
poly0.push(new GLatLng(40.613952441166596,17.5177001953125));
poly0.push(new GLatLng(40.684803661591246,17.127685546875));
poly0.push(new GLatLng(40.75557964275588,16.72119140625));
poly0.push(new GLatLng(40.75557964275588,16.490478515625));
poly0.push(new GLatLng(40.75557964275588,16.380615234375));
poly0.push(new GLatLng(40.80133575979199,16.259765625));
poly0.push(new GLatLng(40.88444793903562,16.160888671875));
poly0.push(new GLatLng(41.091772220976644,15.97412109375));
poly0.push(new GLatLng(41.091772220976644,15.655517578125));
poly0.push(new GLatLng(41.07935114946896,15.4742431640625));
poly0.push(new GLatLng(41.12488359929119,15.35888671875));
poly0.push(new GLatLng(41.15384235711447,15.2490234375));
poly0.push(new GLatLng(41.261291493919856,15.281982421875));
poly0.push(new GLatLng(41.306697618181865,15.1446533203125));
poly0.push(new GLatLng(41.48800607185427,15.062255859375));
poly0.push(new GLatLng(41.463311976686235,14.78759765625));
poly0.push(new GLatLng(41.41801503608024,14.490966796875));
poly0.push(new GLatLng(41.50446357504803,14.1998291015625));
poly0.push(new GLatLng(41.63597302844412,13.9801025390625));
poly0.push(new GLatLng(41.705728515237496,13.9306640625));
poly0.push(new GLatLng(41.72623044860001,13.7109375));
poly0.push(new GLatLng(41.88592102814744,13.4747314453125));
poly0.push(new GLatLng(42.00440721296356,13.1451416015625));
poly0.push(new GLatLng(42.204107493733176,12.403564453125));
poly0.push(new GLatLng(42.3016903282445,12.2332763671875));
poly0.push(new GLatLng(42.391008609205045,12.01904296875));
poly0.push(new GLatLng(42.524748042348165,11.9805908203125));
poly0.push(new GLatLng(42.742978093466434,11.414794921875));
poly0.push(new GLatLng(42.93631775765234,11.282958984375));
poly0.push(new GLatLng(43.21718664827096,11.42578125));
poly0.push(new GLatLng(43.35314407444698,11.7169189453125));
poly0.push(new GLatLng(43.38508989465153,11.7828369140625));
poly0.push(new GLatLng(43.38508989465153,12.0465087890625));
poly0.push(new GLatLng(43.23319741022133,12.0574951171875));
poly0.push(new GLatLng(43.117024121350475,11.9256591796875));
poly0.push(new GLatLng(42.827638636242284,11.876220703125));
poly0.push(new GLatLng(42.767178634023345,11.9586181640625));
poly0.push(new GLatLng(42.65820178455666,12.0245361328125));
poly0.push(new GLatLng(42.60970621339408,12.227783203125));
poly0.push(new GLatLng(42.407234661551875,12.41455078125));
poly0.push(new GLatLng(42.524748042348165,12.7606201171875));
poly0.push(new GLatLng(42.68647341541783,13.0792236328125));
poly0.push(new GLatLng(42.823609807301956,13.24951171875));
poly0.push(new GLatLng(42.924251753870685,13.0462646484375));
poly0.push(new GLatLng(43.00866413845207,12.9473876953125));
poly0.push(new GLatLng(43.193162620926074,12.9254150390625));
poly0.push(new GLatLng(43.329173667843904,12.85400390625));
poly0.push(new GLatLng(43.52067190243758,12.50244140625));
poly0.push(new GLatLng(43.57641143300887,12.205810546875));
poly0.push(new GLatLng(43.7393520791547,12.3101806640625));
poly0.push(new GLatLng(43.80678314779554,11.8487548828125));
poly0.push(new GLatLng(43.92163712834673,11.6839599609375));
poly0.push(new GLatLng(44.13097085672744,11.5301513671875));
poly0.push(new GLatLng(44.14279782818058,11.217041015625));
poly0.push(new GLatLng(44.3827657622524,11.2774658203125));
poly0.push(new GLatLng(44.54742015866826,11.041259765625));
poly0.push(new GLatLng(44.820812031724444,10.74462890625));
poly0.push(new GLatLng(44.89479576469787,10.61279296875));
poly0.push(new GLatLng(44.92591837128866,10.458984375));
poly0.push(new GLatLng(44.95702412512118,10.2886962890625));
poly0.push(new GLatLng(45.061881623213004,10.030517578125));
poly0.push(new GLatLng(45.0657615477031,9.7283935546875));
poly0.push(new GLatLng(45.034714778688596,9.371337890625));
poly0.push(new GLatLng(44.71161010858431,9.305419921875));
poly0.push(new GLatLng(44.75453548416007,9.195556640625));
poly0.push(new GLatLng(44.89868701215517,9.0087890625));
poly0.push(new GLatLng(45.00365115687186,8.7890625));
poly0.push(new GLatLng(45.046359292005505,8.624267578125));
poly0.push(new GLatLng(45.17816481220637,8.525390625));
poly0.push(new GLatLng(45.34056313889858,8.5418701171875));
poly0.push(new GLatLng(45.31739181570156,8.712158203125));
poly0.push(new GLatLng(45.463983441272724,8.7945556640625));
poly0.push(new GLatLng(45.62172169252443,8.6956787109375));
poly0.push(new GLatLng(45.7905094675247,8.558349609375));
poly0.push(new GLatLng(45.93587062119052,8.61328125));
poly0.push(new GLatLng(46.10561307998295,8.76983642578125));
poly0.push(new GLatLng(46.13797652347657,8.6077880859375));
poly0.push(new GLatLng(46.229253045075275,8.4869384765625));
poly0.push(new GLatLng(46.3507193554773,8.46771240234375));
poly0.push(new GLatLng(46.46624122918088,8.426513671875));
poly0.push(new GLatLng(46.34123949998618,8.28094482421875));
poly0.push(new GLatLng(46.293815562333684,8.14361572265625));
poly0.push(new GLatLng(46.155102414967125,8.14361572265625));
poly0.push(new GLatLng(46.048454743854876,8.0255126953125));
poly0.push(new GLatLng(45.89383147810289,7.87445068359375));
poly0.push(new GLatLng(45.66972459187521,7.921142578125));
poly0.push(new GLatLng(45.558294879426235,7.74261474609375));
poly0.push(new GLatLng(45.53521281284293,7.44049072265625));
poly0.push(new GLatLng(45.47361429775641,7.2894287109375));
poly0.push(new GLatLng(45.46783598133372,7.0806884765625));
poly0.push(new GLatLng(45.57560020947799,6.9818115234375));
poly0.push(new GLatLng(45.69083283645816,6.844482421875));
poly0.push(new GLatLng(45.8364540501877,6.844482421875));
poly0.push(new GLatLng(45.90147732739486,7.0257568359375));
poly0.push(new GLatLng(45.98169518512228,7.0257568359375));
poly0.push(new GLatLng(46.10751733820335,6.87744140625));
poly0.push(new GLatLng(46.233052944798274,6.7840576171875));
poly0.push(new GLatLng(46.403776166694634,6.580810546875));
poly0.push(new GLatLng(46.23685258143992,6.075439453125));
poly0.push(new GLatLng(46.31658418182218,6.13037109375));
poly0.push(new GLatLng(46.41513877649199,6.0919189453125));
poly0.push(new GLatLng(46.33555079758302,5.943603515625));
poly0.push(new GLatLng(46.25964487666548,5.7073974609375));
poly0.push(new GLatLng(46.41513877649199,5.3448486328125));
poly0.push(new GLatLng(46.46813299215554,5.09765625));
poly0.push(new GLatLng(46.34692761055676,4.801025390625));
poly0.push(new GLatLng(46.21785176740299,4.32861328125));
poly0.push(new GLatLng(46.10370875598025,3.8232421875));
poly0.push(new GLatLng(45.78284835197674,3.724365234375));
poly0.push(new GLatLng(45.39844997630408,3.955078125));
poly0.push(new GLatLng(45.236217535866025,4.493408203125));
poly0.push(new GLatLng(44.98811302615805,4.28466796875));
poly0.push(new GLatLng(44.809121700077355,4.02099609375));
poly0.push(new GLatLng(44.86365630540611,3.680419921875));
poly0.push(new GLatLng(44.941473354802504,3.372802734375));
poly0.push(new GLatLng(44.55916341529182,3.076171875));
poly0.push(new GLatLng(44.213709909702054,3.09814453125));
poly0.push(new GLatLng(43.88205730390534,3.2958984375));
poly0.push(new GLatLng(43.69965122967144,2.955322265625));
poly0.push(new GLatLng(43.50075243569041,2.691650390625));
poly0.push(new GLatLng(43.42100882994723,2.427978515625));
poly0.push(new GLatLng(43.45291889355465,1.922607421875));
poly0.push(new GLatLng(43.25320494908846,1.680908203125));
poly0.push(new GLatLng(42.85180609584703,1.878662109375));
poly0.push(new GLatLng(42.66628070564925,2.142333984375));
poly0.push(new GLatLng(42.439674178149424,1.95556640625));
poly0.push(new GLatLng(42.44778143462245,1.51611328125));
poly0.push(new GLatLng(42.53689200787314,1.42822265625));
poly0.push(new GLatLng(42.65012181368022,1.439208984375));
poly0.push(new GLatLng(42.74701217318064,1.0986328125));
poly0.push(new GLatLng(42.867912483915305,0.780029296875));
poly0.push(new GLatLng(42.71473218539458,0.670166015625));
poly0.push(new GLatLng(42.682435398386204,0.340576171875));
poly0.push(new GLatLng(42.682435398386204,0.076904296875));
poly0.push(new GLatLng(42.81152174509788,-0.37353515625));
poly0.push(new GLatLng(42.924251753870685,-0.72509765625));
poly0.push(new GLatLng(42.69051116998238,-1.0107421875));
poly0.push(new GLatLng(42.415346114253595,-1.329345703125));
poly0.push(new GLatLng(41.9758272610257,-1.461181640625));
poly0.push(new GLatLng(41.85319643776675,-1.8896484375));
poly0.push(new GLatLng(41.52502957323801,-1.966552734375));
poly0.push(new GLatLng(41.31907562295136,-2.1533203125));
poly0.push(new GLatLng(41.120745590167445,-2.0654296875));
poly0.push(new GLatLng(41.07935114946896,-1.82373046875));
poly0.push(new GLatLng(40.88860081193033,-1.60400390625));
poly0.push(new GLatLng(40.58892816969374,-1.614990234375));
poly0.push(new GLatLng(40.287906612507406,-1.64794921875));
poly0.push(new GLatLng(40.002371935876475,-1.40625));
poly0.push(new GLatLng(39.85915479295669,-1.241455078125));
poly0.push(new GLatLng(39.631076770083666,-1.505126953125));
poly0.push(new GLatLng(39.36827914916011,-1.29638671875));
poly0.push(new GLatLng(39.00211029922512,-1.153564453125));
poly0.push(new GLatLng(38.659777730712534,-0.94482421875));
poly0.push(new GLatLng(38.72837591823977,-1.351318359375));
poly0.push(new GLatLng(38.40194908237822,-1.614990234375));
poly0.push(new GLatLng(38.30718056188315,-1.988525390625));
poly0.push(new GLatLng(38.06539235133249,-2.28515625));
poly0.push(new GLatLng(38.09998264736478,-2.5048828125));
poly0.push(new GLatLng(38.324420427006544,-2.493896484375));
poly0.push(new GLatLng(38.453588708941375,-2.61474609375));
poly0.push(new GLatLng(38.479394673276445,-3.1201171875));
poly0.push(new GLatLng(38.41916639395372,-3.570556640625));
poly0.push(new GLatLng(38.40194908237822,-3.84521484375));
poly0.push(new GLatLng(38.496593518947556,-4.405517578125));
poly0.push(new GLatLng(38.642617906345244,-4.74609375));
poly0.push(new GLatLng(38.69408504756833,-5.108642578125));
poly0.push(new GLatLng(38.56534784488544,-5.416259765625));
poly0.push(new GLatLng(38.16911413556086,-5.60302734375));
poly0.push(new GLatLng(38.03078569382294,-5.9326171875));
poly0.push(new GLatLng(38.039438891821725,-6.383056640625));
poly0.push(new GLatLng(38.16911413556086,-6.78955078125));
poly0.push(new GLatLng(37.996162679728116,-7.218017578125));
poly0.push(new GLatLng(37.622933594900864,-7.481689453125));
poly0.push(new GLatLng(37.142803443716836,-7.437744140625));
poly1.push(new GLatLng(42.70665956351041,9.283447265625));
poly1.push(new GLatLng(42.72280375732725,9.151611328125));
poly1.push(new GLatLng(42.62587560259134,8.9208984375));
poly1.push(new GLatLng(42.5530802889558,8.7451171875));
poly1.push(new GLatLng(42.26917949243506,8.558349609375));
poly1.push(new GLatLng(42.17968819665961,8.72314453125));
poly1.push(new GLatLng(41.89409955811395,8.63525390625));
poly1.push(new GLatLng(41.88592102814744,8.756103515625));
poly1.push(new GLatLng(41.55792157780417,8.843994140625));
poly1.push(new GLatLng(41.49212083968776,8.997802734375));
poly1.push(new GLatLng(41.41801503608024,9.20654296875));
poly1.push(new GLatLng(41.50034959128928,9.261474609375));
poly1.push(new GLatLng(41.590796851056005,9.31640625));
poly1.push(new GLatLng(41.763117447005875,9.404296875));
poly1.push(new GLatLng(41.91862886518302,9.404296875));
poly1.push(new GLatLng(42.05745022024679,9.459228515625));
poly1.push(new GLatLng(42.12267315117256,9.547119140625));
poly1.push(new GLatLng(42.22851735620849,9.547119140625));
poly1.push(new GLatLng(42.38289400961403,9.547119140625));
poly1.push(new GLatLng(42.577354839557835,9.481201171875));
poly1.push(new GLatLng(42.66628070564925,9.42626953125));
poly1.push(new GLatLng(42.90011265525328,9.47021484375));
poly1.push(new GLatLng(43.01268088642034,9.393310546875));
poly1.push(new GLatLng(42.70665956351041,9.283447265625));
poly2.push(new GLatLng(38.9871677013526,1.241455078125));
poly2.push(new GLatLng(38.927365763942475,1.21124267578125));
poly2.push(new GLatLng(38.86323626888358,1.2744140625));
poly2.push(new GLatLng(38.88675714069588,1.4117431640625));
poly2.push(new GLatLng(38.91881851059804,1.5216064453125));
poly2.push(new GLatLng(39.01064750994083,1.57928466796875));
poly2.push(new GLatLng(39.09383130692365,1.59576416015625));
poly2.push(new GLatLng(39.089567854849335,1.4227294921875));
poly2.push(new GLatLng(39.049052206453524,1.3348388671875));
poly3.push(new GLatLng(39.74943369178244,2.449951171875));
poly3.push(new GLatLng(39.85072092501597,2.691650390625));
poly3.push(new GLatLng(39.87601941962114,2.845458984375));
poly3.push(new GLatLng(39.825413103424786,3.153076171875));
poly3.push(new GLatLng(39.614152077002636,3.40576171875));
poly3.push(new GLatLng(39.26628442213066,3.09814453125));
poly3.push(new GLatLng(39.40224434029275,2.757568359375));
poly3.push(new GLatLng(39.5633531658293,2.625732421875));
poly3.push(new GLatLng(39.5633531658293,2.230224609375));
poly4.push(new GLatLng(39.92448212528482,3.86444091796875));
poly4.push(new GLatLng(39.93606595478704,3.9385986328125));
poly4.push(new GLatLng(39.91605629078665,4.038848876953125));
poly4.push(new GLatLng(39.87918107556866,4.1143798828125));
poly4.push(new GLatLng(39.82013946676259,4.22698974609375));
poly4.push(new GLatLng(39.81908469086111,4.28192138671875));
poly4.push(new GLatLng(39.84755795735591,4.29840087890625));
poly4.push(new GLatLng(39.883396390093075,4.3121337890625));
poly4.push(new GLatLng(39.930800820752765,4.28466796875));
poly4.push(new GLatLng(39.9676482528045,4.266815185546875));
poly4.push(new GLatLng(40.00026797264677,4.253082275390625));
poly4.push(new GLatLng(40.011838968100335,4.19952392578125));
poly4.push(new GLatLng(40.047591462658765,4.1473388671875));
poly4.push(new GLatLng(40.063358664163275,4.082794189453125));
poly4.push(new GLatLng(40.062307630891,3.961944580078125));
poly4.push(new GLatLng(40.057052221322,3.863067626953125));
poly4.push(new GLatLng(40.011838968100335,3.794403076171875));
poly4.push(new GLatLng(39.998163944585805,3.824615478515625));
poly4.push(new GLatLng(39.92764154592116,3.8232421875));
poly5.push(new GLatLng(41.13729606112273,8.975830078125));
poly5.push(new GLatLng(40.91351257612757,8.690185546875));
poly5.push(new GLatLng(40.85537053192493,8.3935546875));
poly5.push(new GLatLng(40.68896903762434,8.162841796875));
poly5.push(new GLatLng(40.22082997283284,8.4375));
poly5.push(new GLatLng(39.67337039176558,8.45947265625));
poly5.push(new GLatLng(39.257778150283364,8.316650390625));
poly5.push(new GLatLng(38.96795115401593,8.470458984375));
poly5.push(new GLatLng(38.899583425982705,8.8330078125));
poly5.push(new GLatLng(39.01064750994083,9.052734375));
poly5.push(new GLatLng(39.24927084622338,9.129638671875));
poly5.push(new GLatLng(39.12153746241925,9.5361328125));
poly5.push(new GLatLng(39.45316112807391,9.613037109375));
poly5.push(new GLatLng(39.67337039176558,9.66796875));
poly5.push(new GLatLng(39.85915479295669,9.68994140625));
poly5.push(new GLatLng(40.01078714046552,9.73388671875));
poly5.push(new GLatLng(40.1452892956766,9.656982421875));
poly5.push(new GLatLng(40.27952566881291,9.635009765625));
poly5.push(new GLatLng(40.39676430557203,9.73388671875));
poly5.push(new GLatLng(40.54720023441049,9.832763671875));
poly5.push(new GLatLng(40.68896903762434,9.744873046875));
poly5.push(new GLatLng(40.88860081193033,9.6240234375));
poly5.push(new GLatLng(41.021355108666,9.481201171875));
poly5.push(new GLatLng(41.16211393939692,9.547119140625));
poly5.push(new GLatLng(41.261291493919856,9.173583984375));
poly6.push(new GLatLng(38.1172716583054,12.513427734375));
poly6.push(new GLatLng(37.71859032558813,12.50244140625));
poly6.push(new GLatLng(37.579412513438385,12.930908203125));
poly6.push(new GLatLng(37.42252593456306,13.282470703125));
poly6.push(new GLatLng(37.18657859524883,13.787841796875));
poly6.push(new GLatLng(37.107765071185135,14.21630859375));
poly6.push(new GLatLng(36.80048816579081,14.600830078125));
poly6.push(new GLatLng(36.677230602346214,15.1171875));
poly6.push(new GLatLng(36.85325222344016,15.13916015625));
poly6.push(new GLatLng(37.055177106660814,15.22705078125));
poly6.push(new GLatLng(37.22158045838649,15.216064453125));
poly6.push(new GLatLng(37.39634613318923,15.084228515625));
poly6.push(new GLatLng(37.68382032669382,15.172119140625));
poly6.push(new GLatLng(37.97018468810547,15.380859375));
poly6.push(new GLatLng(38.27268853598095,15.556640625));
poly6.push(new GLatLng(38.151837403006766,15.194091796875));
poly6.push(new GLatLng(38.1172716583054,14.556884765625));
poly6.push(new GLatLng(38.013476231041906,14.26025390625));
poly6.push(new GLatLng(38.004819966413194,13.787841796875));
poly6.push(new GLatLng(38.09133660751176,13.436279296875));
poly6.push(new GLatLng(38.16911413556086,13.128662109375));
poly6.push(new GLatLng(38.013476231041906,12.908935546875));
poly6.push(new GLatLng(38.19502155795575,12.689208984375));
 /**********END DANIEL**********/

function sombreado(){
			 line=new GPolygon(poly0,'#0000ff', 0, 0,'#0000ff',0.3);
				map.addOverlay(line);
				
				line = new GPolygon(poly1,'#00FF00', 0, 0,'#0000FF',0.3);
					map.addOverlay(line);



					line=new GPolygon(poly2,'#00FF00', 0, 0,'#00F',0.3);
					map.addOverlay(line);

					line=new GPolygon(poly3,'#00FF00', 0, 0,'#00F',0.3);
					map.addOverlay(line);
					line=new GPolygon(poly4,'#00FF00', 0, 0,'#00F',0.3);
					map.addOverlay(line);
					line=new GPolygon(poly5,'#00FF00', 0, 0,'#00F',0.3);
					map.addOverlay(line);

					var line=new GPolygon(poly6,'#00ff00', 0, 0,'#00F',0.3);
					map.addOverlay(line);
				
					
}

function CreateMap() {
	
	
    map = new GMap2(document.getElementById("map"));

	 map.setCenter(new GLatLng(42.94033923363181, 5.8447265625), 4); 

    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
	sombreado();

}

document.unload(
  function() {
    GUnload();
  }
);

var IMAGES = { "hint":  {img: "icons/cross", width: 25, height: 25, 
               shadow_width: 0, shadow_height: 0,
               anchor_width: 12, anchor_height: 12 }
              };
var ICONS = [];

function getIcon(i){
  if (!ICONS[i]) {
    var icon = new GIcon();
    icon.image = "/images/" + IMAGES[i]['img'] + ".png";
    icon.iconAnchor = new GPoint(IMAGES[i]['anchor_width'], IMAGES[i]['anchor_height']);
    icon.infoWindowAnchor = new GPoint(16, 0);
    icon.iconSize = new GSize(IMAGES[i]['width'], IMAGES[i]['height']);
    if (IMAGES[i]['shadow_height']>0){
      icon.shadow = "/images/" + IMAGES[i]['img'] + "-shadow.png";
      icon.shadowSize = new GSize(IMAGES[i]['shadow_width'], IMAGES[i]['shadow_height']);
    }
    ICONS[i] = icon;
  }
  return ICONS[i];
}
function getHintIcon() {
  return getIcon('hint');
}

function ShowPosHint(id){
    if(map){
      map.addOverlay(locationsHintsCache[id]);
    }
    return false;
}

function HidePosHint(id){
    if(map){
      map.removeOverlay(locationsHintsCache[id]);
    }
    return false;
}

function createMarker(pointData) {
  var latlng = new GLatLng(pointData.latitude, pointData.longitude);
//  var marker = new GMarker(latlng, {"icon": 'http://maps.google.com/mapfiles/kml/pal3/icon46.png' });	
  var marker = new GMarker(latlng);	
  return marker;
}



