<!--
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   }
   return this
}

function convdate(vdata)
{
	var strdata=vdata
	var strgiorno="0"+strdata.substring(0,strdata.indexOf("/"))
	strgiorno=strgiorno.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	var strmese="0"+strdata.substring(0,strdata.indexOf("/"))
	strmese=strmese.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	if (strdata.length>1) {
		var stranno="20"+strdata
	} else {
		var stranno="200"+strdata
	}
	stranno=stranno.slice(-4)
	strdata=stranno+strmese+strgiorno
	strdata=parseInt(strdata)
	return strdata
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}

function checkMail(mail){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(mail)){
		return true;
	}else{
		return false;
	}
}

function controlla(obbligatorio,nome,campo_data,campo_numero,campo_user,campo_pwd,campo_mail,campoPrivacy,controlloDate){
	var sAgent = navigator.userAgent.toLowerCase() ;
	var elemento = document.getElementById(nome)
	len =elemento.elements.length;
	var i=0;
	var campo=' I seguenti campi obbligatori sono stati lasciati vuoti o il loro contenuto non e\' valido.:\n'
	var passa=true
	campo=campo+'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n\t\t '
	for( i=0 ; i<len ; i++) {
		if (controlloDate){
			if(elemento.elements[i].name.indexOf('Dal')>0){
				 dtDal+= elemento.elements[i].value;
				 if(elemento.elements[i].name.indexOf('yyyy')<0){
					 dtDal+= '/' ;
				 }
			}
			if(elemento.elements[i].name.indexOf('Al')>0){
				 dtAl+= elemento.elements[i].value;
				 if(elemento.elements[i].name.indexOf('yyyy')<0){
					 dtAl+= '/' ;
				 }
			}
		}

		if (elemento.elements[i].name.length > 0)
		{
			if (elemento.elements[i].name.indexOf(obbligatorio)>0 & elemento.elements[i].value.length<=0 ) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_user)>0 & elemento.elements[i].value.length<=5) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_pwd)>0 & elemento.elements[i].value.length<=5) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_mail)>0 & !checkMail(elemento.elements[i].value)) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campoPrivacy)>0 & !elemento.elements[i].checked) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else {
				if (elemento.elements[i].name.indexOf(campo_data) > 0 & !isDate(elemento.elements[i].value) &  elemento.elements[i].value.length > 0) {
						alert(elemento.elements[i].value + ' - ' + elemento.elements[i].name);
					campo=campo+' # '+elemento.elements[i].title+ ' - ' + elemento.elements[i].name+' # \n\n\t\t '
					passa=false
				}else if (elemento.elements[i].name.indexOf(campo_numero)>0 & isNaN(elemento.elements[i].value.replace(',','.')) & elemento.elements[i].value.length > 0) {
					campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
					passa=false
				}
			}
		}
	}
	if (controlloDate){
		if (isDate(dtDal) && isDate(dtAl)){
			//alert(convdate(dtDal) + '\n' + convdate(dtAl))
			if(convdate(dtDal)>convdate(dtAl)){
				campo=campo+' # La data di inizio deve essere minore di quella di fine # \n\n\t\t '
				passa=false
			}
		}else{
			if (!isDate(dtDal)){
				campo=campo+' # Devi inserire una data di inizio valida # \n\n\t\t '
				passa=false
			}
			if (!isDate(dtAl)){
				campo=campo+' # Devi inserire una data di fine valida # \n\n\t\t '
				passa=false
			}
		}
	}
	campo=campo+'\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
	if (passa){
		return true;
	}else{
		alert(campo)
		return false;
	}
}

function popup(scelta){
	finestra = window.open(scelta,'DireFare','scrollbars=yes,resizable=NO,width=500,height=300,status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}

function popupwh(scelta,w,h){
	finestra = window.open(scelta,'DireFare','scrollbars=no,resizable=NO,width='+w+',height='+h+',status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}

function popupwhScrool(scelta,w,h){
	finestra = window.open(scelta,'DireFare','scrollbars=yes,resizable=NO,width='+w+',height='+h+',status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}

function openImageWindow(imageSrc) {
	fileName = '/popupgall.htm?' + escape(imageSrc);
	myWindowHandle = window.open(fileName,'popup','directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}

function loadswf(swf,w,h){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
	document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"");
	document.write("width=\""+w+"\" height=\""+h+"\">");
	document.write("<param name='movie' value='"+swf+"' />\n");
	document.write("<param name='quality' value='high' /><param name='wmode' value='transparent' />\n");
	document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\"></embed>");
	document.write("</object>\n");
}

function confermaurl(Viewtesto,urltogo)
{
	if (confirm(Viewtesto))
	{
		document.location.href=urltogo
	}
}

function Logout() {
	document.location.href="/login.asp?tipo=logout"
}

function apri_chiudi(oggetto,oggetto2) {
	var ele = document.getElementById(oggetto);
	var ele2 = document.getElementById(oggetto2);
	if (ele!=undefined & ele2!=undefined ){
		if (ele.style.display=="none") {
			ele.style.display="";
			ele2.style.display="none";
		} else {
			ele.style.display="none";
			ele2.style.display="";
		}
	}
}

function chiamaMetodo(lev, mov) {
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	var filmato = IE ? window.mainMovie : window.document.mainMovie;
	filmato.LoadMovie(lev, mov);
}

var initI=0
function scrollMenu(divscroll,heightbox,divcheck) {
	var boxTop=document.getElementById(divscroll);
	var heightdiv=heightbox
	if (divcheck!=undefined) {
		var menuDeiTipimacchina=document.getElementById(divcheck);
	}
	if (boxTop!=undefined && boxTop!=null){
		if (document.body.scrollTop-heightdiv>0) {
			posizione=Math.floor((initI+((document.body.scrollTop-heightdiv)))/2);
			if (divcheck!=undefined) {
				var altezzaCheMiServe = (document.body.scrollTop-heightdiv)+boxTop.clientHeight;
				if (altezzaCheMiServe<menuDeiTipimacchina.clientHeight){
					boxTop.style.marginTop = posizione;
					initI=posizione;
				}
			} else {
				boxTop.style.marginTop = posizione
				initI=posizione
			}
		} else {
			boxTop.style.marginTop = 0;
			initI=0;
		}
	}
}

function vediSiNo(quale){
	var ele = $(quale);
	if(ele.style.display=='none'){
		ele.show();
	}else{
		ele.hide();
	}
}

function HrefPage(url){
	document.location.href=url;
}

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------


function Info(qualeDiv,ilForm,qualePagina){
	$("#"+qualeDiv).html('<div style="padding-top:6px;padding-bottom:3px;margin:auto;text-align:center;"><img src="/images/indicator.gif" alt="" width="16" height="16" border="0" align="absmiddle"></div>');
	$("#"+qualeDiv).show();
	$.ajax(
		{
			type: "POST",
			url: qualePagina,
			data: $("#"+ilForm).serialize(),
			success: function(risposta) {
				$("#"+qualeDiv).html(risposta);
			}
		}
	);
}

function viewForm(){
	var ele = $('#Infoprod');
	var ele2 = $('#Testoprod');
	if(ele.hide()){
		ele.show();
		ele2.hide();
	}else{
		ele.hide();
		ele2.show();
	}
}

function back(){
	var ele = $('#Infoprod');
	var ele2 = $('#Testoprod');
	ele.hide();
	ele2.show();
}




//-->

