function IsNull(n) {
    return (typeof(n) == 'undefined' || n == null);
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++)  
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function forwardPage(newLoc,type) {
  if ( type == "popup" ) {
    var w = 420 ; var h = 420 ;
    var winprops = "toolbar=no,width=" + w +",height=" + h +
    ",directories=no,status=no,scrollbars=yes,resize=yes,menubar=no";
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = winprops + ",top=" + wint + ",left= " + winl ;
    var newWin = window.open(newLoc,"myWin", winprops)
  } else if ( type == "new" ){
    //var newWin = window.open(newLoc,"myWin2")
    var newWin = window.open();
    newdocument=newWin.document;
    if (parseInt(navigator.appVersion) >= 3) {
      newWin.location.replace(newLoc);
    } else {
      newWin.location.href = newLoc;
    }
  } else {
   if (parseInt(navigator.appVersion) >= 3) {
    if (type == "parent") {
      parent.location.replace(newLoc);
    } else if (type == "opener") {
      opener.location.replace(newLoc);
    } else {
      location.href = newLoc;
      location.replace(newLoc);
    }
   } else {
    if (type == "parent") {
      parent.location.href = newLoc;
    } else if (type == "opener") {
      opener.location.href = newLoc;
    } else {
      location.href = newLoc;
    }
   }
  }
}

function preloadImages() {
  var d=document; if(d.images){ if(!d.imagepreload) d.imagepreload=new Array();
    var i,j=d.imagepreload.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.imagepreload[j]=new Image; d.imagepreload[j++].src=a[i];}}
}


function buildWebCrumb(siteRoot,homePage) {
var crumb = new Array();
pageHref = document.location.href;
//Strip off page name from this 
lastSlash = pageHref.lastIndexOf("/");
pageHref = pageHref.substr(0,lastSlash);
urlsofar = siteRoot;
homeStart = pageHref.indexOf(urlsofar);
pageHref = pageHref.substr(homeStart + urlsofar.length);
crumb[0] = "<a class='webcrumbLink' href='" +urlsofar+homePage+"'>Home</a>";

//Only process rest of Crumbs if we are not on home page
crumbNumber=1;
if (homePage.indexOf(pageHref) == -1) {
  processCrumbs = true;
} else {
  processCrumbs = false;
}

//build rest of crumbs - crumb is from '/' until next '/' or end
while (processCrumbs == true) {
  nextSlash = pageHref.indexOf('/',1);
  if (nextSlash == -1) { //last crumb found
    processCrumbs = false;
    nextSlash = pageHref.length+1;
  }

  nextCrumb = pageHref.substr(0,nextSlash);
  urlsofar = urlsofar + nextCrumb;
  pageName = nextCrumb.substr(1);
  // Remove Underscore and make capilatize words
  pageName = pageName.replace(/_/g,' ');
  pageName = pageName.replace(/\b\w+\b/g,function(word) {return word.substring(0,1).toUpperCase() + word.substring(1)});
  // following code is to make all of webcrumb clickable, to make all clickable apart from
  // final crumb, comment ot next line, and un-comment commentout if block below
  crumb[crumbNumber] = "<a class='webcrumbLink' href='" +urlsofar+nextCrumb+".html'>"+pageName+"</a>";
  //if (processCrumbs) { 
  // crumb[crumbNumber] = "<a class='webcrumbLink' href='" +urlsofar+nextCrumb+".html'>"+pageName+"</a>";
  //} else {
  // crumb[crumbNumber] = "<span class='webcrumbNoLink'>"+pageName+"</span>";
  //}
  pageHref= pageHref.substr(nextSlash);
  crumbNumber = crumbNumber +1;
}

var list="";
for (x=0;x<crumb.length;x++) {
  list = list + "&nbsp;>&nbsp;" + crumb[x];
}

document.write(list);

}

var now = getClientDate();

function getDate() {
document.write(now);
}

function getClientDate() {
    var dtClient = "";
    var dt = new Date();
    var yrYear = dt.getYear();
    var dName = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    var mName = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
    if( yrYear < 1900 ) {
      yrYear = yrYear + 1900;
    }
    dtClient = dName[dt.getDay()] + "&nbsp;" + mName[dt.getMonth()] + "&nbsp;" + dt.getDate() + "&nbsp;" + yrYear;
    return( dtClient );
}


//ShockWave recognition and display

var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
function showShockWave(shockwavefile, extraParm) {
//Size if hardcoded as we know that size will ALWAYS be the same!
if ( MM_FlashCanPlay ) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
	document.write(' ID="wcwdfy" WIDTH="169" HEIGHT="83" ALIGN="">');
	document.write(' <PARAM NAME=movie VALUE="'+shockwavefile+'.swf?extraParm='+extraParm+'"> <PARAM NAME=loop VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  '); 
	document.write(' <EMBED src="'+shockwavefile+'.swf?extraParm='+extraParm+'" loop=false quality=high bgcolor=#FFFFFF  ');
	document.write(' swLiveConnect=FALSE WIDTH="169" HEIGHT="83" NAME="'+shockwavefile+'" ALIGN=""');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </EMBED>');
	document.write(' </OBJECT>');
} else{
	document.write('<IMG SRC="'+shockwavefile+'.gif" WIDTH="169" HEIGHT="83" BORDER=0>');
}
}


function buildImage(alt, src, imageNumber) {
  imageName = src;
  if (stringToInteger(imageNumber) > 1) {
   // randomize Image Name
   dotPlace = src.lastIndexOf(".");
   uscorePlace = src.lastIndexOf("_");
   imageName = src.substring(0,uscorePlace+1) + imageNumber + src.substr(dotPlace,src.length - dotPlace);
  }
  document.write("<img border='0' alt='"+alt+"' src='"+imageName+ "' />");
}

function jump(what) 
{ 
	var loc = (what);
 	var newWin = window.open(loc,"myWin", "toolbar=no,width=800,height=600,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no, top=0")  	
} 

{
function checkDisclaimer() {
  		if(!window["disclaimer"]) {
  			if(getCookie("ITALIA_DISCLAIMER") != "yes") {
  				var newwin = window.open("/micro/collocatoriitalia/legal/legal_with_cookie.html", "disclaimer",'width=400,height=400,scrollbars=yes');
  				newwin.moveTo(50,50);
  			}
  		}
  	}
  					
  	function getCookie(name) {
  		var cookieName = name + "=";
  		var documentCookies = document.cookie;
  		if (documentCookies.length > 0) {
  			begin = documentCookies.indexOf(cookieName);
  			if (begin != -1) {
  				begin += cookieName.length;
  				end = documentCookies.indexOf(";", begin);
  				if (end == -1) end = documentCookies.length;
  				return unescape(documentCookies.substring(begin, end));
  			}
  		}
  		return "";
  	}
  
  	checkDisclaimer();
}