// Libreria JS_FMLIB.TXT
// Location D:\INETPUB\WWROOT
// é referenziato da equestrian, fiseaa, fisevda, ipms(3) ecc
//
// includila nella
//
// ecc
//
// La libreria è organizzata in: A) Funzioni specifiche del sito es IPMS
// B) Funzioni generali
// Tutte le funzioni devono iniziare con L_ Tienile in ordine albabetico
//_____________________________________________________________
// FUNZIONI SPECIFICHE DI IPMS (ex IPMSLIB.JS)
function L_CLASSE(valu) {
var nc =' ';
if (valu > 0 && valu < 60) { nc='C'; }
if (valu > 59 && valu < 86) { nc='B'; }
if (valu > 85) { nc='A'; }
return nc;
}
//------------------------------------------------------
function L_FORNTIPO(tipo) {
if (tipo == '1') return 'Strategico';
if (tipo == '2') return 'Di Gruppo';
if (tipo == '3') return 'Normale';
return 'x ? X' ;
}
//------------------------------------------------------
function L_STATUS(stringa) {
if (parseFloat(stringa) ==6) return 'Attivo';
if (parseFloat(stringa) ==9) return 'Ultimato';
return 'x ? x';
}
//________________________________________________________
// FUNZIONI GENERALI
//________________________________________________________
function L_ADDBOOKM(uurrll,titolo) {
window.external.AddFavorite(uurrll,titolo);
// es: Javascript:L_ADDBOOKM('http://tosnw127/IPMS','I.P.M.S.');
}
//_______________________________________________________
function L_BARRA_STATO(testo)
{
window.status=testo;
}
//_______________________________________________________
function L_BISESTILE(anno) {
if (anno%4==0 && anno%400!=0) return -1
else return 0;
}
//----------------------------------------------------------------
function L_CLAS(CL) {
//_ copiato dalla libreria HJD
var xxx=' ';
if (parseInt(CL) < 9000) { return parseInt(CL);}
if (parseInt(CL) == 9998) {xxx='N.P.';}
if (parseInt(CL) == 9999) {xxx='Canc.';}
if (parseInt(CL) == 9896) {xxx='Elim.';}
if (parseInt(CL) == 9897) {xxx='Rit.';}
if (parseInt(CL) == 9898) {xxx='?';}
if (parseInt(CL) == 0) {xxx=' ';}
return xxx;
}
//---------------------------------------------------------------------------------
function L_fixedBackground(url)
{
var backgroundset=false; // do not change, for internal use only
if(!backgroundset)
{
document.body.style.overflow = 'hidden';
document.body.style.padding = '0px';
document.body.style.margin = '0px';
var overlay = document.createElement('DIV');
overlay.style.position = 'absolute';
overlay.style.top = '0px';
overlay.style.left = '0px';
overlay.style.height = '100%';
overlay.style.width = '100%';
overlay.style.overflow = 'auto';
overlay.innerHTML = document.body.innerHTML;
document.body.innerHTML = '
';
document.body.appendChild(overlay);
backgroundset=true;
}
else
background.src=url;
}
//---------------------------------------------------------------------------------
function L_GETCOOKIE(Name) {
// vedi legenda in L_SETCOOKIE
var search = Name + "="
if (document.cookie.length > 0) { // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
}
//_________________________________________________________
function L_GIORNO() {
var xxx= ' ';
var ggg = new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato");
var time = new Date();
xxx = ggg[time.getDay()] ;
return xxx ;
}
//_________________________________________________________
function L_GIOSET(nnn) {
var xxx= ' ';
var ggg = new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato");
xxx = ggg[nnn] ;
return xxx ;
}
//________________________________________________________
function L_HHMM() {
// restituisce hh:mm dove HH=Ore MM=Minuti
xxx=L_WriteTime(1,":")
return xxx ;
}
//__________________________________________________________
function L_IFPP(pagina) {
if (L_PP(pagina) == false) FL_WINKO();
}
//__________________________________________________________
function L_LCASE(stringa) {
stringa=stringa.toLowerCase();
return stringa;
}
//__________________________________________________________
function L_MANCANO_GIORNI(yr,m,d) {
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
return difference;
}
//_________________________________________________________
function L_MAKEARRAY() {
var lngth = L_MAKEARRAY.arguments.length;
var L_I = 0;
for ( L_I = 0 ; L_I 1)
{
alert("Troppi punti decimali nel campo "+campo);
return (false);
}
return (true);
}
//___________________________________________________________
function L_NUMGIORNIMESE(m,a) { // m da 1 a 12
if (m==2) {
if (L_BISESTILE(a)) return 28;
else return 29;
}
if (m==4 || m==6 || m==9 || m==11) return 30;
return 31;
}
//___________________________________________________________
function L_OGGI1() {
var time = new Date();
var rrcc=' ';
rrcc=time.getDate();
rrcc=rrcc + ' ' + L_MESE3(time.getMonth()+1) + ' ' + time.getYear() ;
return rrcc ;
}
//___________________________________________________________
function L_PICV(flus,fit,max) {
// es: onClick="L_PICV(this.src)" | onClick="L_PICV('nomeimg.jpg','YES',?YES')"
// La foto g
// questa chiamata usa i form PICV.asp e PICVE.asp
//alert(arguments.length) ; // num di argomenti
var wfit = "YES" ;
var wmax = "YES" ;
if (arguments.length == 3)
{
wfit = fit ;
wmax = max ;
}
if ((wfit != "YES") && (wfit !="NO"))
{ wfit = "YES"; }
if ((wmax != "YES") && (wmax !="NO"))
{ wmax = "YES"; }
var ppp="picv.asp?img="+flus +"&fit=" + wfit +"&max=" + wmax ;
var attributi = "";
if (wfit == "YES")
{
attributi = attributi +"resizable=no,scrollbars=no"
}
window.open(ppp,"",attributi);
}
//___________________________________________________________
function L_PP(stringa) {
// cerca la stringa se in document.referrer
var l_i = 0 ;
var xxx = false ;
var ppn= ' ' ;
ppn = document.referrer ;
ppn = ppn.toUpperCase() ;
stringa=stringa.toUpperCase();
for (var l_i=0; l_i= 12)
{
AMorPM = "PM";
whichHour = whichHour - 12;
}
else AMorPM = "AM";
if (whichHour < 1) {whichHour = 12;}
if (whichSecond < 10) {whichSecond = "" + "0" + whichSecond;}
if (whichMinute < 10) {whichMinute = "" + "0" + whichMinute;}
if (m==0) {xxx=whichHour + sep + whichMinute + sep + whichSecond + " " + AMorPM;}
if (m==1) {xxx=dateNow.getHours() + sep + whichMinute + sep + whichSecond;}
if (m==2) {xxx=milHour + whichMinute + " hours";}
return xxx ;
}
//___________________________________________________________
function L_WriteDate(m,sep)
{
// m=tipo formattazione sep=carattere separatore
// esempio L_WriteDate(4,"-") ottiene 18-2-2003
dateNow = new Date();
whichDay = L_GIOSET(dateNow.getDay());
whichMonth = L_MESE(dateNow.getMonth()+1);
whichDate = dateNow.getDate();
whichYear = dateNow.getYear();
if (whichYear < 2000) {whichYear = whichYear + 1900;}
whichYear = "" + whichYear;
if (m==0) {document.writeln(whichDay + ", " + whichMonth + " " + whichDate + ", " + whichYear);}
if (m==1) {document.writeln((dateNow.getMonth()+1) + sep + whichDate + sep + whichYear.substring(2,4));}
if (m==2) {document.writeln(whichDate + sep + (dateNow.getMonth()+1) + sep + whichYear.substring(2,4));}
if (m==3) {document.writeln((dateNow.getMonth()+1) + sep + whichDate + sep + whichYear);}
if (m==4) {document.writeln(whichDate + sep + (dateNow.getMonth()+1) + sep + whichYear);}
if (m==5) {document.writeln(whichDate + sep + whichMonth + sep + whichYear);}
if (m==6) {document.writeln(whichDay);}
if (m==7) {document.writeln(whichMonth);}
if (m==8) {document.writeln(dateNow.getMonth()+1);}
if (m==9) {document.writeln(whichDate);}
if (m==10) {document.writeln(whichYear);}
}
//__________________________________________________________
function L_ZOOM(flus,ww,hh) {
// esempio onClick="L_ZOOM(this.src,160,80)"
// flus=picture name ww=pic width hh= pic height
// Nota: Vuole la pagina __ZOOM.htm
var ppp=' ';
var sino="no";
var winh=0+hh;
var winw=0+ww;
if (hh > screen.height)
{
winh=(screen.height-90)
sino="yes";
}
if (ww > screen.width)
{
winw=(screen.width-45)
sino="yes";
}
if (sino=="yes")
{
winw=winw+18;
}
winh=winh+4;
ppp="__zoom.htm?p="+flus+"&w="+ww+"&h="+hh+"&x=none";
window.open(ppp,"","resizable="+sino+",scrollbars="+sino+
",width=" + winw +
",height=" + winh +
",top=" + parseInt((screen.height-(winh+40))/2) +
",left=" + parseInt((screen.width-winw)/2));
}
//_________________________________________________________________________
function L_ZOOMRID(flus,ww,hh) {
// SAREBBE DA BUTTARE ED USARE onclick L_PICV (che vuole pagine ASP)
// in GID,GiaccheRosse non più usata
// AITEC verif
// FISEVALLEDAOSTA verif
// esempio onClick="L_ZOOMRID(this.src,160,80)" RIDIMENSIONA l immagina a
// flus=picture_name ww=pic_width hh=pic_height
var ppp=' ';
var sino="no";
var winh=0+hh;
var winw=0+ww;
if (hh > screen.height)
{
winh=(screen.height-90)
sino="yes";
}
if (ww > screen.width)
{
winw=(screen.width-45)
sino="yes";
}
if (sino=="yes")
{
winw=winw+18;
}
winh = winh + 4 ;
ppp="__zoomrid.htm?p="+flus+"&w="+ww+"&h="+hh+"&x=none";
window.open(ppp,"","resizable=no,scrollbars=no"+
",width=" + winw +
",height=" + winh +
",top=" + parseInt((screen.height-(winh+40))/2) +
",left=" + parseInt((screen.width-winw)/2));
//________________________________________________________
// Fine JS_FMLIB.TXT
//________________________________________________________
}