function searchSales( cancella ) { nomecampoprov = "provincia"; nomecampocom = "comune"; if( ! cancella ) { nomecampoprov = "iprovincia"; nomecampocom = "icomune"; } var prov = document.getElementById( nomecampoprov ).value; if( prov != 0 ) { var url = '/sites/territorio/services/VariazioniColturali/funzioni/provcom.php?prov='+prov+'&catasto='+cancella; document.getElementById( nomecampocom ).setAttribute( "autocomplete", "Off" ); Http.get({url: url,callback: showResponse,cache: Http.Cache.GetCache},prov); } } function showResponse( result ) { comuni = eval(result.responseText); obj.actb_keywords = comuni; } // Funzioni per la gestione dell'help function addHelp(formid) { var strID, objHelp; if (document.getElementById && document.appendChild && document.removeChild) { var objHelpform = document.getElementById(formid); var objAnchors = objHelpform.getElementsByTagName('a'); for (var iCounter=0; iCounter // for highlightint the issue objHelpform = null; objHelp = null; objAnchors = null; } } function getIDFromHref(strHref) { var iOffset = strHref.indexOf('#') + 1; var iEnd = strHref.length; return strHref.substring(iOffset, iEnd); } function expandHelp(objAnchor, objEvent) { var iKeyCode; if (objEvent && objEvent.type == 'keypress') { if (objEvent.keyCode) iKeyCode = objEvent.keyCode; else if (objEvent.which) iKeyCode = objEvent.which; if (iKeyCode != 13 && iKeyCode != 32) return true; } strID = getIDFromHref(objAnchor.href); objHelp = document.getElementById(strID); if (objHelp.style.display == 'none') objHelp.style.display = 'block'; else objHelp.style.display = 'none'; return false; } // Fine funzioni gestione help /* Inizio gestione lunghezza textarea */ function textAreas_init() { /* I initialize all textareas and send them to the addMaxLength method @return null @see addMaxLength() */ if (!document.getElementsByTagName) return; objs = document.getElementsByTagName("textarea"); for (oi=0;oi0){ thisObj.onkeyup = forceMaxLength; thisObj.onmouseout = forceMaxLength; thisObj.onchange = forceMaxLength; insertSpanSibling(thisObj,"Caratteri digitati "+pk_fixnewlines_textarea(thisObj.value).length + ' su ' + maxlength,'counttextarea' ); } } function foundmax(thisObj){ nomeclasse=thisObj.className; classarray=nomeclasse.split(" "); var class_num=0; trovato=false; while (class_num < classarray.length && !trovato){ indice=classarray[class_num].indexOf('maxlength'); if(indice>=0){ maxlength=classarray[class_num].substring(indice+9); trovato=true; } class_num+=1; } return maxlength; } function forceMaxLength(){ /* I replace an event on a textarea forcing the length of the textareas content to be within the maxLength constraing @return null */ var maxLength = foundmax(this); var valore=pk_fixnewlines_textarea(this.value); if(valore.length > maxLength){ //this.value = this.value.substring(0,maxLength); this.nextSibling.style.color="red"; this.nextSibling.style.borderColor="red"; }else{ this.nextSibling.style.color="black"; this.nextSibling.style.borderColor="black"; } this.nextSibling.innerHTML = "Caratteri digitati "+valore.length + ' su ' + maxLength; } function insertSpanSibling(obj,msg,cssClass){ /* I add a span after the current object @param obj required the object that is getting the sibling inserted after it @param msg required the contents of the sibling @param cssClass not required a class name for the new sibling @return null */ var newSpan = document.createElement('span'); //newSpan.style.border="1px solid black"; newSpan.innerHTML = msg; obj = obj.nextSibling; //if(obj.readOnly) obj = obj.nextSibling; if(cssClass) newSpan.className = cssClass; obj.parentNode.insertBefore(newSpan,obj); } function pk_fixnewlines_textarea (val) { // Adjust newlines so can do correct character counting for MySQL. MySQL counts a newline as 2 characters. if (val.indexOf('\r\n')!=-1) ; // this is IE on windows. Puts both characters for a newline, just what MySQL does. No need to alter else if (val.indexOf('\r')!=-1) val = val.replace ( /\r/g, "\r\n" ); // this is IE on a Mac. Need to add the line feed else if (val.indexOf('\n')!=-1) val = val.replace ( /\n/g, "\r\n" ); // this is Firefox on any platform. Need to add carriage return else ; // no newlines in the textarea return val; } /* Fine gestione lunghezza textarea */ /* Funzione per disabiltare textarea*/ function abilita(valore,idtext){ if(valore==3) document.getElementById(idtext).disabled=false; else{ document.getElementById(idtext).disabled=true; document.getElementById(idtext).value=""; } return true; } function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } function setCheckedValue(radioObj, newValue) { if(!radioObj) return; var radioLength = radioObj.length; if(radioLength == undefined) { radioObj.checked = (radioObj.value == newValue.toString()); return; } for(var i = 0; i < radioLength; i++) { radioObj[i].checked = false; if(radioObj[i].value == newValue.toString()) { radioObj[i].checked = true; } } }