function loginUser() {	
	if (!homePageLoginFormOK()) return false;		
	var XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {
        var _error = '';
		var _userName = document.getElementById('lhpUsername').value;
		var _password = document.getElementById('lhpPassword').value;
 		var url = encodeURI(contextRoot + 'login?sId=' + sessionId + '&lu=' + _userName + '&hash=' + Base64.encode(_password) + '&sync=' + Math.random());                 		 		
 		XMLHttpRequestObject.open("GET", url);
        XMLHttpRequestObject.onreadystatechange = function() {
	        if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == invalidParameters){
//               		_error = 'Некоректни параметри!';	
               		invalidParametersOperation();
    			}	        
	        	var response = null;
	        	var name = '';
				if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
				response = XMLHttpRequestObject.responseXML.documentElement;	            	          			            	
				if (response != null) {
					var status = response.childNodes[0].firstChild.data;
					sessionId = response.childNodes[2].firstChild.data;
					if ('true' == response.childNodes[3].firstChild.data) {						
						clearAll();  
					}		
					if (response.childNodes[4] != undefined && response.childNodes[3].firstChild != undefined) {
						name = response.childNodes[4].firstChild.data;
					}
					if (response.childNodes[5] != undefined && response.childNodes[5].firstChild != undefined) {						
						name += "&nbsp;" + response.childNodes[5].firstChild.data;
					}
					if (name == null || name == '') {
						name = response.childNodes[1].firstChild.data;
					}
					if (status == '1') { 							
						if (response.childNodes[1] != undefined && response.childNodes[1].firstChild != undefined && response.childNodes[1].firstChild.data != undefined) {
							if (document.getElementById('topLinks') != undefined) {
								document.getElementById('topLinks').innerHTML = getAuthorizedTopLinks(response.childNodes[1].firstChild.data);
							}		
							document.getElementById('loginProfileLabelDIVId').innerHTML = getHomePageProfileTitleInfo(response.childNodes[1].firstChild.data);
							document.getElementById(windowContentId + loginHomePageDIVWindow).innerHTML = getHomePageProfileInfo(name);
							if (loginWindowShown) {								
								closeWindow(loginDIVWindow); 
							}							
							userLogged = true;	
							setIBSCookie(_userName, cookieUsernameKey);
							cookieUsernameValue = _userName;
						} else {
							_error = 'Възникна грешка в системата!';
						}
					} else {
						if (status == systemError) {
							_error = 'Възникна грешка в системата!';
						} else if (status == '-3') {
							_error = 'Моля въведете потребителско име и парола!';
						} else if (status == '-16') {
							_error = 'Грешно потребителско име или парола!';
						} else if (status == userStatusNotActive) {
							_error = 'Статуса на потребителят не е активен!';
						} else if (status == '-19') {
							if (loginWindowShown) {								
								closeWindow(loginDIVWindow); 
							}													
							reloadHomePage();
						}														
					}	
				}	        		            
              if (_error.length > 0) {       
					document.getElementById(windowContentId + loginHomePageDIVWindow).innerHTML = getHomePageLoginHTML();	
					document.getElementById('lhpUsername').value = _userName;
					document.getElementById('lhpPassword').value = _password;
					document.getElementById('login_homePage_err_msg').innerHTML = _error;
              }
              killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {    				
				document.getElementById(windowContentId + loginHomePageDIVWindow).innerHTML = getHomePageAjaxLoader('проверка на данните...');		        			
			} else { 
            	alert('There was a problem retrieving the XML data!');
          	}
		};
	XMLHttpRequestObject.send(null);
	}
	return true;
};
function sendLoginData() {	
	if (!loginFormOK(windowContentId + loginDIVWindow, loginErrMsgId)) return false;		
	var XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {
		var backupData = document.getElementById(windowContentId + loginDIVWindow).innerHTML;
        var _error = '';
		var _userName = document.getElementById('lUsername').value;
		var _password = document.getElementById('lPassword').value;
 		var url = encodeURI(contextRoot + 'login?sId=' + sessionId + '&lu=' + _userName + '&hash=' + Base64.encode(_password) + '&sync=' + Math.random());                 		

 		canCloseWindow = false;
 		XMLHttpRequestObject.open("GET", url);
        XMLHttpRequestObject.onreadystatechange = function() {
	        if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == invalidParameters){
//               		_error = 'Некоректни параметри!';	
					invalidParametersOperation();
    			}	        
	        	var response = null;	
	        	var name = '';
				if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
				response = XMLHttpRequestObject.responseXML.documentElement;	            	          			            	
					if (response != null) {
						var status = response.childNodes[0].firstChild.data;
						sessionId = response.childNodes[2].firstChild.data;
						if ('true' == response.childNodes[3].firstChild.data) {
							clearAll();  
						}	
						if (response.childNodes[4] != undefined && response.childNodes[3].firstChild != undefined) {
							name = response.childNodes[4].firstChild.data;
						}
						if (response.childNodes[5] != undefined && response.childNodes[5].firstChild != undefined) {						
							name += "&nbsp;" + response.childNodes[5].firstChild.data;
						}
						if (name == null || name == '') {
							name = response.childNodes[1].firstChild.data;
						}						
						if (status == '1') { 							
							if (response.childNodes[1] != undefined && response.childNodes[1].firstChild != undefined && response.childNodes[1].firstChild.data != undefined) {
								if (document.getElementById('topLinks') != undefined) {
									document.getElementById('topLinks').innerHTML = getAuthorizedTopLinks(response.childNodes[1].firstChild.data);
								}
								canCloseWindow = true;
								//hideAllMessagesShowTicketsAndVehicles();	
								document.getElementById('loginProfileLabelDIVId').innerHTML = getHomePageProfileTitleInfo(response.childNodes[1].firstChild.data);
								document.getElementById(windowContentId + loginHomePageDIVWindow).innerHTML = getHomePageProfileInfo(name);
								userLogged = true;	
								setIBSCookie(_userName, cookieUsernameKey);
								cookieUsernameValue = _userName;
								closeWindow(loginDIVWindow); 
							} else {
								_error = 'Възникна грешка в системата!';
							}
						} else {
							if (status == systemError) {
								_error = 'Възникна грешка в системата!';
							} else if (status == '-3') {
								_error = 'Моля въведете потребителско име и парола!';
							} else if (status == '-16') {
								_error = 'Грешно потребителско име или парола!';
							} else if (status == userStatusNotActive) {
								_error = 'Статуса на потребителят не е активен!';
							} else if (status == '-19') {
								if (loginWindowShown) {								
									closeWindow(loginDIVWindow); 
								}													
								reloadHomePage();
							}	
						}	
					}	        		            
              if (_error.length > 0) {       
					document.getElementById(windowContentId + loginDIVWindow).innerHTML = getLoginFormFields();							
					restoreLoginData(backupData, _userName, _password);					
//					document.getElementById(loginErrMsgId).innerHTML = _error;
					showSystemMessage(errorType, loginErrMsgId, (windowContentId + loginDIVWindow) , _error);
					document.getElementById(windowButtomContentId + loginDIVWindow).innerHTML = getLoginButtonsAddOn(loginWindowWidth);
              }
              canCloseWindow = true;
              killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {    				
				document.getElementById(windowContentId + loginDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
		        if (document.getElementById(windowButtomContentId + loginDIVWindow) != undefined) {
		        	document.getElementById(windowButtomContentId + loginDIVWindow).innerHTML = '';
		        }				
			} else { 
				canCloseWindow = true;
            	alert('There was a problem retrieving the XML data!');
          	}
		};
	XMLHttpRequestObject.send(null);
	}
	return true;
};
function sendRegistrationData() {
	if (!registrationFormOK(windowContentId + registrationSubmitDIVWindow, registrationErrMsgId)) return false;
	var backupData = document.getElementById(windowContentId + registrationSubmitDIVWindow).innerHTML;	
	XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {    						
		var _error = '';
		var _firstName = document.getElementById('rFirstName').value;
		var _lastName = document.getElementById('rLastName').value;
		var _email = document.getElementById('rEmail').value;
		var _userName = document.getElementById('rUserName').value;
		var _password = document.getElementById('rPassword').value;
		var _rpassword = document.getElementById('rRetypedPassword').value;
		var _rphone = document.getElementById('rPhone').value;
		var requestTail = new StringBuffer();
		
		requestTail.append('rFirstName=');
		requestTail.append(_firstName);
		requestTail.append('&rLastName=');
		requestTail.append(_lastName);
		requestTail.append('&rEmail=');
		requestTail.append(_email);
		requestTail.append('&rUserName=');
		requestTail.append(_userName);
		requestTail.append('&hash=');
		requestTail.append(Base64.encode(_password));
		requestTail.append('&rhash=');
		requestTail.append(Base64.encode(_rpassword));
		requestTail.append('&rPhone=');
		requestTail.append(Base64.encode(_rphone));
               	                
		canCloseWindow = false;		
        var url = encodeURI(contextRoot + 'usr-mgr?a=reg&sId=' + sessionId + '&' + requestTail.toString() + '&sync=' + Math.random());                      
        XMLHttpRequestObject.open("GET", url);   
    	XMLHttpRequestObject.onreadystatechange = function() {
        	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
               		sessionTimeOutOperation();
    			} else if (XMLHttpRequestObject.responseText == systemError) {
    				_error = 'Възникна системна грешка!';	                   	               	
               	} else if (XMLHttpRequestObject.responseText == invalidParameters){
//               		_error = 'Некоректни параметри!';	
					invalidParametersOperation();
               	} else if (XMLHttpRequestObject.responseText == '1') {
                    _error = 'Моля попълнете задължителните полета!';
                } else if (XMLHttpRequestObject.responseText == '2') {
                    _error = 'Моля въведете "Име"!';
                } else if (XMLHttpRequestObject.responseText == '3') {
                    _error = 'Моля въведете само букви за "Име"!';
                } else if (XMLHttpRequestObject.responseText == '4') {
                    _error = 'Моля въведете "Фамилия"!';
                } else if (XMLHttpRequestObject.responseText == '5') {
                    _error = 'Моля въведете само букви за "Фамилия"!';
                } else if (XMLHttpRequestObject.responseText == '6') {
                    _error = 'Моля въведете "е-поща"!';
                } else if (XMLHttpRequestObject.responseText == '7') {
                    _error = 'Моля въведете валидна "е-поща"!';
                } else if (XMLHttpRequestObject.responseText == '8') {
                    _error = 'Моля въведете потребителско име!';
                } else if (XMLHttpRequestObject.responseText == '14') {    
                	_error = 'Моля използвайте символи различни от (\',",\\,--) за потребителско име!';                
                } else if (XMLHttpRequestObject.responseText == '9') {
                    _error = 'Моля въведете парола!';
                } else if (XMLHttpRequestObject.responseText == '10') {
                    _error = 'Моля въведете парола с дължина поне 6 символа!';
                } else if (XMLHttpRequestObject.responseText == '11') {
                    _error = 'Моля въведете "Повтори парола"!';
                } else if (XMLHttpRequestObject.responseText == '12') {
                    _error = 'Моля въведете еднакви Парола и Повтори парола!';
                } else if (XMLHttpRequestObject.responseText == '-18') {
                    _error = 'Тази е-поща вече се използва!';
				} else if (XMLHttpRequestObject.responseText == '-17') {
			        _error = 'Това потребителско име вече се използва!';  
				} else if (XMLHttpRequestObject.responseText == '20') {
					_error = 'Моля въведете "Телефон"!';  
				} else if (XMLHttpRequestObject.responseText == '21') {
					_error = 'Моля въведете валиден "Телефон"!';  
				} else {					
					if (XMLHttpRequestObject.responseText == emailWasNotSent) {
						registrationResponse = emailWasNotSent;
						showWindow(registrationResults);
						
					} else if (XMLHttpRequestObject.responseText == responseSuccess){
						showWindow(registrationResults);
					} else {
						_error = 'Възникна системна грешка!';	 
					}									
			    }
				if (_error.length > 0) {
					document.getElementById(windowContentId + registrationSubmitDIVWindow).innerHTML = getRegistrationFormFields();						
					restoreRegistrationData(backupData, _firstName, _lastName, _email, _userName, _password, _rpassword, _rphone);					
					//document.getElementById(registrationErrMsgId).innerHTML =  _error;
					showSystemMessage(errorType, registrationErrMsgId, (windowContentId + registrationSubmitDIVWindow) , _error);
					document.getElementById(windowButtomContentId + registrationSubmitDIVWindow).innerHTML = getRegistrationSubmitAddOn(registrationSubmitWindowWidth);
				}
				canCloseWindow = true;
				killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {               
                document.getElementById(windowContentId + registrationSubmitDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                if (document.getElementById(windowButtomContentId + registrationSubmitDIVWindow) != undefined) {
                	document.getElementById(windowButtomContentId + registrationSubmitDIVWindow).innerHTML = '';
                }
            } else {
            	canCloseWindow = true;
            	alert("Възникна проблем с извличането на XML данните от сървъра!");
           	}
		};
	XMLHttpRequestObject.send(null);
	}
	return true;
};
function getProfileData() {
	//if (loadedEditData[0].length == 0 && loadedEditData[1].length == 0 && loadedEditData[2].length == 0 && loadedEditData[3].length == 0 && loadedEditData[4].length == 0) {       	
		XMLHttpRequestObject = getXMLHttpRequestObject();
			if (XMLHttpRequestObject) {               
				var _error = '';			                                            	                              	                  	
				var url = encodeURI(contextRoot + 'usr-mgr?a=edG&sId=' + sessionId + '&sync=' + Math.random());    
				XMLHttpRequestObject.open("GET", url);
		    	XMLHttpRequestObject.onreadystatechange = function() {
                	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
            			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
            				moduleCloseOperation();    																
            			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
            				sessionTimeOutOperation();
	                   	} else if (XMLHttpRequestObject.responseText == systemError) {
	                   		_error = 'Възникна грешка в системата!';
	                  	}  else if (XMLHttpRequestObject.responseText == invalidParameters) {
//	                  		_error = 'Некоректни параметри!';					                        
							invalidParametersOperation();
	                   	} else if (XMLHttpRequestObject.responseText == userNotFound) {
	                   		_error = 'Потребителят не е намерен!';					                        
	                   	} else {	
	                		var response = null;
			            	if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
			            	response = XMLHttpRequestObject.responseXML.documentElement;	  			            	         	          			            	
			            	if (response != null) {
			            		var data = new Array('','','','','');			            		
			            		if (response.childNodes[0] != undefined && response.childNodes[0].firstChild != undefined) {
			            			data[0] = response.childNodes[0].firstChild.data;
			            		}
			            		if (response.childNodes[1] != undefined && response.childNodes[1].firstChild != undefined) {
			            			data[1] = response.childNodes[1].firstChild.data;
			            		}
			            		if (response.childNodes[2] != undefined && response.childNodes[2].firstChild != undefined) {
			            			data[2] = response.childNodes[2].firstChild.data;
			            		}
			            		if (response.childNodes[3] != undefined && response.childNodes[3].firstChild != undefined) {
			            			data[3] = response.childNodes[3].firstChild.data;
			            		}			            													
			            		if (response.childNodes[4] != undefined && response.childNodes[4].firstChild != undefined) {
			            			data[4] = response.childNodes[4].firstChild.data;
			            		}			    
								loadedEditData = data;								
								document.getElementById(windowContentId + profileDIVWindow).innerHTML = getProfileFormFields();	
								loadProfilePreviewFields(loadedEditData);		
								document.getElementById(windowButtomContentId + profileDIVWindow).innerHTML = getProfileReadAddOn(profileWindowWidth);
							}	                   								                   							
	                   	}				
                      	if (_error.length > 0) {
                      		document.getElementById(windowContentId + profileDIVWindow).innerHTML = getProfileFormFields();	
        					document.getElementById(profileErrMsgId).innerHTML =  _error; 
        					document.getElementById(windowButtomContentId + profileDIVWindow).innerHTML = getProfileReadAddOn(profileWindowWidth);
                      	}
                      	killXML(XMLHttpRequestObject);
                  	} else if (XMLHttpRequestObject.readyState != 0) {                      
                        document.getElementById(windowContentId + profileDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                        if (document.getElementById(windowButtomContentId + profileDIVWindow) != undefined) {
                        	document.getElementById(windowButtomContentId + profileDIVWindow).innerHTML = '';
                        }	                    
                  	} else {
                      	alert("There was a problem retrieving the XML data!");
                  	}
              	};
			XMLHttpRequestObject.send(null);
			}
	//} else {	
