<!--
/* o: campo obbligatorio
   n: campo numerico
   d: campo data
   m: numero minimo di caratteri

uso: controlla('nome1','o','msg errore','nome2','n','msg errore 2','nome2','m','msg errore 2')
*/
// ritorna un messaggio vuoto se tutto Ok
var nForm=0;
function imposta_form(x)
{	nForm=x;
}

function controlla()
{
msg="";
lista=arguments;
nl=lista.length/3;
ne=document.forms[nForm].elements.length;
for(i=0;i<ne;i++)
	for(j=0;j<nl;j++)
		if(document.forms[nForm].elements[i].name==lista[j*3])
			switch(lista[j*3+1].substring(0,1))
			{	case 'o':
					// campo obbligatorio
					if(document.forms[nForm].elements[i].value=="")
						msg+=lista[j*3+2]+"\n";
					break;
				case 'n':
					// campo di tipo numerico
					if(document.forms[nForm].elements[i].value!="")
						if(""+parseInt(document.forms[nForm].elements[i].value)!=document.forms[nForm].elements[i].value)
							msg+=lista[j*3+2]+"\n";
					break;
				case 'm':
					min=lista[j*3+1].substring(1,lista[j*3+1].length);
					if(document.forms[nForm].elements[i].value!="")
						if(document.forms[nForm].elements[i].value.length<min)
							msg+=lista[j*3+2]+"\n";
					// controllo che ci sia un minimo di caratteri
					break;				
				case 'd':
					if(document.forms[nForm].elements[i].value!="")
						if(!verData(document.forms[nForm].elements[i]))
							msg+=lista[j*3+2]+"\n";
					break;				
				case 'e':
					if(document.forms[nForm].elements[i].value!="")
					{
						val=document.forms[nForm].elements[i].value;
						p=val.indexOf('@');
						if (p<1 || p==(val.length-1))
							msg+=lista[j*3+2]+"\n";
					}
					break;				

			}
return msg;
}

function conta()
{
with(document.forms[nForm])
{
	n=0;
	ne=length;
	for(i=0;i<ne;i++)
		if(elements[i].checked) n++;
}
return n;
}

function conferma_cancella(messaggio1,messaggio2)
{
	num_elem=conta();
	if(num_elem==0)
		{
			alert(messaggio1);
			return false;
		}
	if(num_elem>0)
		return confirm(messaggio2);
}

// si utilizza con onKeydown="verifica(this,len)" onBlur="verifica(this,len)" 
// dove len=N max. di caratteri
function verifica(txt,len)
{
	if (txt.value.length +1 >len)
		txt.value = txt.value.substring(0,len-1);
	return true;
}

function y2k(number) { 
return (number < 1000) ? number + 1900 : number; 
}

function verData (data) {
if(data.value!="")
{
datast=data.value.split('/');
if (datast.length!=3)
	return false;
else
 {
	gg=datast[0];
	mm=datast[1];
	yyyy=datast[2];
	if(gg=="")
		return false;
   else if(mm=="")
   	return false;
 	 else  if(yyyy=="")
		return false;
    var today = new Date();
    yyyy = ((!yyyy) ? y2k(today.getYear()):y2k(yyyy));
    mm = ((!mm) ? today.getMonth():mm-1);
    if (!gg) return false
    var test = new Date(yyyy,mm,gg);
    if ( (y2k(test.getYear()) == yyyy) && (mm == test.getMonth()) && (gg == test.getDate()) )
        return true; 
    else
	return false;
 	}
}
}
function go_to(nuova)
{
	window.location.replace(nuova);
}

function wo(url,nome,w,h,s){
	var ww;
	s = typeof(s)=="undefined"?"0":"1";
	ww = window.open(url,nome,
					"top=" + (screen.height - h)/2 + 
					",left=" + (screen.width - w)/2 + 
					"fullscreen=1," +
					",height=" + h + 
					",width=" + w + 
					", status=0, " +
					"toolbar=no," +
					"menubar=no," +
					"location=0," +
					"statusbar=0," +
					"scrollbars=" + s);
					
	
	ww.resizeTo(w,h);
	ww.moveTo((screen.width - w)/2,(screen.height - h)/2);
	ww.focus();
	return ww;
}

