var MARKER = '@#@##'; var SEPARATOR = '@@##@'; var MARKER_REG = new RegExp(MARKER, 'g'); var SEPARATOR_REG = new RegExp(SEPARATOR, 'g'); var saveOfferId ; function saveBriefCaseResult(data) { if (data == 'NOT_LOGGED' ) { overlay_show(); } else { switchMessages(data,true) ; } } function saveBriefCaseResult2(data) { switchMessages(data,true) ; } function saveBriefCaseLoginResult(data) { var obj_text = _gOb('login_message'); if (data.success) { if (obj_text) { obj_text.innerHTML = '' ; } overlay_hide(); briefCase.save(saveOfferId, saveBriefCaseResult2 ); } else { if (obj_text) { obj_text.innerHTML = data.message ; } } } function saveBriefCase(offerId){ briefCase.save(offerId, saveBriefCaseResult ); } function saveBriefCaseLogin(login,password,offerId){ saveOfferId = offerId ; userService.loginUser(login, password, 'USER', 'false', saveBriefCaseLoginResult); } function switchMessages(text,show) { var obj_text = _gOb('message_text'); if (obj_text) { obj_text.innerHTML = text ; } var obj = _gOb('ad_messages'); if (obj) { obj.style.display = show ? 'block' : 'none'; } } /** * Funkcja wywoływana przez odtwarzacz filmów i służy od zapisania faktu obejrzenia materiału wideo * * @param id - xx materiału video * @return */ var storeStats = true; function _fpPlay(id) { if( storeStats ){ DWRClassifiedShow.movePlayStatsApply(_gOb('clIdHid').value); storeStats=false; } } var kx = 0; var mailToId = 0; function replace_mails(elem) { var linkary = []; var re = /([a-zA-Z0-9_\-\.,\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/g; var res = SEPARATOR_REG; var re_mailto = new RegExp(/^mailto:/); if (elem.tagName && elem.tagName.toLowerCase() == 'script') return; if (elem.tagName && elem.tagName.toLowerCase() == 'a') { if (elem.href.match(re)) { if (!elem.href.match(re_mailto)) { elem.href = 'mailto:'+a.href; } var _x = elem.innerHTML; elem.href += '?subject='+activeMailSubject+'&body='+activeMailBody; elem.innerHTML = _x; elem.onclick = function() { setTimeout("DWRClassifiedShow.statsApply(_gOb('clIdHid').value);", 1); return true; } elem.id = "mlto" + mailToId; mailToId++; } return; } var _elems = elem.childNodes; if (_elems.length == 0) { if (elem.data && elem.data.match(re)) { linkary = []; var linkary_i = 0; var _elemdata = MARKER+elem.data.replace(re, function(str, p1, p2, offset, s) { result = SEPARATOR; linkary[linkary_i++] = str; return result; }); _elemdata = _elemdata.split(res); var _nelem = document.createElement('span'); var j = 0; for (var i = 0; i < _elemdata.length; i++) { if (_elemdata[i] && _elemdata[i] != '!@##@#@!#@@!#@') { var _tn = document.createTextNode(_elemdata[i].replace(MARKER_REG, '')); _nelem.appendChild(_tn); } if (j < linkary.length) { var _ts = document.createElement('a'); _ts.id = "mlto" + mailToId; mailToId++; _ts.href = 'mailto:'+linkary[j]+'?subject='+activeMailSubject+'&body='+activeMailBody; _ts.onclick = function() { setTimeout("DWRClassifiedShow.statsApply(_gOb('clIdHid').value);", 1); return true; } _ts.innerHTML = linkary[j++]; _nelem.appendChild(_ts); } } while (j < linkary.length) { var _ts = document.createElement('a'); _ts.id = "mlto" + mailToId; mailToId++; _ts.href = 'mailto:'+linkary[j]+'?subject='+activeMailSubject+'&body='+activeMailBody; _ts.onclick = function() { setTimeout("DWRClassifiedShow.statsApply(_gOb('clIdHid').value);", 1); return true; } _ts.innerHTML = linkary[j++]; _nelem.appendChild(_ts); } elem.parentNode.insertBefore(_nelem, elem); elem.parentNode.removeChild(elem); } } else { for (var i = 0; i < _elems.length; i++) { replace_mails(_elems[i]); } } } function applyGoldenline(){ var config = window.goldenlineApplyConfig, createButton = null, overlay = null, wrap = null, p = null, link = null, adEmailLink = null, applyEmail = '', re = /([a-zA-Z0-9_\-\.,\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/g; if (!config || !config.enabled) return; createButton = function(email){ var a = document.createElement('a'); a.innerHTML = 'Aplikuj z '; a.className = 'glExtApplyButton smooth'; a.href = '#'; a.style.display = 'none'; a.setAttribute('data-position', config.position); a.setAttribute('data-company', config.company); a.setAttribute('data-email', email || config.email); a.setAttribute('data-id', config.id); a.setAttribute('data-source', 'gazetapraca.pl'); a.onclick = function() { setTimeout("DWRClassifiedShow.statsGLApply(_gOb('clIdHid').value);", 1); return true; } return a; }; if (mailToId > 0) { adEmailLink = document.getElementById('mlto0'); if (adEmailLink) { applyEmail = adEmailLink.href.match(re)[0]; } } if (!applyEmail && !config.email) return; overlay = document.createElement('div'); overlay.id = 'GLApplyOverlay'; wrap = document.createElement('div'); wrap.className = 'wrap'; p = document.createElement('p'); if (applyEmail) { link = document.createElement('a'); link.href = 'mailto:'+applyEmail+'?subject='+activeMailSubject+'&body='+activeMailBody; link.onclick = function() { setTimeout("DWRClassifiedShow.statsApply(_gOb('clIdHid').value);", 1); return true; } link.innerHTML = applyEmail; link.className = 'mail'; p.appendChild(document.createTextNode((config.sendText || 'Wy\u015blij dokumenty na adres') + ' ')); p.appendChild(link); p.appendChild(document.createTextNode(' ' + (config.orText || 'lub') + ' ')); } p.appendChild(createButton(applyEmail)); wrap.appendChild(p); overlay.appendChild(wrap); document.body.appendChild(overlay); } function activeMail(e) { var ra_adv_view_obj = _gOb('ra_adv_view'); if (ra_adv_view_obj) { replace_mails(ra_adv_view_obj); applyGoldenline(); } } // Prints content of a given element var gAutoPrint = true; function printContent(id) { if (document.getElementById(id) != null) { var html = '\n\n'; if (document.getElementsByTagName("head") != null) { html += '\n\n'; html += '\n\n\n'; html += '\n
\n'; html += '\n
\n'; html += '\n
\n'; var printElem = document.getElementById(id); if (printElem != null) { html += printElem.innerHTML; } else { alert("Could not find the print section in the HTML"); return; } html += '\n
\n'; html += '\n
\n'; html += '\n
\n'; html += '\n\n'; var printWin = window.open("","printWindow","status=0,toolbar=0,resizable=1,scrollbars=1"); printWin.document.open(); printWin.document.write(html); printWin.document.close(); if (gAutoPrint) printWin.print(); } else { alert("Print not available"); } } return false; } _aEv(window,'load',activeMail);