function setupRollovers() { if (!document.getElementsByTagName || !document.getElementById) return; var all_links = document.getElementsByTagName('a'); for (var i = 0; i < all_links.length; i++) { var link = all_links[i]; if (link.className && (' ' + link.className + ' ').indexOf(' rollover ') != -1) { if (link.childNodes && link.childNodes.length == 1 && link.childNodes[0].nodeName.toLowerCase() == 'img') { link.onmouseover = mouseover; link.onmouseout = mouseout; } } //Controlla se "contact requests" per attivare popup contact (browse, search, etc..) else if (link.className && (' ' + link.className + ' ').indexOf(' contactrequest ') != -1) { link.onclick = sendrequestpop; } //Controlla se "spam report forums" per attivare popup report... else if (link.className && (' ' + link.className).indexOf(' reportspamforums') != -1) { link.onclick = reportspamforums; } else if (link.className && (' ' + link.className).indexOf(' reportspamcomments') != -1) { link.onclick = reportspamcomments; } else if (link.className && (' ' + link.className).indexOf(' reportspamuser') != -1) { link.onclick = reportspamuser; } else if (link.className && (' ' + link.className).indexOf(' reportspamemail') != -1) { link.onclick = reportspamemail; } else if (link.className && (' ' + link.className).indexOf(' reportspamjobs') != -1) { link.onclick = reportspamjobs; } else if (link.className && (' ' + link.className).indexOf(' reportspamextjobs') != -1) { link.onclick = reportspamextjobs; } else if (link.className && (' ' + link.className).indexOf(' reportspamvideo') != -1) { link.onclick = reportspamvideo; } else if (link.className && (' ' + link.className).indexOf(' reportspamaudio') != -1) { link.onclick = reportspamaudio; } else if (link.className && (' ' + link.className).indexOf(' reportspamsheetmusic') != -1) { link.onclick = reportspamsheetmusic; } //Controlla se e' un tell a friend... else if (link.className && (' ' + link.className).indexOf(' tellafriend') != -1) { link.onclick = tellafriend; } //Controlla se e' un visibility switch... else if (link.className && (' ' + link.className).indexOf(' visibilityswitchgo') != -1) { link.onclick = visibilityesegui; } else if (link.className && (' ' + link.className).indexOf(' viswitchON') != -1) { link.onclick = visibilityON; } else if (link.className && (' ' + link.className).indexOf(' viswitchOFF') != -1) { link.onclick = visibilityOFF; } else if (link.className && (' ' + link.className).indexOf(' logoutlinkgo') != -1) { link.onclick = logoutlinkgo; } else if (link.className && (' ' + link.className).indexOf(' audioeditj') != -1) { link.onmouseover = audioeditjIN; link.onmouseout = audioeditjOUT; } else if (link.className && (' ' + link.className).indexOf(' sheettxthk') != -1) { link.onmouseover = sheettxthkIN; link.onmouseout = sheettxthkOUT; } else if (link.className && (' ' + link.className).indexOf(' sheeticonhk') != -1) { link.onmouseover = sheeticonhkIN; link.onmouseout = sheeticonhkOUT; } else if (link.className && (' ' + link.className).indexOf(' jobseditlk') != -1) { link.onmouseover = jobseditlkIN; link.onmouseout = jobseditlkOUT; } else if (link.className && (' ' + link.className).indexOf(' jobawardON') != -1) { link.onclick = jobawardON; } else if (link.className && (' ' + link.className).indexOf(' jobawardOFF') != -1) { link.onclick = jobawardOFF; } } //Controlla focus class per elementi di input... (5-12-08)... var all_inputs = document.getElementsByTagName('input'); for (var i = 0; i < all_inputs.length; i++) { var link = all_inputs[i]; if (link.className && (' ' + link.className).indexOf(' focus') != -1) { link = link.focus(); } } // Contolla se ci sono elementi di forms da accendere con focus() var elementformfocus = document.getElementById('focus'); if (elementformfocus) { elementformfocus = elementformfocus.focus(); } } function logoutlinkgo(e) { //alert("allora"); //Controlla se l' utente e' offline... initXMLHRclean('logoutlinkgo'); return false; } function checkmail(e) { //Funzione checkmail (4-29-08) per controllo posta automatico... //alert("Check mail..."); initXMLHRclean('checkmail'); } function visibilityON(e) { //Invia il comando al server... initXMLHRclean('setvisibilityON'); return false; } function visibilityOFF(e) { //Invia il comando al server... initXMLHRclean('setvisibilityOFF'); return false; } //For jobs... function jobawardON(e) { var target = find_target(e); if (!target) return; var gancio = target.className; //Invia il comando al server... initXMLHRclean(gancio); //alert("AwardON:" + gancio); return false; } function jobawardOFF(e) { var target = find_target(e); if (!target) return; var gancio = target.className; //Invia il comando al server... initXMLHRclean(gancio); //alert("AwardOFF"); return false; } function visibilityesegui(e) { var target = find_target(e); if (!target) return; //var gancio = target.className; var posizione = findPos(target); //Definisce offsets in base allo status... var spia = document.getElementById('visibilityswitch'); if (spia.className == "visibilityswitch") { var offsetX = -28; var offsetY = -12; } else { var offsetX = -28; var offsetY = -39; } //Fa gli appendChild... var body = document.getElementsByTagName("body")[0]; //Margine bianco (per migliore visibilita...) var dialog = document.createElement("div"); dialog.className = "visibilityswitchcanvasout"; dialog.setAttribute("id", "visibilityswitchcanvasout"); dialog.style.left = posizione[0] + offsetX + "px"; dialog.style.top = posizione[1] + offsetY + "px"; var dialog2 = document.createElement("div"); dialog2.className = "visibilityswitchcanvas"; dialog2.setAttribute("id", "visibilityswitchcanvas"); dialog.appendChild(dialog2); //Inserisce contenuto... var elementhere = document.createElement("ul"); dialog2.appendChild(elementhere); //ON-LINE var elementhere0 = document.createElement("li"); elementhere0.className = "first"; elementhere.appendChild(elementhere0); var elementhere1 = document.createElement("a"); elementhere1.href = "/login/panel?setvisibility=0"; elementhere1.className = "viswitchON"; elementhere1.title = "Become Visible"; elementhere1.setAttribute("id", "viswitchON"); elementhere1.appendChild(document.createTextNode("ON-LINE")); elementhere0.appendChild(elementhere1); //OFF-LINE var elementhere0 = document.createElement("li"); elementhere0.className = "second"; elementhere.appendChild(elementhere0); var elementhere1 = document.createElement("a"); elementhere1.href = "/login/panel?setvisibility=1"; elementhere1.className = "viswitchOFF"; elementhere1.title = "Become Invisible"; elementhere1.setAttribute("id", "viswitchOFF"); elementhere1.appendChild(document.createTextNode("OFF-LINE")); elementhere0.appendChild(elementhere1); //Conclude... body.appendChild(dialog); //Attach listeners... document.getElementById('viswitchOFF').onclick = visibilityOFF; document.getElementById('viswitchON').onclick = visibilityON; return false; } function tellafriend(e) { var target = find_target(e); if (!target) return; var gancio = target.className; makepop(gancio,'forwardbutton'); return false; } function reportspamforums(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamforums|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamcomments(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamcomments|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamuser(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamuser|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamemail(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamemail|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamjobs(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamjobs|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamextjobs(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempextjobid = gancio.split("|"); var extjobid = tempextjobid[1]; var parametro = "reportspamextjobs|" + extjobid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamvideo(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamvideo|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamsheetmusic(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamsheetmusic|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function reportspamaudio(e) { var target = find_target(e); if (!target) return; var gancio = target.className; var tempmemberid = gancio.split("|"); var memberid = tempmemberid[1]; var parametro = "reportspamaudio|" + memberid; makepop(parametro,'forwardbutton'); //alert(memberid); return false; } function sendrequestpop(e) { if (document.getElementById('customDialoglarge')) { closeDialog(document.getElementById('customDialoglarge')); //alert ("gioo"); } var target = find_target(e); if (!target) return; //alert("ready?"); //alert(target); //sospende eventuale timerrefresh se presente (5-30-08)... if (typeof timerrefresh != 'undefined') { clearInterval(timerrefresh); } //Ora prende eventuale $MEMBERid dalla classe dell' id "schede"... if (document.getElementById('schede')) { var memberid = document.getElementById('schede').className; var tempmemberid = memberid.split("|"); var memberid = tempmemberid[1]; } else if (document.getElementById('schedecopia')) { var memberid = document.getElementById('schedecopia').className; var tempmemberid = memberid.split("|"); var memberid = tempmemberid[1]; } //Ora estrae l' ID utente... var gancio = target.href; var userid = gancio.replace(/^.+\?id\=/, ""); //This below is likely when clicked from buddy list (3-12-2012)... if (!tempmemberid) { var fakeone = 'nologged|'; var tempmemberid = fakeone.split("|"); } //alert(userid); //Se userid e memberid sono uguali, il messaggio non puo' essere spedito... if (memberid == userid) { makepop('sendcontactsameuser',''); } else if (tempmemberid[0] == 'nologged') { //Se non logged (4-3-09)... makepop('sendcontactnologged',''); var expiry=new Date(); expiry.setTime(expiry.getTime() + 3600); document.cookie="sendcontactnologged="+userid+"; expires="+expiry.toUTCString()+"; path=/"; } else if (tempmemberid[0] == 'logged') { //Se logged ma non comfermato (4-3-09)... makepop('sendcontactnoapproved',''); } else { var parametro = "sendcontactrequest|" + userid + "|" + memberid; //If there is extra parameter, gets it to pass along (10-10-2011)... if (tempmemberid[2]) { parametro = parametro + "|" + tempmemberid[2]; } /* if (document.getElementById('bob')) { //Se gia' presente un bob lo rimuove... var bobpres = document.getElementById('bob'); bobpres.parentNode.removeChild(bobpres); //alert("presente"); } */ //alert(tempmemberid[2]); makepop(parametro,'forwardbutton'); } //alert("done"); return false; } function find_target(e) { /* Begin the DOM events part, which you */ /* can ignore for now if it's confusing */ var target; if (window.event && window.event.srcElement) target = window.event.srcElement; else if (e && e.target) target = e.target; if (!target) { return null; } //alert (target); while (target != document.body && target.nodeName.toLowerCase() != 'a' && target.parentNode) target = target.parentNode; if (target.nodeName.toLowerCase() != 'a') return null; return target; } function mouseover(e) { var target = find_target(e); if (!target) return; // the only child node of the a tag in target will be an img tag var img_tag = target.childNodes[0]; // Take the "src", which names an image called "something.ext", // Make it point to "something_over.ext" // This is done with a regular expression img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '_over$1'); } function mouseout(e) { var target = find_target(e); if (!target) return; // the only child node of the A-tag in |target| will be an IMG-tag var img_tag = target.childNodes[0]; // Take the "src", which names an image as "something_over.ext", // Make it point to "something.ext" // This is done with a regular expression img_tag.src = img_tag.src.replace(/_over(\.[^.]+)$/, '$1'); } function confermashared(){ if(confirm("Are you sure?")) { return (true);} else { return (false);} } function confermashareddeletefield(input){ if(confirm("Are you sure you want to delete this field?")) { var deletefield = document.getElementById('deletequickedit'); if (deletefield) { deletefield.value = input; } return (true);} else { return (false);} } function confermadelupgrades(title){ var domanda = "Are you sure you want to delete your " + title + "?"; if(confirm(domanda)) { return (true);} else { return (false);} } function confermadelgeneric(title){ var domanda = "Are you sure you want to delete " + title + "?"; if(confirm(domanda)) { return (true);} else { return (false);} } function confermageneric(title){ var domanda = "Are you sure" + title + "?"; if(confirm(domanda)) { return (true);} else { return (false);} } function clearinput(e){ if (!document.getElementsByTagName || !document.getElementById) return; var focus = document.getElementById(e); if (focus) { if (focus.value == 'Type your Summary/Notes here...' || focus.value == 'Specify Other...' || focus.value == 'Type your Resume here...' || focus.value.indexOf('Type your ') != -1 || focus.value == 'author\'s name or alias/nickname' || focus.value == '...something about yourself...' || focus.value == 'Specify other...') { focus.value = ""; focus.style.color="#000000"; } focus.style.color="#000000"; } } //Questa qui sotto e' come sopra ma cancella sempre, per evitare di dover inserire ogni volta //una condizionale secondo l' input... function clearinputwipe(e){ if (!document.getElementsByTagName || !document.getElementById) return; var focus = document.getElementById(e); if (focus) { focus.value = ""; focus.style.color="#000000"; } } function textCounter(field,cntfield,maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else cntfield.value = maxlimit - field.value.length; } function noautorefresh(e) { var autorefreshpanelvalore = document.getElementById('autorefreshpanel'); if (autorefreshpanelvalore) { autorefreshpanelvalore.value = "0"; } } // Procedure Panel... function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { //window.alert(input); curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } function emailCheck (emailStr) { /* The following pattern is used to check if the entered e-mail address fits the user@domain format. It also is used to separate the username from the domain. */ var emailPat=/^(.+)@(.+)$/ /* The following string represents the pattern for matching all special characters. We don't want to allow special characters in the address. These characters include ( ) < > @ , ; : \ " . [ ] */ var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" /* The following string represents the range of characters allowed in a username or domainname. It really states which chars aren't allowed. */ var validChars="\[^\\s" + specialChars + "\]" /* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are allowed and which aren't; anything goes). E.g. "jiminy cricket"@disney.com is a legal e-mail address. */ var quotedUser="(\"[^\"]*\")" /* The following pattern applies for domains that are IP addresses, rather than symbolic names. E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */ var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/ /* The following string represents an atom (basically a series of non-special characters.) */ var atom=validChars + '+' /* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */ var word="(" + atom + "|" + quotedUser + ")" // The following pattern describes the structure of the user var userPat=new RegExp("^" + word + "(\\." + word + ")*$") /* The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above. */ var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$") /* Finally, let's start trying to figure out if the supplied address is valid. */ /* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */ var matchArray=emailStr.match(emailPat) if (matchArray==null) { /* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */ //alert("Email address seems incorrect (check @ and .'s)") return false } var user=matchArray[1] var domain=matchArray[2] // See if "user" is valid if (user.match(userPat)==null) { // user is not valid //alert("The username doesn't seem to be valid.") return false } /* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */ var IPArray=domain.match(ipDomainPat) if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { //alert("Destination IP address is invalid!") return false } } return true } // Domain is symbolic name var domainArray=domain.match(domainPat) if (domainArray==null) { //alert("The domain name doesn't seem to be valid.") return false } /* domain name seems valid, but now make sure that it ends in a three-letter word (like com, edu, gov) or a two-letter word, representing country (uk, nl), and that there's a hostname preceding the domain or country. */ /* Now we need to break up the domain to get a count of how many atoms it consists of. */ var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) var len=domArr.length if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) { // the address must end in a two letter or three letter word. //alert("The address must end in a three-letter domain, or two letter country.") return false } // Make sure there's a host name preceding the domain. if (len<2) { var errStr="This address is missing a hostname!" //alert(errStr) return false } // If we've gotten this far, everything's valid! return true; } function number_format(a, b, c, d) { // number_format(number, decimals, comma, formatSeparator) a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b); e = a + ''; f = e.split('.'); if(!f[0]) f[0] = '0'; if(!f[1]) f[1] = ''; if(f[1].length < b){ g = f[1]; for(i = f[1].length + 1; i <= b; i++) { g += '0'; } f[1] = g; } if(d != '' && f[0].length > 3) { h = f[0]; f[0] = ''; for(j = 3; j < h.length; j += 3) { i = h.slice(h.length - j, h.length - j + 3); f[0] = d + i + f[0] + ''; } j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3)); f[0] = j + f[0]; } c = (b <= 0) ? '': c; return f[0] + c + f[1]; } function preventdefault(event) { if (typeof event == "undefined") { event = window.event; } if (typeof event.preventDefault != "undefined") { event.preventDefault(); } else { event.returnValue = false; } } //Funzione per str_replace... function str_replace (search, replace, subject) { var result = ""; var oldi = 0; for (i = subject.indexOf (search); i > -1; i = subject.indexOf (search, i)) { result += subject.substring (oldi, i); result += replace; i += search.length; oldi = i; } return result + subject.substring (oldi, subject.length); } //Funzione per creare pop-up window... function creapopupwin(urlcontent, title, width, height, resizable, scrollbars) { if (resizable == 1 || resizable == "yes") { resizable = "yes"; } else { resizable = "no"; } if (scrollbars == 1 || scrollbars == "yes") { scrollbars = "yes"; } else { scrollbars = "no"; } var attributes = 'width=' + width + ',height=' + height + ',resizable=' + resizable + ',scrollbars=' + scrollbars; //alert(attributes); NewWindow1=window.open(urlcontent,title, attributes); return false; } //Function for long narrow lists... function narrowshowmore(id) { var gancio = $(id); var classe = gancio.className; var ganciolink = $(id + "link") if (classe == 'narrowboxes') { gancio.className = 'narrowboxesFULL'; ganciolink.innerHTML = '[Show less]'; } else { gancio.className = 'narrowboxes'; ganciolink.innerHTML = '[Show all]'; } //alert (gancio.className); return false; } function listsshowmore(id) { var gancio = document.getElementById(id); var classe = gancio.className; var ganciolink = document.getElementById(id + "link") //alert("here: " + classe); if (classe == 'limitlists') { gancio.className = 'limitlistsFULL'; ganciolink.innerHTML = '[Show less]'; } else { gancio.className = 'limitlists'; ganciolink.innerHTML = '[Show all]'; } //alert (gancio.className); //return false; } function checkhowtoapply() { var howtoapply = document.getElementById('howtoapply').value; if (howtoapply > 1) { var howtoapplyurl = document.getElementById('howtoapplyurl').value; var howtoapplyemail = document.getElementById('howtoapplyemail').value; //var howtoapplyjobposter = document.getElementById('howtoapplyjobposter').value; //alert(howtoapplytext); var parametro = 'howtoapply|' + howtoapply + '|' + howtoapplyurl + '|' + howtoapplyemail; makepop(parametro,'howtoapply'); return false; } else { return true; } } function freetrialfeaturewarn(feature) { //alert("Warning here"); var parametro = "trialfeaturewarn|" + feature; makepop(parametro,'trialfeaturewarn'); } /* Starts Search by Location Stuff (11-3-2014) */ function placeholderffST(input) { //alert(input); var placeholder = document.getElementById(input); if (placeholder.style.fontStyle == "italic") { //alert(placeholder.style.fontStyle); var prevalue = placeholder.value; placeholder.value = ''; placeholder.style.color = "#000"; placeholder.style.fontStyle = "normal"; if (input == "subsearchbox2" && prevalue != 'Current Location') { var r = confirm("Would you like to find your location?"); if (r == true) { //alert("Find location!"); getUserLocationST(); } else { setTimeout(function(){placeholder.focus();}, 1); } } } } function setPositionST(position) { document.getElementById('subsearchbox2').value = "Current Location"; document.getElementById('subsearchbox2').style.color = "#888"; document.getElementById('subsearchbox2').style.fontStyle = "italic"; document.getElementById('currentloc_lat').value = position.coords.latitude; document.getElementById('currentloc_lng').value = position.coords.longitude; } function getUserLocationST() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(setPositionST); } else { alert("Sorry, but geolocation is not supported by this browser."); } } function validateInputsST() { var placeholder = document.getElementById('subsearchbox'); //alert("here"); //At least the first field must be filled, the second is actually optional... if (placeholder.value == '' || placeholder.style.fontStyle == "italic") { alert("Please, enter at least one keyword to search for."); return false; } else { return true; } }