function strReverse(st){
	var i,s="";
	for(i=st.length-1;i>=0;i--)
	s += st.charAt(i);
		
	return s;
}
	
	
function strLeftTrim(t){
	var i,st=t;
	while(st.length>0 && st.charAt(0)==" ")
	st = st.substring(1,255)
		
	return(st);
}
	
function strTrim(st){
	var t = strReverse(st), i;
	t =strLeftTrim(t);
		
	t = strReverse(t);
		
	return(strLeftTrim(t));
}


function strRightDif(st,n){
	// Funzione che restituisce la stringa st diminuita a destra di n caratteri
	// ex: strRigthDif("pippo",2) restituisce "pip"
	
	var t = strReverse(st);
	t = t.substring(n,255);
	return(strReverse(t));
}

function strLeftDif(st,n){
	// Funzione che restituisce la stringa st diminuita a sinistra di n caratteri
	// ex: strLeftDif("pippo",2) restituisce "ppo"
	return(st.substring(n,255));
}


function hasValue(objType, obj, objValue)
{
    if (objType == "TEXT" || objType == "PASSWORD")
	{
    	if (obj.value.length == 0) 
      		return false;
    	else 
      		return true;
    }
    else if (objType == "SELECT")
	{
        for (i=0; i < obj.length; i++)			
	    	{
		if (obj.options[i].selected)
			return true;
	}
       	return false;	
	}
    else if (objType == "SINGLE_VALUE_RADIO" || objType == "SINGLE_VALUE_CHECKBOX")
	{
		if (obj.checked)
			return true;
		else
       		return false;	
	}
    else if (objType == "RADIO" || objType == "CHECKBOX")
	{
        for (i=0; i < obj.length; i++)
    	{
		   if (obj[i].checked)
			 return true;
		}
       	return false;	
	}
}

function checkInteger(objValue)
{
    //Returns true if value is a number or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is an integer defined as
    //   having an optional leading + or -.
    //   otherwise containing only the characters 0-9.
	var decimal_format = ".";
	var check_char;

    //The first character can be + -  blank or a digit.
	check_char = objValue.indexOf(decimal_format)
    //Was it a decimal?
    if (check_char < 1)
	   return checkNumber(objValue);
    else
	   return false;
}

function checkRange(objValue, minValue, maxValue)
{
    // check minimum
    if (minValue != null)
	{
        if (objValue < minValue)
		  return false;
	}

    // check maximum
    if (maxValue != null)
	{
	    if (objValue > maxValue)
		  return false;
	}
	
    //All tests passed, so...
    return true;
}

function checkNumber(objValue)
{
    //Returns true if value is a number defined as
    //   having an optional leading + or -.
    //   having at most 1 decimal point.
    //   otherwise containing only the characters 0-9.
	var start_format = " .+-0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;

    //The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(objValue.charAt(0))
    //Was it a decimal?
	if (check_char == 1)
	    decimal = true;
	else if (check_char < 1)
		return false;
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < objValue.length; i++)
	{
		check_char = number_format.indexOf(objValue.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1)
		{
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}
		else if (check_char == 0)
		{
			if (decimal || digits)	
				trailing_blank = true;
        // ignore leading blanks
		}
	    else if (trailing_blank)
		     return false;
		else
			digits = true;
	}	

    //All tests passed, so...
    return true
}



function checkDate(objValue)
{
    //Returns true if value is a eurodate format or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is a date in the dd/mm/yyyy format
	isplit = objValue.indexOf('/');

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.');
	}

	if (isplit == -1 || isplit == objValue.length)
		return false;

    sDay = objValue.substring(0, isplit);

	monthSplit = isplit + 1;

	isplit = objValue.indexOf('/', monthSplit);

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.', monthSplit);
	}

	if (isplit == -1 ||  (isplit + 1 )  == objValue.length)
		return false;

    sMonth = objValue.substring((sDay.length + 1), isplit);

	sYear = objValue.substring(isplit + 1);

	if (!checkInteger(sMonth)) //check month
		return false;
	else
	if (!checkRange(sMonth, 1, 12)) // check month
		return false;
	else
	if (!checkInteger(sYear)) //check year
		return false;
	else
	if (!checkRange(sYear, 1970, 2020)) //check year
		return false;
	else
	if (!checkInteger(sDay)) //check day
		return false;
	else
	if (!checkDay(sYear, sMonth, sDay)) //check day
		return false;
	else
		return true;
}

