/*Popup bracking news*/ var window_WIDTH=300 var window_HEIGHT=340 var ARRIVE_Y_offset=screen.height-380 var speed=20 var Xoffset=screen.width/2-150; var autoclose = false var windowX = (screen.width/2)-(window_WIDTH/2); windowX=0+Xoffset; /*traiettoria*/ var windowY = (screen.availHeight); var windowYstop = windowY-window_HEIGHT-ARRIVE_Y_offset; var windowYnow = windowY; var windowStep = 50; var windowYnow = ((windowStep+1)*windowStep/2)+ windowYstop; d = "width="+window_WIDTH+",height="+window_HEIGHT; function popup_open_live(){ phpwbs_popup=window.open('breaking_news_popup_open.php',"phpwbs_open_popup","top=5000, left=5000,"+d) phpwbs_popup.blur() window.focus() phpwbs_popup.moveTo(windowX,windowY) phpwbs_popup.focus() if (autoclose){ window.onunload = function(){phpwbs_popup.close()} } move_popup(); } function move_popup(){ if (windowYnow!=windowYstop){ phpwbs_popup.moveTo(windowX,windowYnow); phpwbs_popup.focus(); windowYnow=windowYnow-windowStep; windowStep--; timer=setTimeout("move_popup()",speed); }else{ clearTimeout(timer); phpwbs_popup.moveTo(windowX,windowYstop); phpwbs_popup.focus(); } } /*End Popup bracking news*/ /*Jump to a link directly from form*/ function jump(form) { var myindex=form.menu.selectedIndex if(form.menu.options[myindex].value != "0") { window.open(form.menu.options[myindex].value, target="_self"); } } /*Jump to a link directly from form*/ function jumpMenu(targ,selObj,restore,urlA,urlB){ eval(targ+".location='"+urlA+selObj.options[selObj.selectedIndex].value+urlB+"'"); if (restore) selObj.selectedIndex=0; } // Tooltip-like help pop-ups used in forms function formtooltip(el,flag){ elem = document.getElementById(el); if (flag) { elem.parentNode.parentNode.style.zIndex=1000; elem.parentNode.parentNode.style.borderRight='0px solid #000'; // ugly , yes .. but neccesary to avoid a small but very annoying bug in IE6 elem.style.visibility='visible'; } else { elem.parentNode.parentNode.style.zIndex=1; elem.parentNode.parentNode.style.border='none'; elem.style.visibility='hidden' }; } //---Start menu var ultimo="" function VisualizzaMenu(cell,what){ var menu = document.getElementById(what); var parentela = ""; var coorY = 0; var coorX = 0; if(ultimo){ clearTimeout(timerMENU) document.getElementById(ultimo).style.visibility='hidden'; } while(eval("cell." + parentela + "tagName") != "BODY") { coorY = coorY + eval("cell." + parentela + "offsetTop"); coorX = coorX + eval("cell." + parentela + "offsetLeft"); parentela = parentela + "offsetParent." ; } if(navigator.product != 'Gecko') { menu.style.width = 1 + cell.offsetWidth + "px"; } else { menu.style.width = -2 + cell.offsetWidth + "px"; } menu.style.top=coorY + cell.offsetHeight; menu.style.left=coorX; menu.style.visibility='visible'; timerMENU=setTimeout("document.getElementById("+what+").style.visibility='hidden'",3500); ultimo=what; } //---End menu window.onresize=function(){if(ultimo) document.getElementById(ultimo).style.visibility='hidden'} //--> //Select checkbox function CheckAll(which,do_check) { for (var i=0;i < document.forms[which].elements.length;i++) { var e = document.forms[which].elements[i]; if (e.type == "checkbox" ) { //alert(e.name); //if(e.name.substr(0,22) != 'PHPWBS_WIZARD_NN_OBBLY') /*TODO accrocchio for wizard*/ if(e.name.substr(0,13) == 'selected_this' || e.name.substr(0,22) == 'PHPWBS_WIZARD_USEFIELD') e.checked = do_check; } } return true; } var thiswindows = ''; //Popup function open_window(url) { thiswindows=window.open(url, '','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=800,height=600'); return false; } //Write cookie function setCookie(name, value, days) { var expire = new Date(); expire.setTime(expire.parse() + (60*60*24*days*1000)); document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) } //Read cookie function getCookie(Name) { 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 redirect(url) { top.location.href =url; } /*login*/ var logged; logged = getCookie('LOGGED') var usern usern = getCookie('USERN') var users users = getCookie('USERS') if(usern == undefined || usern == '' || usern == 'undefined') usern= 'Utente'; if(users == undefined || users == '' || users == 'undefined') users= ''; function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function getSel() { var txt = ''; var foundIn = ''; if (window.getSelection) { txt = window.getSelection(); foundIn = 'window.getSelection()'; } else if (document.getSelection) { txt = document.getSelection(); foundIn = 'document.getSelection()'; } else if (document.selection) { txt = document.selection.createRange().text; foundIn = 'document.selection.createRange()'; } else return; return txt; } function replaceSubstring(inputString, fromString, toString) { // Goes through the inputString and replaces every occurrence of fromString with toString var temp = inputString; if (fromString == "") { return inputString; } if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation) while (temp.indexOf(fromString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(fromString)); var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length); temp = toTheLeft + toString + toTheRight; } } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop var midStrings = new Array("~", "`", "_", "^", "#"); var midStringLen = 1; var midString = ""; // Find a string that doesn't exist in the inputString to be used // as an "inbetween" string while (midString == "") { for (var i=0; i < midStrings.length; i++) { var tempMidString = ""; for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; } if (fromString.indexOf(tempMidString) == -1) { midString = tempMidString; i = midStrings.length + 1; } } } // Keep on going until we build an "inbetween" string that doesn't exist // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string while (temp.indexOf(fromString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(fromString)); var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length); temp = toTheLeft + midString + toTheRight; } // Next, replace the "inbetween" string with the "toString" while (temp.indexOf(midString) != -1) { var toTheLeft = temp.substring(0, temp.indexOf(midString)); var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length); temp = toTheLeft + toString + toTheRight; } } // Ends the check to see if the string being replaced is part of the replacement string or not return temp; // Send the updated string back to the user } // Ends the "replaceSubstring" function function setVisibility(id) { var divid = document.getElementById(id); if( divid.style.visibility == 'hidden' ) { divid.style.visibility = 'visible'; divid.style.position = 'relative'; } else { divid.style.visibility = 'hidden'; divid.style.position = 'absolute'; } }