/** * struts-layout core javascript * * All rights reserved. */ // type checking functions //! override to support onload function checkValue(field, required) { if (field==null) { return; } property = field.name; imageClear = new Image(); imageClear.src = "images/clearpixel.gif"; //alert("imageClear.src="+imageClear.src); imageAst = new Image(); imageAst.src = "images/ast.gif"; //alert("imageAst.src="+imageAst.src); currentImage = document.getElementById(property + "required"); //alert("currentImage="+currentImage); //alert("currentImage.src="+currentImage.src); if (field.value.replace(/[\s]/g,"") !="" && currentImage != null && currentImage.src!=imageClear.src) { //alert("hello11111"); currentImage.src = imageClear.src; } else if (field.value.replace(/[\s]/g,"") =="" && required && currentImage != null && currentImage.src!=imageAst.src) { //alert("hello222222"); currentImage.src = imageAst.src; } } // Return true if value is an e-mail address function isEmail(value) { invalidChars = " /:,;"; if (value=="") return false; for (i=0; i value.length) return false; return true; } // Return true if value is a number function isNumber(value) { if (value=="") return false; var d = parseInt(value); if (!isNaN(d)) return true; else return false; } // return true if value is a date // ie in the format XX/YY/ZZ where XX YY and ZZ are numbers function isDate(value) { if (value=="") return false; var pos = value.indexOf("/"); if (pos == -1) return false; var d = parseInt(value.substring(0,pos)); value = value.substring(pos+1, 999); pos = value.indexOf("/"); if (pos==-1) return false; var m = parseInt(value.substring(0,pos)); value = value.substring(pos+1, 999); var y = parseInt(value); if (isNaN(d)) return false; if (isNaN(m)) return false; if (isNaN(y)) return false; var type=navigator.appName; if (type=="Netscape") var lang = navigator.language; else var lang = navigator.userLanguage; lang = lang.substr(0,2); if (lang == "fr") var date = new Date(y, m-1, d); else var date = new Date(d, m-1, y); if (isNaN(date)) return false; return true; } // menu functions function initMenu(menu) { if (getMenuCookie(menu)=="hide") { document.getElementById(menu).style.display="none"; } else { document.getElementById(menu).style.display=""; } } function changeMenu(menu) { if (document.getElementById(menu).style.display=="none") { document.getElementById(menu).style.display=""; element = document.getElementById(menu+"b"); if (element != null) { document.getElementById(element).style.display="none"; } setMenuCookie(menu,"show"); } else { document.getElementById(menu).style.display="none"; element = document.getElementById(menu+"b"); if (element != null) { var width = document.getElementById(menu).offsetWidth; if (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko")) document.getElementById(menu+"b").style.width = width; else document.getElementById(menu+"b").width = width; document.getElementById(menu+"b").style.display=""; } setMenuCookie(menu,"hide"); } return false; } function setMenuCookie(name, state) { if (name.indexOf("treeView")!=-1) { if (state=="show") { var cookie = getMenuCookie("treeView", ""); if (cookie=="???") cookie = "_"; cookie = cookie + name + "_"; document.cookie = "treeView=" + escape(cookie); } else { var cookie = getMenuCookie("treeView", ""); var begin = cookie.indexOf("_" + name + "_"); if (cookie.length > begin + name.length + 2) { cookie = cookie.substring(0, begin+1) + cookie.substring(begin + 2 + name.length); } else { cookie = cookie.substring(0, begin+1); } document.cookie = "treeView=" + escape(cookie); } } else { var cookie = name + "STRUTSMENU=" + escape(state); document.cookie = cookie; } } function getMenuCookie(name, suffix) { if (suffix==null) { suffix = "STRUTSMENU"; } var prefix = name + suffix + "="; var cookieStartIndex = document.cookie.indexOf(prefix); if (cookieStartIndex == -1) return "???"; var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length; return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); } // sort functions function arrayCompare(e1,e2) { return e1[0] < e2[0] ? -1 : (e1[0] == e2[0] ? 0 : 1); } var tables = new Array(); function arraySort(tableName, column, lineNumber, columnNumber) { var aTable = tables[tableName]; var arrayToSort; var array; var reverse = 0; if (aTable) { array = aTable[0]; arrayToSort = new Array(lineNumber); for (i=0;i"); document.write(" a {text-decoration: none; color: #000000;}"); document.write(" TD.CALENDRIER {background-color: #C2C2C2; font-weight: bold; text-align: center; font-size: 10px; }"); document.write(""); document.write('
'); document.write(''); // document.write(''); document.write(''); document.write(''); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(''); document.write(''); document.write(''); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(' '); document.write(''); document.write(''); // document.write(''); document.write('
'); document.write(''); document.write('   
' + day1 + '' + day2 + '' + day3 + '' + day4 + '' + day5 + '' + day6 + '' + day7 + '
'); document.write('
'); document.write('
'); } /** * Show the calendar */ function showCalendar(year, month, day, formName, formProperty, event) { if(document.all) { // IE. var ofy=document.body.scrollTop; var ofx=document.body.scrollLeft; document.all.slcalcod.style.left = event.clientX+ofx+10; document.all.slcalcod.style.top = event.clientY+ofy+10; document.all.slcalcod.style.visibility="visible"; document.all.calmois.selectedIndex= month; } else if(document.layers) { // Netspace 4 document.slcalcod.left = e.pageX+10; document.slcalcod.top = e.pageY+10; document.slcalcod.visibility="visible"; document.slcalcod.document.caltitre.document.forms[0].calmois.selectedIndex=month; } else { // Mozilla var calendrier = document.getElementById("slcalcod"); var ofy=document.body.scrollTop; var ofx=document.body.scrollLeft; calendrier.style.left = event.clientX+ofx+10; calendrier.style.top = event.clientY+ofy+10; calendrier.style.visibility="visible"; document.getElementById("calmois").selectedIndex=month; } if (document.forms[formName].elements[formProperty].stlayout) { var lc_day = document.forms[formName].elements[formProperty].stlayout.day; var lc_month = document.forms[formName].elements[formProperty].stlayout.month; var lc_year = parseInt(document.forms[formName].elements[formProperty].stlayout.year); cal_chg(lc_day, lc_month, lc_year, lc_month); } else { cal_chg(day, month, year, month); } calformname = formName; calformelement = formProperty; } /** * Redraw the calendar for the current date and a selected month */ function cal_chg(day, month, year, newMonth){ var str='',j; var lc_annee = year; lc_annee = year + Math.floor((newMonth-1)/12); if (newMonth>12) newMonth = newMonth - 12; if (newMonth>12) newMonth = newMonth - 12; if(newMonth>0) { j=1; str+='\n'; for(u=0;u<6;u++){ str+=' \n'; for(i=0;i<7;i++){ ldt=new Date(lc_annee,newMonth-1,j); str+=' \n'; str+=' \n'; } str+=' \n'; str+=' \n'; str+=' \n'; } str+='
'; if (ldt.getDay()==i && ldt.getDate()==j) {str+=''+j+''; j++;} else str+=' '; str+='
\n'; } if(document.all) document.all.caljour.innerHTML=str; if(document.layers) {obj=document.calendrier.document.caljour; obj.top=48; obj.document.write(str); obj.document.close();} if (!document.all && document.getElementById) document.getElementById("caljour").innerHTML = str; } /** * Display the previous month */ function cal_before(day, month, year) { var champ; if (document.all) champ = document.all.calmois;//document.all.calendrier.document.caltitre.form.calmois; if (document.layers) champ = document.calendrier.document.caltitre.document.form.calmois; if (!document.all && document.getElementById) champ = document.getElementById("calmois"); if (champ.selectedIndex>1) champ.selectedIndex--; cal_chg(day, month, year, champ.options[champ.selectedIndex].value); } /** * Display the next month */ function cal_after(day, month, year) { // récupération de l'objet var champ; if (document.all) champ = document.all.calmois;//document.all.calendrier.form.calmois; if (document.layers) champ = document.calendrier.document.form.calmois; if (!document.all && document.getElementById) champ = document.getElementById("calmois"); if (champ.selectedIndex