function checkDay(checkYear, checkMonth, checkDay)
{

	maxDay = 31;

	if (checkMonth == 4 || checkMonth == 6 ||
			checkMonth == 9 || checkMonth == 11)
		maxDay = 30;
	else
	if (checkMonth == 2)
	{
		if (checkYear % 4 > 0)
			maxDay =28;
		else
		if (checkYear % 100 == 0 && checkYear % 400 > 0)
			maxDay = 28;
		else
			maxDay = 29;
	}

	return checkRange(checkDay, 1, maxDay); //check day
}


//----- CONTROLLO: MAIL -------- 
function checkEMail(objValue)
{
	apos=objValue.indexOf("@");
	dotpos=objValue.lastIndexOf(".");
	lastpos=objValue.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
	{return false;}
	else {return true;}
}

function check(objForm, objType, objValidate, objRequired, objName, obj, objValue, minValue, maxValue)
// objForm: oggetto form
// objType: tipo dell'oggetto ( TEXT )
// objValidate: controllo di sintassi per STRING, INTEGER, FLOAT, DATE, EMAIL
// objRequired: oggetto richiesto
// objName: nome dell'oggetto da visualizzare in caso di errore
// obj: oggetto
// objValue: valore dell'oggetto
// minValue: valore minimo consentito, se impostato a null non viene considerato
// maxValue: valore massimo consentito, se impostato a null non viene considerato
{
  var err = 0;
  var strErr = "";
  var decimal_format = ".";
  var check_char;

  // Controllo se obj ha un valore
  if (objRequired)
  {
     if (!hasValue(objType, obj, objValue))
	 {
        strErr = objName + " è obbligatorio/a" + "\n";
		return strErr;
	 }
  }
	
  // Controllo il tipo di dato inserito in obj
  switch (objValidate)
  {
  case "INTEGER":
     if (!checkInteger(objValue))
	 {
	    strErr = objName + " non valido" + "\n";
	    return strErr;
	 }
	 break;
  case "FLOAT":
	 if (!checkNumber(objValue))
	 {
	   if (objValue != '') 
	   {
	   strErr = objName + " non valido" + "\n";
	   return strErr;
	   }
	 }
	 break;
  case "DATE":
	 if (!checkDate(objValue))
	 {
	   strErr = objName + " non valido" + "\n";
	   return strErr;
	 }
	 break;
  case "EMAIL":
	 if (!checkEMail(objValue))
	 //if (!emailvalidation(objValue))
	 {
	   strErr = objName + " non valido" + "\n";
	   return strErr;
	 }
	 break;
  }

  // Controllo il range del objValue
  if ((minValue != null) || (maxValue != null))
  {
	 if (!checkRange(objValue, minValue, maxValue))
	 {
	   if ((minValue == null) && (maxValue != null))
	   {
	      strErr = objName + " deve essere <= " + maxValue + "\n"      
	   }	
	   else if ((minValue != null) && (maxValue == null))
	   {
	      strErr = objName + " deve essere >= " + minValue + "\n"
	   }	 
	   else //((minValue != null) && (maxValue != null))
	   {
	      strErr = objName + " non compreso nell'intervallo da " + minValue + " a " + maxValue + "\n";
	   }	  
	   return strErr;
	 }
  }
  
  return strErr;
}


// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function hasValue(objType, obj, objValue)
{
    if (objType == "TEXT" || objType == "PASSWORD")
	{
    	if (obj.value.length == 0) 
      		return false;
    	else 
      		return true;
    }
    else if (objType == "SELECT")
	{
        for (i=0; i < obj.length; i++)			
	    	{
		if (obj.options[i].selected)
			return true;
	}
       	return false;	
	}
    else if (objType == "SINGLE_VALUE_RADIO" || objType == "SINGLE_VALUE_CHECKBOX")
	{
		if (obj.checked)
			return true;
		else
       		return false;	
	}
    else if (objType == "RADIO" || objType == "CHECKBOX")
	{
        for (i=0; i < obj.length; i++)
    	{
		   if (obj[i].checked)
			 return true;
		}
       	return false;	
	}
}

function checkInteger(objValue)
{
    //Returns true if value is a number or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is an integer defined as
    //   having an optional leading + or -.
    //   otherwise containing only the characters 0-9.
	var decimal_format = ".";
	var check_char;

    //The first character can be + -  blank or a digit.
	check_char = objValue.indexOf(decimal_format)
    //Was it a decimal?
    if (check_char < 1)
	   return checkNumber(objValue);
    else
	   return false;
}

