
var faqLastSelectedLink = null;

function changeStyle(elemId, newStyle) {
     document.getElementById(elemId).className=newStyle;
}

function faqSelectLink(elemId) {
   if(faqLastSelectedLink != null)
	faqLastSelectedLink.style.color="#8b8b8b";

   faqLastSelectedLink = $('#'+elemId).get(0);
   $.scrollTo(faqLastSelectedLink, 800);
   faqLastSelectedLink.style.color="#ff9000";
   return false;
}

function faqSelectUrlNamedAnchor() {
	if (window.location.hash)
    	faqSelectLink(faqGetElementId(window.location.hash));
}

function faqGetElementId(hash) {	
	return "link".concat(hash.substring(1)); 
}

function initLogInForm() {
	var jsOn = document.getElementById('jsOn');
	jsOn.value = "true";
	
	// cookies
	function get_cookie ( cookie_name ){
	 		var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
	 		if ( results )
	   		return ( unescape(results[2]).replace(/\"/g,'') );
	 		else
	   		return null;
	}
	
	var passHashVal = get_cookie('akondPasswordHash');
	var loginVal = get_cookie('akondRememberLogin');
		
	if (passHashVal != null && loginVal != null){
		document.getElementById('remember').checked = true;
		document.getElementById('passwdHash').value = passHashVal;				
		document.getElementById('login').value = loginVal;
				
		var passLengthVal = get_cookie('akondPasswordLength');
		if (passLengthVal != null){
			var pass = "";
			for (var i=0; i < passLengthVal; i++) {
				pass += '*';
			}
			document.getElementById('passwd').value = pass;
		}
	}	
}