//		if (document.getElementById(getWindowDIV(profile)) == undefined) {
//			showWindow(profile);
//		}
//		loadProfilePreviewFields(loadedEditData);
//    }     
};
function sendProfileData() {   
	if (!profileFormOK(windowContentId + profileDIVWindow, profileErrMsgId)) return false;
	XMLHttpRequestObject = getXMLHttpRequestObject();
		if (XMLHttpRequestObject) {
			var success = false;
			var _error = '';
            var requestTail = '&eFirstName='+ document.getElementById('eFirstName').value;
	          	requestTail += '&eLastName=' + document.getElementById('eLastName').value;
	          	requestTail += '&eEmail=' + document.getElementById('eEmail').value;
	          	requestTail += '&eUsername=' + document.getElementById('eUsername').value;
	          	if (document.getElementById('ePassword') != undefined) {
					requestTail += '&hash=' + Base64.encode(document.getElementById('ePassword').value);	
					requestTail += '&rhash=' + Base64.encode(document.getElementById('eRetypedPassword').value);          			        	
	          	}
	          	requestTail += '&ePhone=' + Base64.encode(document.getElementById('ePhone').value);		          	
            var url = encodeURI(contextRoot + 'usr-mgr?a=edS' + requestTail + '&sync=' + Math.random() + '&sId=' + sessionId);               
            XMLHttpRequestObject.open("GET", url);
        	XMLHttpRequestObject.onreadystatechange = function() {
            	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
        			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
        				moduleCloseOperation();    																
        			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
        				sessionTimeOutOperation();
                  	} else if (XMLHttpRequestObject.responseText == systemError) {
                  		_error = 'Възникна грешка в системата!';
                  	} else if (XMLHttpRequestObject.responseText == invalidParameters) {
//                  		_error = 'Некоректни параметри!';	
						invalidParametersOperation();
                  	} else if (XMLHttpRequestObject.responseText == '1') {
                  		_error = 'Моля попълнете задължителните полета!';
                    } else if (XMLHttpRequestObject.responseText == '2') {
                    	_error = 'Моля въведете "Име"!';
	                } else if (XMLHttpRequestObject.responseText == '3') {
	                	_error = 'Моля въведете само букви за "Име"!';
	                } else if (XMLHttpRequestObject.responseText == '4') {
	                	_error = 'Моля въведете "Фамилия"!';
	                } else if (XMLHttpRequestObject.responseText == '5') {
	                	_error = 'Моля въведете само букви за "Фамилия"!';
	                } else if (XMLHttpRequestObject.responseText == '6') {
	                	_error = 'Моля въведете "е-поща"!';
	                } else if (XMLHttpRequestObject.responseText == '7') {
	                	_error = 'Моля въведете валидна "е-поща"!';
	                } else if (XMLHttpRequestObject.responseText == '8') {
	                	_error = 'Моля въведете потребителско име!';
	                } else if (XMLHttpRequestObject.responseText == '14') {    
	                	_error = 'Моля използвайте символи различни от (\',",\\,--)<br>за потребителско име!';                
                	} else if (XMLHttpRequestObject.responseText == '-18') {
	                	_error = 'Тази е-поща вече се използва!';
                   	} else if (XMLHttpRequestObject.responseText == '-17') {
                   		_error = 'Това потребителско име вече се използва!'; 				                        
                       if (document.getElementById('eUsername') != undefined) {
                    	   document.getElementById('eUsername').focus();				                        
                       }
    				} else if (XMLHttpRequestObject.responseText == '20') {
    					_error = 'Моля въведете "Телефон"!';  
    				} else if (XMLHttpRequestObject.responseText == '21') {
    					_error = 'Моля въведете валиден "Телефон"!';                         
                   	} else {						
                		var response = null;
		            	if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
		            	response = XMLHttpRequestObject.responseXML.documentElement;	            	          			            	
		            	if (response != null) {
		            		var data = new Array();
		            		if (response.childNodes[0] != undefined && response.childNodes[0].firstChild != undefined) {
		            			data[0] = response.childNodes[0].firstChild.data;
		            		}
		            		if (response.childNodes[1] != undefined && response.childNodes[1].firstChild != undefined) {
		            			data[1] = response.childNodes[1].firstChild.data;
		            		}
		            		if (response.childNodes[2] != undefined && response.childNodes[2].firstChild != undefined) {
		            			data[2] = response.childNodes[2].firstChild.data;
		            		}
		            		if (response.childNodes[3] != undefined && response.childNodes[3].firstChild != undefined) {
		            			data[3] = response.childNodes[3].firstChild.data;
		            		}
		            		if (response.childNodes[4] != undefined && response.childNodes[4].firstChild != undefined) {
		            			data[4] = response.childNodes[4].firstChild.data;
		            		}
							loadedEditData = data;
							_error = 'Редактирането на профила завърши успешно!';
							success = true;
							updateUsername();
						} else {
							_error = 'Грешка с извличането на данните след редакцията!';
						}	                   								                   							
                   }				
                   if (_error.length > 0) {
                	   	switchPreviewToEdit();
//   						document.getElementById(profileErrMsgId).innerHTML =  _error; 
   						showSystemMessage(((success) ? infoType : errorType), profileErrMsgId, (windowContentId + profileDIVWindow) , _error);
                   }
				   killXML(XMLHttpRequestObject);
				} else if (XMLHttpRequestObject.readyState != 0) {
                    document.getElementById(windowContentId + profileDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                    if (document.getElementById(windowButtomContentId + profileDIVWindow) != undefined) {
                    	document.getElementById(windowButtomContentId + profileDIVWindow).innerHTML = '';
                    }	                    
                } else {
                	alert("There was a problem retrieving the XML data!");
                }
			};
		XMLHttpRequestObject.send(null);
		}     	 
};
function sendChangePasswordData() {
	if (!profileChangePasswordFormOK(windowContentId + changePasswordDIVWindow, changePasswordErrMsgId)) return false;
	XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {               
		var _error = '';
        var requestTail = '&chOhash=' + Base64.encode(document.getElementById('chOPassword').value);
			requestTail += '&chONhash=' + Base64.encode(document.getElementById('chNPassword').value);	
			requestTail += '&chONrhash=' + Base64.encode(document.getElementById('chNRetypedPassword').value);          			        	
        var url = encodeURI(contextRoot + 'usr-mgr?a=chP' + requestTail + '&sync=' + Math.random() + '&sId=' + sessionId);               

        XMLHttpRequestObject.open("GET", url);
    	XMLHttpRequestObject.onreadystatechange = function() {
        	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
    				sessionTimeOutOperation();
              	} else if (XMLHttpRequestObject.responseText == systemError) {
              		_error = 'Възникна грешка в системата!';
              	} else if (XMLHttpRequestObject.responseText == invalidParameters) {
//              		_error = 'Некоректни параметри!';	
					invalidParametersOperation();
              	} else if (XMLHttpRequestObject.responseText == oldPasswordEmpty) {
            		_error = 'Моля въведете текуща парола!';
              	} else if (XMLHttpRequestObject.responseText == passwordEmpty) {
            		_error = 'Моля въведете нова парола!';            		
                } else if (XMLHttpRequestObject.responseText == passwordTooShort) {
                	_error = 'Моля въведете нова парола с дължина поне 6 символа!';
                } else if (XMLHttpRequestObject.responseText == retypedPasswordEmpty) {
                	_error = 'Моля въведете "Нова повтори парола"!';
                } else if (XMLHttpRequestObject.responseText == passwordNotMatch) {
                	_error = 'Моля въведете еднакви "Нова парола"<br>и "Повтори нова парола"!';
              	} else if (XMLHttpRequestObject.responseText == userNotFound) {
            		_error = 'Моля въведете валидна текуща парола!';              		
               	} else if (XMLHttpRequestObject.responseText == responseSuccess){						
//            		document.getElementById(windowContentId + changePasswordDIVWindow).innerHTML = getWindowContentSimpleText('Вашата парола беше променена успешно!');

            		document.getElementById(windowButtomContentId + changePasswordDIVWindow).innerHTML = getChangePasswordOKAddOn(changePasswordWindowWidth);
					document.getElementById(windowContentId + changePasswordDIVWindow).innerHTML = getMessageHTML(infoType, changePasswordErrMsgId);
					showSystemMessageWithoutResizing(infoType, changePasswordErrMsgId, (windowContentId + changePasswordDIVWindow) , '<br>Вашата парола беше променена успешно!<br>&nbsp;');
            		
                } else {
                	_error = 'Възникна грешка в системата!';
                }
               if (_error.length > 0) {   
            	   document.getElementById(windowContentId + changePasswordDIVWindow).innerHTML = getChangePasswordFormFields();
//                   document.getElementById(changePasswordErrMsgId).innerHTML = _error;  
            	   showSystemMessage(errorType, changePasswordErrMsgId, (windowContentId + changePasswordDIVWindow) , _error);
                   document.getElementById(windowButtomContentId + changePasswordDIVWindow).innerHTML = getChangePasswordAddOn(changePasswordWindowWidth);
                   if (XMLHttpRequestObject.responseText == userNotFound) {
                	   document.getElementById('chOPassword').focus();
                   }
               }
			   killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {
                document.getElementById(windowContentId + changePasswordDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                if (document.getElementById(windowButtomContentId + changePasswordDIVWindow) != undefined) {
                	document.getElementById(windowButtomContentId + changePasswordDIVWindow).innerHTML = '';
                }	                    
            } else {
            	alert("There was a problem retrieving the XML data!");
            }
		};
	XMLHttpRequestObject.send(null);
	}     	 
};
function requestForgottenPassword() {	
	if (!forgottenPasswordRequestFormOK(windowContentId + forgottenPasswordRequestDIVWindow, forgottenPasswordRequestErrMsgId)) return false;		
	var XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {
		var backupData = document.getElementById(windowContentId + forgottenPasswordRequestDIVWindow).innerHTML;
        var _error = '';		
		var _userName = document.getElementById('fpUsername').value;
		var _email = document.getElementById('fpEmail').value;
 		var url = encodeURI(contextRoot + 'usr-mgr?a=fpr&sId=' + sessionId + '&fpu=' + _userName + '&fpem=' + _email + '&sync=' + Math.random());                 		

 		XMLHttpRequestObject.open("GET", url);
        XMLHttpRequestObject.onreadystatechange = function() {
	        if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
               		sessionTimeOutOperation();
    			} else if (XMLHttpRequestObject.responseText == systemError){
               		_error = 'Възникна системна грешка!';	               		
               	} else if (XMLHttpRequestObject.responseText == invalidParameters){
//               		_error = 'Некоректни параметри!';	
					invalidParametersOperation();
               	} else if (XMLHttpRequestObject.responseText == userNotFound){	
               		_error = 'Не е намерен потребител с такова<br>потребителско име и е-поща!';
               	} else if (XMLHttpRequestObject.responseText == userStatusNotActive) {
					_error = 'Статуса на потребителят не е активен!';
				} else if (XMLHttpRequestObject.responseText == emailWasNotSent) {
					_error = 'Възникна грешка при изпращането на е-поща!';					
				} else if (XMLHttpRequestObject.responseText == responseSuccess) {
					document.getElementById(windowButtomContentId + forgottenPasswordRequestDIVWindow).innerHTML = getForgottenPasswordRequestSuccessButtonsAddOn(forgottenPaswordRequestWindowWidth);					
					document.getElementById(windowContentId + forgottenPasswordRequestDIVWindow).innerHTML = getMessageHTML(infoType, forgottenPasswordRequestErrMsgId);
					showSystemMessageWithoutResizing(infoType, forgottenPasswordRequestErrMsgId, (windowContentId + forgottenPasswordRequestDIVWindow) , '<br>Успешно ви е изпратена е-поща със специален<br> линк за възобновяване на вашата парола!<br>&nbsp;');
               	} else {
               		_error = 'Възникна системна грешка!';
               	}
				if (_error.length > 0) {            	
					document.getElementById(windowContentId + forgottenPasswordRequestDIVWindow).innerHTML = getForgottenPasswordRequestFormFields();						
					restoreRequestForgottenPasswordData(backupData, _userName, _email);					
//					document.getElementById(forgottenPasswordRequestErrMsgId).innerHTML = _error;    
					showSystemMessage(errorType, forgottenPasswordRequestErrMsgId, (windowContentId + forgottenPasswordRequestDIVWindow) , _error);
					document.getElementById(windowButtomContentId + forgottenPasswordRequestDIVWindow).innerHTML = getForgottenPasswordRequestButtonsAddOn(forgottenPaswordRequestWindowWidth);
				}
            killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {             
				document.getElementById(windowContentId + forgottenPasswordRequestDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                if (document.getElementById(windowButtomContentId + forgottenPasswordRequestDIVWindow) != undefined) {
                	document.getElementById(windowButtomContentId + forgottenPasswordRequestDIVWindow).innerHTML = '';
                }				
			} else { 
            	alert('There was a problem retrieving the XML data!');
          	}
		};
	XMLHttpRequestObject.send(null);
	}
	return true;
};