function checkRange(objValue, minValue, maxValue)
{
    // check minimum
    if (minValue != null)
	{
        if (objValue < minValue)
		  return false;
	}

    // check maximum
    if (maxValue != null)
	{
	    if (objValue > maxValue)
		  return false;
	}
	
    //All tests passed, so...
    return true;
}

function checkNumber(objValue)
{
    //Returns true if value is a number defined as
    //   having an optional leading + or -.
    //   having at most 1 decimal point.
    //   otherwise containing only the characters 0-9.
	var start_format = " .+-0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;

    //The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(objValue.charAt(0))
    //Was it a decimal?
	if (check_char == 1)
	    decimal = true;
	else if (check_char < 1)
		return false;
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < objValue.length; i++)
	{
		check_char = number_format.indexOf(objValue.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1)
		{
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}
		else if (check_char == 0)
		{
			if (decimal || digits)	
				trailing_blank = true;
        // ignore leading blanks
		}
	    else if (trailing_blank)
		     return false;
		else
			digits = true;
	}	

    //All tests passed, so...
    return true
}

function checkDate(objValue)
{
    //Returns true if value is a eurodate format or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is a date in the dd/mm/yyyy format
	isplit = objValue.indexOf('/');

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.');
	}

	if (isplit == -1 || isplit == objValue.length)
		return false;

    sDay = objValue.substring(0, isplit);

	monthSplit = isplit + 1;

	isplit = objValue.indexOf('/', monthSplit);

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.', monthSplit);
	}

	if (isplit == -1 ||  (isplit + 1 )  == objValue.length)
		return false;

    sMonth = objValue.substring((sDay.length + 1), isplit);

	sYear = objValue.substring(isplit + 1);

	if (!checkInteger(sMonth)) //check month
		return false;
	else
	if (!checkRange(sMonth, 1, 12)) // check month
		return false;
	else
	if (!checkInteger(sYear)) //check year
		return false;
	else
	if (!checkRange(sYear, 0, null)) //check year
		return false;
	else
	if (!checkInteger(sDay)) //check day
		return false;
	else
	if (!checkDay(sYear, sMonth, sDay)) //check day
		return false;
	else
		return true;
}

function checkDay(checkYear, checkMonth, checkDay)
{

	maxDay = 31;

	if (checkMonth == 4 || checkMonth == 6 ||
			checkMonth == 9 || checkMonth == 11)
		maxDay = 30;
	else
	if (checkMonth == 2)
	{
		if (checkYear % 4 > 0)
			maxDay =28;
		else
		if (checkYear % 100 == 0 && checkYear % 400 > 0)
			maxDay = 28;
		else
			maxDay = 29;
	}

	return checkRange(checkDay, 1, maxDay); //check day
}

/*
function checkEMail(objValue)
{
	  ------ CONTROLLO: MAIL -------- 
	// Verifica la presenza dei caratteri '@' e '.' 
	// e che il '@' venga prima del '.'
	   var offsetAt, offsetDot;
	
	if ((offsetAt = objValue.indexOf('@')) == -1)
	     return false;
		
	subEMail = objValue.substr(offsetAt)
	
	if ((offsetDot = subEMail.indexOf('.')) == -1)
	  return false;

    return true;
}
*/

//----- CONTROLLO: MAIL -------- 
function checkEMail(objValue)
{
	apos=objValue.indexOf("@");
	dotpos=objValue.lastIndexOf(".");
	lastpos=objValue.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
	{return false;}
	else {return true;}
}

