if (this.name == '') { this.name='shInfMainWnd'; } this.focus(); /* 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 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); } 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; } } } } /** * 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" : ""); } /** * 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 doSubscribe(path) { var EmailX = $('nlEmail'); if(Validation.get('validate-email').test(EmailX.value) && EmailX.value.length > 1) { } else { showToolTipFader('Invalid email address
Example: johndoe@example.com',EmailX); EmailX.focus(); return false; } new Ajax.Request(path+'/getajax|doSubscribe', { method:'post', parameters: {nlEmail: EmailX.value}, onSuccess: function(transport){ var response = transport.responseText || "no response text"; $('nlSubscribe').innerHTML = response; //alert(response); }, onFailure: function(){ } }); } 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('Search string needs to be at least 3 characters in length',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('Type in your last name.',Nume); Nume.focus(); return false; } if(Validation.get('required').test(Prenume.value)) { } else { showToolTipFader('Type in your first name.',Prenume); Prenume.focus(); return false; } if(Validation.get('validate-email').test(EmailX.value) && EmailX.value.length > 1) { } else { showToolTipFader('Invalid email address\nExample: johndoe@example.com',EmailX); EmailX.focus(); return false; } if(Validation.get('required').test(Intrebare.value)) { } else { showToolTipFader('Type in your question.',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); } //COMMENTS function displayCommentForm() { Effect.toggle($('posteaza'),'slide'); } function postComment(articleID) { Effect.toggle($('posteaza'),'slide'); new Ajax.Request(pathWWW+'/getajax|handleComments', { method:'post', parameters: {cArticleID: articleID,cUser: ($('cUser') ? $('cUser').value : "") , cText: $('cText').value, postComment: '1' }, onSuccess: function(transport){ if($('cUser')) $('cUser').value = ''; $('cText').value =''; //set cookie createCookie('lastPost','true',(1/24/60/2)); var response = transport.responseXML; writeComments(response); }, onFailure: function(){ } }); } function writeComments(rXML) { if(document.all) { var detalii = rXML.childNodes[1].childNodes[0]; var comments = rXML.childNodes[1].childNodes[1]; } else { var detalii = rXML.childNodes[0].childNodes[0]; var comments = rXML.childNodes[0].childNodes[1]; } //alert(comments.childNodes.length); //build pages var page = detalii.childNodes[0].firstChild.nodeValue; var totalPages = detalii.childNodes[1].firstChild.nodeValue; var totalcomentarii = detalii.childNodes[2].firstChild.nodeValue; var path= detalii.childNodes[3].firstChild.nodeValue; var articleID = detalii.childNodes[4].firstChild.nodeValue; var pager='Pagina '; for(j=0; j < totalPages; j++) { if((j+1)==page) { pager+=" "+(j+1)+" "; } else { pager+=" "+(j+1)+" "; } } var content = ""; if(totalPages > 1) content+="
"+pager+"
"; for(i=0; i < comments.childNodes.length; i++) { comment = comments.childNodes[i]; var cUser = comment.getElementsByTagName('name')[0].firstChild.nodeValue; var cUserID = comment.getElementsByTagName('userID')[0].firstChild.nodeValue; var cText = comment.getElementsByTagName('body')[0].firstChild.nodeValue; var cDate = comment.getElementsByTagName('postDate')[0].firstChild.nodeValue; var cAvatar = comment.getElementsByTagName('avatar')[0].firstChild.nodeValue; var cDiff = comment.getElementsByTagName('diferentza')[0].firstChild.nodeValue; content+='
'; content+=''; content+='
'; content+='
'; if(cUserID > 0) content+=''+cUser+'
'; else content+= ''+cUser+' (utilizator neinregistrat)
'; content+='adaugat acum '+cDiff+'
'+cText+'
'; } if(totalPages > 1) content+="
"+pager+"
"; $('commentsContentID').innerHTML=content; } function getComments(articleID,page) { new Ajax.Request(pathWWW+'/getajax|handleComments', { method:'post', parameters: {cArticleID: articleID, p: page}, onSuccess: function(transport){ var response = transport.responseXML; writeComments(response); }, onFailure: function(){ } }); } function validateComment() { if($('cUser')) var cUser = $('cUser'); var cText = $('cText'); if(cUser) { if(Validation.get('required').test(cUser.value)) { } else { showToolTipFader('Completati numele dumneavostra.',cUser); cUser.focus(); return false; } } if(Validation.get('required').test(cText.value)) { } else { showToolTipFader('Adaugati comentariul',cText); cText.focus(); return false; } return true; }