var scrTooLowMsg="La risoluzione corrente dello schermo è troppo bassa e non consente un'ottimale visualizzazione del sito."+
	"\nSe possibile, selezionare una risoluzione di almeno 1024x768 punti."+
	"\n\nYour current screen resolution is too low and does not allow a good visualization of this site."+
	"\nTry to set a resolution of 1024x768 pixels at least.";

var MSIEname="Microsoft Internet Explorer";

var resLat=45.607940;
var resLng=9.230175;
var mapID="resMap";
var mapAddr="RESNATI MOBILI snc<br>via Mascagni, 6<br>Lissone (MI)";

var mapInitZoom=11;

function _chkScrRes() {
  // 0 for high resolution 1280x1024 or above
  // 1 for low resolution 1024x768
  // 2 for very low resolution
	if(screen.width >= 1280 && screen.height >= 1024)
		return 0;
	else if(screen.width < 1024 || screen.height < 768)
		return 2;
	else return 1;
}

function _langIt() {
	if(_chkScrRes() == 0)
		window.location = "v24/Hi/it/index.htm";
	else
		window.location = "v24/Lo/it/index.htm";
}

function _langEn() {
	if(_chkScrRes() == 0)
		window.location = "v24/Hi/en/index.htm";
	else
		window.location = "v24/Lo/en/index.htm";
}

function _scrResTooLowMsgBox() {
  if(_chkScrRes() == 2)
		alert(scrTooLowMsg);
}

function _getParVal() {
  var url, parVal;
  var pars, par=new Array();
  url=document.location.toString();
  pars=url.split("?");
  par=pars[1].split("=");
  parVal=par[1];
  return parVal;
}

function _preloadImgs() {
  // _createImgsArray() to be implemented in each page
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=_createImgsArray(); 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 _insPar() {
  var args=_insPar.arguments;
  var ret;
  
  ret=args[1]+"?"+args[0]+"="+_getParVal()+args[2];
  document.write(ret);
}

function GM_initialize() {
  if(GBrowserIsCompatible()) {
    var args=GM_initialize.arguments;
    var map = new GMap2(document.getElementById(mapID));
    map.addControl(new GSmallMapControl());
    if(args[0]==0) {
      map.addControl(new GOverviewMapControl());
      map.addControl(new GMapTypeControl());
    }
    map.setCenter(new GLatLng(resLat, resLng), mapInitZoom);
    map.openInfoWindowHtml(map.getCenter(), mapAddr);
    window.setTimeout(function() {
      map.zoomIn();
    }, 4000);
    window.setTimeout(function() {
      map.zoomIn();
    }, 7000);
    window.setTimeout(function() {
      map.zoomIn();
    }, 10000);
    window.setTimeout(function() {
      map.zoomIn();
    }, 13000);
  }
}

function _isGMapSupported() {
  // 0 true
  // 1 false
  if(navigator.appName==MSIEname)
    return 0;
  else
    return 1;
}

