function dateGreaterThan(strDate1, strDate2) {
  var dd, mm, yyyy;
  var date1, date2;
  dd = strDate1.substring(0, 2); mm = strDate1.substring(2, 4); yyyy = strDate1.substring(4);
  date1 = new Date(yyyy, mm-1, dd);
  dd = strDate2.substring(0, 2); mm = strDate2.substring(2, 4); yyyy = strDate2.substring(4);
  date2 = new Date(yyyy, mm-1, dd);
  if (date1 > date2)
    return true;
  return false;
}
function dateGreaterEqual(strDate1, strDate2) {
  var dd, mm, yyyy;
  var date1, date2;
  dd = strDate1.substring(0, 2); mm = strDate1.substring(2, 4); yyyy = strDate1.substring(4);
  date1 = new Date(yyyy, mm-1, dd);
  dd = strDate2.substring(0, 2); mm = strDate2.substring(2, 4); yyyy = strDate2.substring(4);
  date2 = new Date(yyyy, mm-1, dd);
  if (date1 >= date2)
    return true;
  return false;
}
function openpopupWindow(popupURL, width, height)
{
   popupWindow = window.open(popupURL,"popupWindowDoc","scrollbars=no,location=no,toolbar=no,directories=no,status=no,resizable=no,height=" + height + ",width=" + width);
}
function openWindow(popupURL, width, height)
{
   popupWindow = window.open(popupURL,"popupWindowDoc","scrollbars=yes,location=no,toolbar=no,directories=no,status=no,resizable=no,height=" + height + ",width=" + width);
}
function isEMailAddress(elem) {
  var str = elem.value;
  var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
  if (!str.match(re))
    return false;
  else
    return true;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function isValidText(elem) {
  var str = elem.value;
  var re = /^[a-zA-Z0-9\s.\-_;,']+$/;
  if (!str.match(re))
    return true;
  else
    return false;
}
function checkAgencyForm() {
       var myForm = document.forms["viaggiare"];
        if ((myForm.elements["nomeagenzia"].value == "") ||
            (myForm.elements["nome"].value == "") ||
            (myForm.elements["cognome"].value == "") ||
            (myForm.elements["citta"].value == "") ||
            (myForm.elements["telefono"].value == "") ||
            (myForm.elements["email"].value == "") ||
            (myForm.elements["ora"].value == "")) {
          alert('I campi del form sono obbligatori.');
          return false;
        }
        return true;
      }

function checkAffiliazioneForm() {
	
	var myForm = document.forms["viaggiare"];  
	              
        if ((myForm.elements["web_site"].value == "") ||
            (myForm.elements["nome"].value == "") ||
            (myForm.elements["cognome"].value == "") ||
            (myForm.elements["cellulare"].value == "") ||
            (myForm.elements["telefono_fisso"].value == "") ||
            (myForm.elements["email"].value == "") ||
            (myForm.elements["testo_messaggio"].value == "")) {
          alert('I campi del form sono obbligatori.');
          return false;
        }
        return true;
     }


      function CreateBookmarkLink()
      {
        title = document.title;
        url = location.href;
        if (window.sidebar)
        { // Mozilla Firefox Bookmark
          window.sidebar.addPanel(title, url,"");
        }
        else if( window.external )
        { // IE Favorite
          window.external.AddFavorite( url, title);
        }
        else if(window.opera && window.print)
        { // Opera Hotlist
          var mbm = document.createElement('a');
          mbm.setAttribute('rel','sidebar');
          mbm.setAttribute('href',url);
          mbm.setAttribute('title',title);
          mbm.click();
        }
      }
