if (this.name == '') { this.name='shInfMainWnd'; } this.focus(); /** * Sets a Cookie with the given name and value. * * name Name of the cookie * value Value of the cookie * [expires] Expiration date of the cookie (default: end of current session) * [path] Path where the cookie is valid (default: path of calling document) * [domain] Domain where the cookie is valid * (default: domain of calling document) * [secure] Boolean value indicating if the cookie transmission requires a * secure transmission */ function setCookie(name, value, expires, path, domain, secure) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function closeAnunt(id){ $('yellowbox').style.display='none'; setCookie('anunt'+id,'close',0); } function selectThis(id){ var zlines=document.getElementsByClassName('line'); var x; $('pollVote').value=id; for (x=0;x +"+(nr+1)+""; $$('span.recArticleCls')[1].innerHTML=" +"+(nr+1)+""; new Ajax.Request(pathWWW+'/getajax|recommendArticle', { method:'post', parameters: {articleID: vArticleID }, onSuccess: function(){ //set cookie createCookie('rec_'+vArticleID,'true',14); }, onFailure: function(){ } }); } function printerFriendly(urlToOpen) { var x = (screen.width-650)/2, y = (screen.height-450)/2; OpenWin = this.open(urlToOpen, "CtrlWindow", "width=650,height=450,toolbars=0,menubar=no,location=no,scrollbars=yes,resizable=no,screenX="+x+",screenY="+y+",left="+x+",top="+y); } //COMMENTS function postComment(articleID) { Effect.toggle($('comenteaza'),'slide'); new Ajax.Request(pathWWW+'/getajax|handleComments', { method:'post', parameters: {cArticleID: articleID,cUser: ($('cUser') ? $('cUser').value : "") , cText: $('cText').value, postComment: '1' }, onSuccess: function(){ var content="
"+$('cUser').value+"(utilizator neinregistrat)Adaugat acum
"+$('cText').value+"
"; var nDiv = new Element( 'div', { 'class': 'comentariu' } ); nDiv.update(content); $('commentsContentID').insert({'top': nDiv}); if($('cUser')) $('cUser').value = ''; $('cText').value =''; createCookie('lastPost','true',(1/24/60/2)); }, onFailure: function(){ } }); } function validateComment() { if($('cUser')) var cUser = $('cUser'); var cText = $('cText'); if(cUser) { if(Validation.get('required').test(cUser.value)) { } else { alert('Completati numele dumneavostra.'); cUser.focus(); return false; } } if(Validation.get('required').test(cText.value)) { } else { alert('Adaugati comentariul.'); cText.focus(); return false; } return true; } function changeFontSize(size) { defaultSize = 12; if (size == defaultSize) { $('texte').style.fontSize= defaultSize + 'px'; } else { $('texte').style.fontSize= size + 'px'; } setCookie('InfoFontSize', size, getDateFromDays(4), '/'); } function initFontSize() { userFontSize = getCookie('InfoFontSize'); if (userFontSize != null) { changeFontSize(userFontSize); } } /* setClass */ function sC(el, className) { el.className = className; } /* redirectTo */ function go(url) { window.location = url; } function cDV(el, defaultValue) { if (el.value == defaultValue) { el.value = ''; return; } if (el.value.length == 0) { el.value = defaultValue; return; } } /* getElementById */ function gE(elementID) { return document.getElementById(elementID); } /* getting offsettop & offsetleft for an elements by id */ function getElementPosition(elemID) { var offsetTrail = document.getElementById(elemID); var offsetLeft = 0; var offsetTop = 0; while (offsetTrail) { offsetLeft += offsetTrail.offsetLeft; offsetTop += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") { offsetLeft += document.body.leftMargin; offsetTop += document.body.topMargin; } return {left:offsetLeft, top:offsetTop}; } function recommend(urlRecommandForThisArticle) { var x = (screen.width-400)/2, y = (screen.height-400)/2; OpenWin = this.open(urlRecommandForThisArticle, "CtrlWindow", "width=400,height=400,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function changeFontSize(size) { defaultSize = 12; if (size == defaultSize) { gE('texte').style.fontSize= defaultSize + 'px'; } else { gE('texte').style.fontSize= size + 'px'; } setCookie('InfoFontSize', size, getDateFromDays(4), '/'); } function initFontSize() { userFontSize = getCookie('InfoFontSize'); if (userFontSize != null) { changeFontSize(userFontSize); } } /* slide up and to the left */ function prepareForPrinting() { max = 0; for (i = 0; i < document.all.length; ++i) { if (document.all[i].tagName == 'DIV') { d = document.all[i]; if (d.id != 'printVersionFooterDiv' && d.style.position == 'absolute' || d.style.position == 'relative' && d.style.top == '') { d.style.top = d.style.top.substr(0, d.style.top.length - 2) * 1 - 100; d.style.left = d.style.left.substr(0, d.style.left.length - 2) * 1 - 150; } } } } /** * Gets the value of the specified cookie. * * name Name of the desired cookie. * * Returns a string containing value of specified cookie, * or null if cookie does not exist. */ function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } /** * Deletes the specified cookie. * * name name of the cookie * [path] path of the cookie (must be same as path used to create cookie) * [domain] domain of the cookie (must be same as domain used to create cookie) */ function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } function getDateFromDays(noDays) { var exp = new Date(); exp.setTime(exp.getTime() + (noDays*24*60*60*1000)); } /* * "Article details" drop down menu */ var timerID = 0; function arrayer(arr,dupa) { freshArray=arr.split(dupa); return freshArray; } function showToolTipFader(texty,obj) { if($('tooltipX')) document.body.removeChild($('tooltipX')); var newdiv = document.createElement('div'); newdiv.setAttribute('id','tooltipX'); newdiv.className ="tooltipDiv"; newdiv.innerHTML = texty; setPopupPosition(obj,newdiv); document.body.appendChild(newdiv); window.setTimeout('Effect.Fade(\'tooltipX\', {duration:.3,from:1.0, to:0.0})',2500); } function validateThis(fieldID) { var obj = $(fieldID); Validation.add('cauta', 'Error message text', function(v) { return (v.length >= 3); }); if(Validation.get('cauta').test(obj.value)) { return true; } else { showToolTipFader('Cautarea trebuie sa contina minim 3 caractere.',obj); obj.focus(); return false; } } function validateAsk() { var EmailX = document.askForm.email; var Nume = document.askForm.nume; var Prenume = document.askForm.prenume; var Intrebare = document.askForm.intrebare; if(Validation.get('required').test(Nume.value)) { } else { showToolTipFader('Completati numele dumneavostra.',Nume); Nume.focus(); return false; } if(Validation.get('required').test(Prenume.value)) { } else { showToolTipFader('Completati prenumele dumneavostra.',Prenume); Prenume.focus(); return false; } if(Validation.get('validate-email').test(EmailX.value) && EmailX.value.length > 1) { } else { showToolTipFader('Adresa de email este invalida \nExemplu: popesecu@example.ro',EmailX); EmailX.focus(); return false; } if(Validation.get('required').test(Intrebare.value)) { } else { showToolTipFader('Adresati o intrebare.',Intrebare); Intrebare.focus(); return false; } } function setPopupPosition(el, x) { var position = Position.cumulativeOffset(el); var scrollY = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop; var viewHeight = (navigator.userAgent.toLowerCase().indexOf("safari") != -1 && window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight; x.style.width = (el.offsetWidth - 2) + "px"; x.style.left = position[0] + "px"; var popupTop = position[1] + Element.getHeight(el); if((popupTop + x.offsetHeight > scrollY + viewHeight) && (position[1] - x.offsetHeight > scrollY)) { popupTop = position[1] - x.offsetHeight; } x.style.top = (popupTop+5) + "px"; } //************************************************************* //COOKIES function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); }