function StartUp(){
  OpenPng("LogoHome","images/logo-home.png");
  OpenPng("TreFoto","images/trefoto-home.png");
  OpenPng("ClaimHome","images/claim-home.png");
  OpenPng("MandarinesHome","images/mandarines-home.png");
  OpenPng("CaravanHome","images/caravan-home.png");  
}

function OpenPng(ObjId,ObjFile){
  ObjToMod = document.getElementById(ObjId);
  if(navigator.userAgent.indexOf("MSIE 6")>-1){
    ObjToMod.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ObjFile+"', sizingMethod='scale')";
  } else {
    ObjToMod.style.backgroundImage = "url("+ObjFile+")";
  }
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function OpenAjax(strType,strURL,strArguments,strTarg,strExecAfter) {
    var Response = "";
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); }
    else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); }
    
    if (!self.xmlHttpReq) { alert("ERRORE: AJAX non supportato da questo browser!"); return false; }

    self.xmlHttpReq.open(strType, strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1;');
    self.xmlHttpReq.onreadystatechange = function() {
      if (self.xmlHttpReq.readyState == 4) { 
        if (self.xmlHttpReq.status == 200) {
          Response = self.xmlHttpReq.responseText;
          if(strTarg=="alert"){
            if(Response!=""){ alert(Response); }
          } else if(strTarg!="null" && document.getElementById(strTarg)) {
            document.getElementById(strTarg).innerHTML = Response;
          }
        }
        if(strExecAfter!="" && strExecAfter!=null){ eval(strExecAfter); }
      }
    }
    self.xmlHttpReq.send(strArguments);
    if(document.all){ document.body.focus(); } else { window.focus(); }
}

function ChangeMonth(dt,lang){
  document.getElementById("CalendarioTable").style.display = "none";
  document.getElementById("CalendarioWaiter").style.display = "block";
  var dtr = dt.replace("/","-");
  setTimeout("OpenAjax(\"POST\",\"inc_calendario_ajax.asp\",\"Date="+dt+"&Lang="+lang+"\",\"Calendario\",\"\")",1000);
}

function ShowHide(objClicked,objNum){
  if(document.getElementById("Incontro"+objNum)){
    var obj = document.getElementById("Incontro"+objNum);
    if(obj.style.display=="block"){
      obj.style.display = "none";
	 objClicked.className = "NotSelected";
    } else {
      obj.style.display = "block";
	 objClicked.className = "Selected";
    }
    objClicked.blur();
  }
}