function sendForgottenPasswordNewData() {	
	if (!forgottenPasswordSetNewDataFormOK(windowContentId + forgottenPasswordSetNewDataDIVWindow, forgottenPasswordSetNewDataErrMsgId)) return false;		
	var XMLHttpRequestObject = getXMLHttpRequestObject();
	if (XMLHttpRequestObject) {
		var backupData = document.getElementById(windowContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML;
        var _error = '';		
		var _userName = document.getElementById('fpnUsername').value;
		var _password = document.getElementById('fpnPassword').value;
		var _rpassword = document.getElementById('fpnRPassword').value;
 		var url = encodeURI(contextRoot + 'usr-mgr?a=fpn&sId=' + sessionId + '&fpu=' + _userName + '&fpsw=' + Base64.encode(_password) + '&frpsw=' + Base64.encode(_rpassword) + '&sync=' + Math.random());                 		

 		XMLHttpRequestObject.open("GET", url);
        XMLHttpRequestObject.onreadystatechange = function() {
	        if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
    				moduleCloseOperation();    																
    			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) {
               		sessionTimeOutOperation();
    			} else if (XMLHttpRequestObject.responseText == systemError){
               		_error = 'Възникна системна грешка!';	               		
               	} else if (XMLHttpRequestObject.responseText == invalidParameters){
//               		_error = 'Некоректни параметри!';	
					invalidParametersOperation();
               	} else if (XMLHttpRequestObject.responseText == userNotAssociactedWithOperation){	
               		_error = 'Въведеното потребителско име не е асоциирано<br>с операцията по възобновяване на вашата парола!';               		
               	} else if (XMLHttpRequestObject.responseText == userNotFound){	
               		_error = 'Не е намерен потребител с такова потребителско име!';
              	} else if (XMLHttpRequestObject.responseText == passwordEmpty) {
            		_error = 'Моля въведете парола!';            		
                } else if (XMLHttpRequestObject.responseText == passwordTooShort) {
                	_error = 'Моля въведете парола с дължина поне 6 символа!';
                } else if (XMLHttpRequestObject.responseText == retypedPasswordEmpty) {
                	_error = 'Моля въведете "Повтори нова парола"!';
                } else if (XMLHttpRequestObject.responseText == passwordNotMatch) {
                	_error = 'Моля попълнете полетата "Нова парола"<br>и "Повтори нова парола"!';               		
               	} else if (XMLHttpRequestObject.responseText == userStatusNotActive) {
					_error = 'Статуса на потребителят не е активен!';
				} else if (XMLHttpRequestObject.responseText == emailWasNotSent) {
					_error = 'Възникна грешка при изпращането на е-поща!';					
				} else if (XMLHttpRequestObject.responseText == responseSuccess) {
					document.getElementById(windowButtomContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getForgottenPasswordNewDataSuccessButtonsAddOn(forgottenPaswordSetNewDataWindowWidth);					
//					document.getElementById(windowContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getWindowContentSimpleText("Вашата парола е успешно възобновена!");
					document.getElementById(windowContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getMessageHTML(infoType, forgottenPasswordSetNewDataErrMsgId);
					showSystemMessageWithoutResizing(infoType, forgottenPasswordSetNewDataErrMsgId, (windowContentId + forgottenPasswordSetNewDataDIVWindow) , '<br>Вашата парола е успешно възобновена!<br>&nbsp;');

               	} else {
               		_error = 'Възникна системна грешка!';
               	}
				if (_error.length > 0) {            	
					document.getElementById(windowContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getForgottenPasswordSetNewDataFormFields();	
					restoreForgottenPasswordNewData(backupData, _userName);					
//					document.getElementById(forgottenPasswordSetNewDataErrMsgId).innerHTML = _error;
					showSystemMessage(errorType, forgottenPasswordSetNewDataErrMsgId, (windowContentId + forgottenPasswordSetNewDataDIVWindow) , _error);
					document.getElementById(windowButtomContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getForgottenPasswordSetNewDataButtonsAddOn(forgottenPaswordSetNewDataWindowWidth);
				}
            killXML(XMLHttpRequestObject);
			} else if (XMLHttpRequestObject.readyState != 0) {             
				document.getElementById(windowContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = getAjaxLoader('проверка на данните...');
                if (document.getElementById(windowButtomContentId + forgottenPasswordSetNewDataDIVWindow) != undefined) {
                	document.getElementById(windowButtomContentId + forgottenPasswordSetNewDataDIVWindow).innerHTML = '';
                }				
			} else { 
            	alert('There was a problem retrieving the XML data!');
          	}
		};
	XMLHttpRequestObject.send(null);
	}
	return true;
};

function askForUnregister() {
	if (confirm("Сигурни ли сте, че искате да бъдете отрегистриран от системата?")) {
		XMLHttpRequestObject = getXMLHttpRequestObject();
		if (XMLHttpRequestObject) {    			
			
			var url = encodeURI(contextRoot + 'usr-mgr?a=unsbcr&sId=' + sessionId + '&sync=' + Math.random());  
            XMLHttpRequestObject.open("GET", url);
           	XMLHttpRequestObject.onreadystatechange = function() {
             	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
	    				moduleCloseOperation();    																
	    			} else if (XMLHttpRequestObject.responseText == sessionTimeOut) { 
	    				sessionTimeOutOperation();            		                		             		                		                		
	                } else if (XMLHttpRequestObject.responseText == systemError) {
                		alert('Възникна грешка в системата!');
                	} else if (XMLHttpRequestObject.responseText == invalidParameters) { 
//                		alert('Некоректни параметри!');                		
						invalidParametersOperation();
                	} else if (XMLHttpRequestObject.responseText == userNotFound) { 
                		alert('Не е намерен такъв потребител в ситемата!');   
                	} else if (XMLHttpRequestObject.responseText == communicationError) { 
                		alert('Възникна комуникационна грешка!');   
                	} else if (XMLHttpRequestObject.responseText == invalidCommunicationParameter) { 
                		alert('Некоректни комуникационни параметри!');                   		
                	} else {
                		var response = null;
		            	if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
		            	response = XMLHttpRequestObject.responseXML.documentElement;	            	          			            	
		            	if (response != null) { 
		            		if (response.childNodes[0] != undefined) {
		            			sessionId = response.childNodes[0].firstChild.data;
								if (document.getElementById('topLinks') != undefined) {
									document.getElementById('topLinks').innerHTML = getAnonymousTopLinks();
//									document.getElementById('topLinks').innerHTML = '';
								}

			            		userLogged = false;				                   
		            		} else {
		            			alert('Възникна грешка в системата!');
		            		}
		        			if (response.childNodes[1] != undefined && response.childNodes[1].firstChild != undefined) {
		        				_fromDate = response.childNodes[1].firstChild.data;
								document.getElementById('fromDate').value = _fromDate;	
								getFilterParameters(filterFromDate, _fromDate);
		        			}
						} else {
							alert('Възникна грешка в системата!');
						}
		            	generalInit();
                 	}
                   	killXML(XMLHttpRequestObject);
               	} else if (XMLHttpRequestObject.readyState != 0) {                      					
               	} else {
                   	alert("There was a problem retrieving the XML data!");
               	}
           	};
		XMLHttpRequestObject.send(null);
		}
	} else {
		return false;
	}
};
function logoutUser() {
	var success = false;
	var backLogoutLink = (document.getElementById('topLinksLogoutParentId') != undefined) ? document.getElementById('topLinksLogoutParentId').innerHTML : '';
	if (userLogged) {
		XMLHttpRequestObject = getXMLHttpRequestObject();		
		if (XMLHttpRequestObject) {               
       		if (document.getElementById('topLinksLogoutParentId') != undefined) {
       			document.getElementById('topLinksLogoutParentId').innerHTML = '<table id="topLinksLogout" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="logoutUser();" onmouseover="this.className=\'top-links-hover\';" onmouseout="this.className=\'\';"><tr><td width="65" align="center"><img src="images/progress-anim.gif" width="16" style="padding-top:1px"></td></tr></table>';
       		}					
            var url = encodeURI(contextRoot + 'logout?a=l&sId=' + sessionId + '&sync=' + Math.random()); 
             				       	
            XMLHttpRequestObject.open("GET", url);
           	XMLHttpRequestObject.onreadystatechange = function() {
             	if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	    			if (XMLHttpRequestObject.responseText == moduleClosedErrCode) {
	    				moduleCloseOperation();    																
	    			} else if (XMLHttpRequestObject.responseText == systemError) {
                		alert('Възникна грешка в системата!');
                	} else if (XMLHttpRequestObject.responseText == invalidParameters) { 
//                		alert('Некоректни параметри!');                		
						invalidParametersOperation();
                	} else if (XMLHttpRequestObject.responseText == '0') { 
                		alert('Не е намерен такъв потребител в ситемата!');   
                	}  else if (XMLHttpRequestObject.responseText == communicationError) { 
                		alert('Възникна комуникационна грешка!'); 
                	} else if (XMLHttpRequestObject.responseText == invalidCommunicationParameter) { 
                		alert('Грешни комуникационни параметри!');                		                		             		                		                		               		                		             		                		                		               		                		             		                		                		               		                		             		                		
                	} else {
                		var response = null;
		            	if (_ie) XMLHttpRequestObject.responseXML.loadXML(XMLHttpRequestObject.responseText);	            		            		
		            	response = XMLHttpRequestObject.responseXML.documentElement;	            	          			            	
		            	if (response != null) { 	            		      	 	 
			            	sessionId = response.childNodes[0].firstChild.data;	
							if ('true' == response.childNodes[1].firstChild.data) {
								// clearAll();  
							}
		        			if (response.childNodes[2] != undefined && response.childNodes[2].firstChild != undefined) {
		        				_fromDate = response.childNodes[2].firstChild.data;
								document.getElementById('fromDate').value = _fromDate;	
								getFilterParameters(filterFromDate, _fromDate);
		        			}
						}
						if (document.getElementById('topLinks') != undefined) {
							document.getElementById('topLinks').innerHTML = getAnonymousTopLinks();
						}
						userLogged = false; 						
						generalInit();
						success = true;
						if (document.getElementById('lhpUsername') != undefined) {
							document.getElementById('lhpUsername').value =(getIBSCookie(cookieUsernameKey) != null) ? getIBSCookie(cookieUsernameKey) : '';
						}
                 	}				
                   	killXML(XMLHttpRequestObject);
                   	if (!success) {
                   		if (document.getElementById('topLinksLogoutParentId') != undefined) {
                   			document.getElementById('topLinksLogoutParentId').innerHTML = backLogoutLink;
                   		}					                   		                   		
                   	}
               	} else if (XMLHttpRequestObject.readyState != 0) {               					
               	} else {
                   	alert("There was a problem retrieving the XML data!");
               	}
           	};
		XMLHttpRequestObject.send(null);
		}
	}
};
function updateUsername() {    
	if (document.getElementById('userNameLabel') != undefined) {
		document.getElementById('userNameLabel').innerHTML = loadedEditData[3];
	}
};
function switchPreviewToEdit() {
	document.getElementById(windowContentId + profileDIVWindow).innerHTML = getProfileEditFormFields();
	loadProfileEditFormData();
	document.getElementById(windowButtomContentId + profileDIVWindow).innerHTML = getProfileSubmitAddOn(profileWindowWidth);
	document.getElementById('eFirstName').focus();
	checkState('е');
};

function loadProfileEditFormData() {
   	document.getElementById('eFirstName').value = loadedEditData[0];
   	document.getElementById('eLastName').value = loadedEditData[1];
   	document.getElementById('eEmail').value = loadedEditData[2];
   	document.getElementById('eUsername').value = loadedEditData[3];
   	document.getElementById('ePhone').value = loadedEditData[4];
};  

function loadProfilePreviewFields(arr){
	if (arr.length == 5) {
		document.getElementById('erFirstName').innerHTML = arr[0];
		document.getElementById('erLastName').innerHTML = arr[1];
		document.getElementById('erEmail').innerHTML = arr[2];
		document.getElementById('erUsername').innerHTML = arr[3];	  	
		document.getElementById('erPhone').innerHTML = arr[4];	 
	}
};
function getAuthorizedTopLinks(username) {
	var str = new StringBuffer();
	str.append('<table cellpadding="0" cellspacing="0" border="0" width="350" align="right">');
	str.append('<tr valign="middle">');
	str.append('<td class="top-type2" style="padding-bottom: 2px;" width="110" align="right">&nbsp;<span id="userNameLabel">' + username + '</span>&nbsp;&nbsp;</td>');
	str.append('<td><img src="images/top_links_separator.gif" border="0" width="1" height="20"></td>');
	str.append('<td>');
	str.append('<table id="topLinksPayment" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="this.className=\'top-links-hover\'; showWindow(' + payments + ');" onmouseover="this.className=\'top-links-hover\';" onmouseout="if (!paymentsWindowShown && !paymentDetailsWindowShown) {this.className=\'\'};">');
	str.append('<tr>');
	str.append('<td width="8"></td>');
	str.append('<td><img src="images/icon_payment.gif" border="0" width="16" height="20"></td>');
	str.append('<td width="6"></td>');
	str.append('<td class="top-type2" style="padding-bottom: 2px;">плащания</td>');
	str.append('<td width="10"></td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td>');
	str.append('<td width="1"><img src="images/top_links_separator.gif" border="0" width="1" height="20"></td>');
	str.append('<td align="left">');
	str.append('<table id="topLinksProfile" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="this.className=\'top-links-hover\'; showWindow(' + profile + ');" onmouseover="this.className=\'top-links-hover\';" onmouseout="if (!profileWindowShown) {this.className=\'\'};">');
	str.append('<tr>');
	str.append('<td width="8"></td>');
	str.append('<td><img src="images/icon_profile.gif" border="0" width="14" height="20"></td>');
	str.append('<td width="6"></td>');
	str.append('<td class="top-type2" style="padding-bottom: 2px;">профил</td>');
	str.append('<td width="2"></td>');
	str.append('<td width="4"><img src="images/empty.gif" width="4" height="20"></td>');							                          									                          								
	str.append('</tr>');
	str.append('</table>');			                          						
	str.append('</td>');
	str.append('<td width="1"><img src="images/top_links_separator.gif" border="0" width="1" height="20"></td>');
	str.append('<td align="left">');
	str.append('<table id="topLinksLogout" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="logoutUser();" onmouseover="this.className=\'top-links-hover\';" onmouseout="this.className=\'\';">');
	str.append('<tr>');
	str.append('<td width="8"></td>');
	str.append('<td><img src="images/icon_logout.gif" border="0" width="13" height="20"></td>');
	str.append('<td width="6"></td>');
	str.append('<td class="top-type2" style="padding-bottom: 2px;">изход</td>');
	str.append('<td width="2"></td>');
	str.append('<td width="4"><img src="images/empty.gif" width="4" height="20"></td>');			                          	                          
	str.append('</tr>');
	str.append('</table>');			                          		
	str.append('</td>');			                          		
	str.append('</tr>');			                          
	str.append('</table>');	                           
	return str.toString();
};
function getAnonymousTopLinks() {
	var str = new StringBuffer();
	str.append('<table cellpadding="0" cellspacing="0" border="0" width="170" align="right">');
	str.append('<tr valign="middle">');	
	str.append('<td><img src="images/top_links_separator.gif" border="0" width="1" height="20"></td>');
	str.append('<td>');
	str.append('<table id="topLinksLogin" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="this.className=\'top-links-hover\'; showWindow(' + login + ');" onmouseover="this.className=\'top-links-hover\';" onmouseout="if (!loginWindowShown) {this.className=\'\'};">');
	str.append('<tr>');
	str.append('<td width="8"></td>');
	str.append('<td><img src="images/icon_login.gif" border="0" width="16" height="20"></td>');
	str.append('<td width="6"></td>');
	str.append('<td class="top-type2" style="padding-bottom: 2px;">вход</td>');
	str.append('<td width="10"></td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td>');
	str.append('<td width="1"><img src="images/top_links_separator.gif" border="0" width="1" height="20"></td>');
	str.append('<td align="left">');
	str.append('<table id="topLinksRegistration" cellpadding="0" cellspacing="0" border="0" style="cursor: pointer;" onclick="this.className=\'top-links-hover\'; showWindow(' + registrationConfirmTerms + ');" onmouseover="this.className=\'top-links-hover\';" onmouseout="if (!(registrationConfirmTermsWindowShown || registrationSubmitWindowShown || registrationSuccessWindowShown)) {this.className=\'\'};">');
	str.append('<tr>');
	str.append('<td width="8"></td>');
	str.append('<td><img src="images/icon_registration.gif" border="0" width="14" height="20"></td>');
	str.append('<td width="6"></td>');
	str.append('<td class="top-type2" style="padding-bottom: 2px;">регистрация</td>');
	str.append('<td width="2"></td>');
	str.append('<td width="4"><img src="images/empty.gif" width="4" height="20"></td>');							                          									                          								
	str.append('</tr>');
	str.append('</table>');			                          						
	str.append('</td>');		                          	                          
	str.append('</tr>');
	str.append('</table>');			                          		
	str.append('</td>');			                          		
	str.append('</tr>');			                          
	str.append('</table>');	                           
	return str.toString();
};
function getHomePageLoginTitleInfo() {
	var str = new StringBuffer();
	str.append('[&nbsp;Вход в системата&nbsp;]');
	return str.toString();	
};
function getHomePageProfileTitleInfo(username) {
	var str = new StringBuffer();
	str.append('[&nbsp;Потребител:&nbsp;');
	str.append(username);
	str.append('&nbsp;]');
	return str.toString();	
};
function getHomePageProfileInfo(name, accessLevel) {
	var str = new StringBuffer();
	str.append('<table border="0" cellspacing="0" cellpadding="0" width="220" height="100">');
	str.append('<tr>');
	str.append('<td colspan="2" height="30"></td>');
	str.append('</tr>');
	str.append('<tr>');
	str.append('<td width="100%" align="center">');
	str.append('<table class="homePage-profile" border="0" cellspacing="0" cellpadding="0" width="220" height="100">');
	str.append('<tr>');
	if(accessLevel == 1) {
		str.append('<td width="45%" align="center"><a href="admin/index.jsp"><img src="images/admin.png" border="0" width="61" height="68"></a></td>');
	} else {
		str.append('<td width="45%" align="center"><img src="images/icon_profile_big.png" width="61" height="68"></td>');
	}
	str.append('<td width="55%" align="left">Добре дошли,<br>');
	str.append(name);
	str.append('!</td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td>');
	str.append('<td>&nbsp;&nbsp;</td>');
	str.append('</tr>');
	str.append('</table>');
	return str.toString();
};

