this.name='shEAMainWnd';
this.focus();
var currWePageNo = 1;
var fUserClick = 0;
function wePage(pageNo) {
if (pageNo < 1)
pageNo = noWEPages;
if (pageNo > noWEPages)
pageNo = 1;
for (i = 0; i < 10; ++i) {
pNo = i * 2 + 1;
if (gE('weDiv' + pNo) != null) {
if (pNo == (pageNo - 1) * 2 + 1) {
gE('weDiv' + pNo).style.display = 'inline';
gE('wePSpan' + (i+1)).style.display = 'inline';
gE('wePAnch' + (i+1)).style.display = 'none';
}
else {
gE('weDiv' + pNo).style.display = 'none';
gE('wePSpan' + (i+1)).style.display = 'none';
gE('wePAnch' + (i+1)).style.display = 'inline';
}
}
}
currWePageNo = pageNo;
fUserClick = 5;
}
function switchWEPage() {
if (fUserClick > 0) {
fUserClick = fUserClick - 1;
}
else {
wePage(currWePageNo + 1);
fUserClick = 0;
}
setTimeout('switchWEPage()', 5000);
}
//FORUM ACCOUNT
var redirectAfterLogin = '';
function doLoginForum() {
if(!validateLogin()) {
return false;
}
var tmpUtilizator = $('cUtilizator').value;
var tmpParola = $('cParola').value;
$('utilizatorInregistrat').innerHTML = '
';
new Ajax.Request(pathWWW+'/getajax|doLogin', {
method:'post',
parameters: {cUtilizator: tmpUtilizator,cParola: tmpParola },
onSuccess: function(transport){
var response = transport.responseXML;
var status = response.childNodes[0].childNodes[0].firstChild.nodeValue;
if(status == 'true') {
var user = response.childNodes[0].childNodes[2];
displayLoggedScreenForum(user);
} else {
//report error
var err = response.childNodes[0].childNodes[1].firstChild.nodeValue;
displayLoginScreenForum();
$('cUtilizator').value = tmpUtilizator;
document.getElementById('cUtilizator').focus();
showToolTipFader('Utilizatorul nu exista sau parola este gresita',$('cUtilizator'));
}
},
onFailure: function(){ }
});
}
function displayLoginScreenForum() {
var content = "";
content +="
Cont utilizator
";
content +="";
$('fieldsetLogin').innerHTML = content;
addLoginKeyPressEventForum();
}
function displayRecoverPasswordForum() {
var content = "";
content +='Recuperare parola
';
content +="";
$('fieldsetLogin').innerHTML = content;
setTimeout('document.getElementById(\'cRecover\').focus();',100);
addLoginKeyPressEventForum();
}
function doRecoverPasswordForum() {
if(!validateMail($('cRecover'))) {
return false;
}
var tmpRecover = $('cRecover').value;
$('utilizatorInregistrat').innerHTML = '
';
new Ajax.Request(pathWWW+'/getajax|doRecoverPassword', {
method:'post',
parameters: {cRecover: tmpRecover },
onSuccess: function(transport){
var response = transport.responseXML;
var status = response.childNodes[0].childNodes[0].firstChild.nodeValue;
if(status == 'true') {
displayRecoverPasswordMsgForum('« inapoi
Email-ul cu noua parola a fost trimis succes catre
'+tmpRecover+' ');
} else {
//report error
var err = response.childNodes[0].childNodes[1].firstChild.nodeValue;
displayRecoverPasswordMsgForum('« inapoi
'+err);
}
},
onFailure: function(){ }
});
}
function displayRecoverPasswordMsgForum(msg) {
var content = "";
content +="Cont utilizator
";
content +="";
content +=msg;
content +="";
content +="";
content +="
";
$('fieldsetLogin').innerHTML = content;
}
function addLoginKeyPressEventForum() {
if($('cUtilizator'))
$('cUtilizator').onkeypress = function(e) {
if(!document.all && e.which == 13)
doLoginForum();
}
if($('cParola'))
$('cParola').onkeypress = function(e) {
if(!document.all && e.which == 13)
doLoginForum();
}
if($('cRecover'))
$('cRecover').onkeypress = function(e) {
if(!document.all && e.which == 13)
doRecoverPasswordForum();
}
if(document.all) {
document.body.onkeypress = function(e) {
var kC = event.keyCode;
if(kC==27)
if($('tooltipX'))
hidePopup();
}
} else {
window.onkeypress = function(e) {
var kC = e.keyCode;
var Esc = e.DOM_VK_ESCAPE;
if(kC==Esc)
if($('tooltipX'))
hidePopup();
}
}
}
function displayLoggedScreenForum(user) {
if(redirectAfterLogin) {
window.location=redirectAfterLogin;
} else {
window.location.reload();
}
/*
if(user.childNodes[3].firstChild.nodeValue) {
var avatar = user.childNodes[3].firstChild.nodeValue;
} else {
var avatar = "
";
}
var content = "";
content += "Utilizator autentificat IESIRE
";
content += avatar;
content += "";
content += "- Bine ai venit "+user.childNodes[0].firstChild.nodeValue+"
";
content += "- Editeaza datele
";
content += "- Contul meu
";
content += "- Mesaje private
";
content += "
";
$('fieldsetLogin').innerHTML = content; */
}
function highlightLoginForum(redirAfter) {
redirectAfterLogin = redirAfter;
$('fieldsetLogin').style.backgroundColor = "yellow";
$('cUtilizator').focus();
self.scrollTo(0, 0);
showToolTipFader("Actiunea necesita autentificare!",$('cUtilizator'));
}
function displayForumRegisterFrm() {
var content = "";
content +='Creare cont
';
content +="";
$('fieldsetLogin').innerHTML = content;
}
function doRegisterForum() {
if(!validateRegister()) {
return false;
}
var tmpUtilizator = $('cUtilizator').value;
var tmpParola = $('cParola').value;
var tmpEmail = $('cEmail').value;
$('utilizatorNou').innerHTML = '
';
new Ajax.Request(pathWWW+'/getajax|doRegister', {
method:'post',
parameters: {cUtilizator: tmpUtilizator,cParola: tmpParola, cEmail: tmpEmail },
onSuccess: function(transport){
var response = transport.responseXML;
var status = response.childNodes[0].childNodes[0].firstChild.nodeValue;
if(status == 'true') {
displayLoggedScreenForum();
} else {
//report error
var err = response.childNodes[0].childNodes[1].firstChild.nodeValue;
displayForumRegisterFrm();
$('cUtilizator').value = tmpUtilizator;
document.getElementById('cUtilizator').focus();
showToolTipFader(err,$('cUtilizator'));
}
},
onFailure: function(){ }
});
}
//VALIDATION
function validateFSubject() {
if($('mTitle')) {
if(Validation.get('required').test($('mTitle').value)) {
} else {
showToolTipFader('Completati titlu',$('mTitle'));
$('mTitle').focus();
return false;
}
}
if($('message')) {
if(Validation.get('required').test($('message').value)) {
} else {
showToolTipFader('Completati mesaj',$('message'));
$('message').focus();
return false;
}
}
return true;
}
function validateSearch() {
if($('mFSearch')) {
if(Validation.get('required').test($('mFSearch').value) && ($('mFSearch').value.length > 2)) {
} else {
showToolTipFader('Cautarea trebuie sa contina minim 3 caractere.',$('mFSearch'));
$('mFSearch').focus();
return false;
}
}
return true;
}
function updateRecomandariSubiect(vTopicID,nr){
//change link
$('sRecomandaSubiect').innerHTML="+"+(nr+1);
$('sRecomandaSubiect').href = "javascript:void(0);";
new Ajax.Request(pathWWW+'/getajax|recommendSubject',
{
method:'post',
parameters: {topicID: vTopicID },
onSuccess: function(){
//set cookie
createCookie('recSubj_'+vTopicID,'true',14);
},
onFailure: function(){ }
});
}
var forumTabs = Class.create({
locked: false,
initialize: function(target,oDef,oId,oPageID) {
this.target = target;
this.oDef = oDef;
this.arrElem = $$('#'+oDef+' a');
if(oId)
this.oId = oId;
else
this.oId = this.arrElem.first().id;
if(oPageID) {
Effect.ScrollTo($(this.target), {offset:-50});
this.oPageID = oPageID;
this.getData(this.oId);
} else {
this.oPageID = 0;
this.getData(this.oId);
this.events();
}
},
events: function() {
this.arrElem.each(function(e) {
Event.observe(e,"click", function() {
this.getData(e.id);
}.bind(this) );
},this);
},
disableTab: function() {
this.locked = true;
//this.arrElem.each(function(e) { e.hide(); });
$(this.target).update("Se incarca...

");
//console.log('tabul se dezactiveaza');
},
activateTab: function() {
this.locked = false;
//this.arrElem.each(function(e) { e.show(); });
//console.log('tabul se activeaza');
},
getData: function(xId) {
//console.log(this.locked);
if(!this.locked) {
this.deactivateTabs();
$(xId).addClassName('activ');
new Ajax.Request(pathWWW+'/getajax|forumtabs', {
method:'post',
parameters: {def: this.oDef, id: xId, pageID: this.oPageID},
onCreate: this.disableTab(),
onSuccess: function(transport) {
$(this.target).update(transport.responseText);
this.activateTab();
}.bind(this)
});
}
},
deactivateTabs: function() {
this.arrElem.each(function(e) {
e.removeClassName('activ');
});
},
removeFollow: function(xTopicID) {
new Ajax.Request(pathWWW+'/getajax|removefollow', {
method:'post',
parameters: {topicID: xTopicID},
onSuccess: function(transport) {
$('tr'+xTopicID).remove();
$('tr'+xTopicID+'_message').update('Discutia a fost scoasa din lista de discutii urmarite.');
}
});
}
});