function check(objForm, objType, objValidate, objRequired, objName, obj, objValue, minValue, maxValue)
// objForm: oggetto form
// objType: tipo dell'oggetto ( TEXT )
// objValidate: controllo di sintassi per STRING, INTEGER, FLOAT, DATE, EMAIL
// objRequired: oggetto richiesto
// objName: nome dell'oggetto da visualizzare in caso di errore
// obj: oggetto
// objValue: valore dell'oggetto
// minValue: valore minimo consentito, se impostato a null non viene considerato
// maxValue: valore massimo consentito, se impostato a null non viene considerato
{
  var err = 0;
  var strErr = "";
  var decimal_format = ".";
  var check_char;

  // Controllo se obj ha un valore
  if (objRequired)
  {
     if (!hasValue(objType, obj, objValue))
	 {
        strErr = objName + " e' obbligatorio/a\n";
		return strErr;
	 }
  }
	
  // Controllo il tipo di dato inserito in obj
  switch (objValidate)
  {
  case "INTEGER":
     if (!checkInteger(objValue))
	 {
	    strErr = objName + " non valido\n";
	    return strErr;
	 }
	 break;
  case "FLOAT":
	 if (!checkNumber(objValue))
	 {
	   if (objValue != '') 
	   {
	   strErr = objName + " non valido\n";
	   return strErr;
	   }
	 }
	 break;
  case "DATE":
	 if (!checkDate(objValue))
	 {
	   strErr = objName + " non valido\n";
	   return strErr;
	 }
	 break;
  case "EMAIL":
	 if (!checkEMail(objValue))
	 //if (!emailvalidation(objValue))
	 {
	   strErr = objName + " non valido\n";
	   return strErr;
	 }
	 break;
  }

  // Controllo il range del objValue
  if ((minValue != null) || (maxValue != null))
  {
	 if (!checkRange(objValue, minValue, maxValue))
	 {
	   if ((minValue == null) && (maxValue != null))
	   {
	      strErr = objName + " deve essere <= " + maxValue + "\n"      
	   }	
	   else if ((minValue != null) && (maxValue == null))
	   {
	      strErr = objName + " deve essere >= " + minValue + "\n"
	   }	 
	   else //((minValue != null) && (maxValue != null))
	   {
	      strErr = objName + " non compreso nell'intervallo da " + minValue + " a " + maxValue + "\n";
	   }	  
	   return strErr;
	 }
  }
  
  return strErr;
}

function checkMyDate1(objValue)
{
    //Returns the right date if value is a eurodate format or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is a date in the dd/mm/yyyy format
	isplit = objValue.indexOf('/');

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.');
	}

	if (isplit == -1 || isplit == objValue.length)
		return false;

    sDay = objValue.substring(0, isplit);

	monthSplit = isplit + 1;

	isplit = objValue.indexOf('/', monthSplit);

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.', monthSplit);
	}

	if (isplit == -1 ||  (isplit + 1 )  == objValue.length)
		return false;

    sMonth = objValue.substring((sDay.length + 1), isplit);

	sYear = objValue.substring(isplit + 1);

	if (!checkInteger(sMonth)) //check month
		return false;
	else
	if (!checkRange(sMonth, 1, 12)) // check month
		return false;
	else
	if (!checkInteger(sYear)) //check year
		return false;
	else
	if (!checkRange(sYear, 1970, 2020)) //check year
		return false;
	else
	if (!checkInteger(sDay)) //check day
		return false;
	else
	if (!checkDay(sYear, sMonth, sDay)) //check day
		return false;
	else
		return true;
}

function checkMyDate(objValue)
{
    //Returns true if value is a eurodate format or is NULL
    //otherwise returns false	

    if (objValue.length == 0)
        return true;

    //Returns true if value is a date in the dd/mm/yyyy format
	isplit = objValue.indexOf('/');

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.');
	}

	if (isplit == -1 || isplit == objValue.length)
		return false;

    sDay = objValue.substring(0, isplit);

	monthSplit = isplit + 1;

	isplit = objValue.indexOf('/', monthSplit);

	if (isplit == -1)
	{
		isplit = objValue.indexOf('.', monthSplit);
	}

	if (isplit == -1 ||  (isplit + 1 )  == objValue.length)
		return false;

    sMonth = objValue.substring((sDay.length + 1), isplit);

	sYear = objValue.substring(isplit + 1);

	if (!checkInteger(sMonth)) //check month
		return false;
	else
		if (!checkRange(sMonth, 1, 12)) // check month
			return false;
		else
			if (!checkInteger(sYear)) //check year
				return false;
			else
				if (!checkRange(sYear, 1970, 2020)) //check year
					return false;
				else	
					if (!checkInteger(sDay)) //check day
						return false;
					else
						if (!checkDay(sYear, sMonth, sDay)) //check day
							return false;
						else
							return new Date(sYear,sMonth-1,sDay);
}

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_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_findObj(n, d) { //v3.0
  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); 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];}
}


// -->
