function strrev( _str ) {
 var ret ='';

 for (x =_str.length-1; x >= 0; x--) {
	chr =_str.charAt(x)
	ret +=(chr == ' ' ? '@' : chr);
 }

 return ret;
} 

function emailinks() {
 $$('a.phbai').each( 
	function(a) {
		email =strrev(a.title);
		a.href ='mailto:' +email;
		a.title =email;
	} );

 $$('a.phba').each( 
	function(a) {
		email =strrev(a.innerHTML);
		a.innerHTML =email;
		a.href ='mailto:' +email;
	} );
}


function isInt(x) {
	var y=parseInt(x);
	if (isNaN(y)) return false;
	return x==y && x.toString()==y.toString();
} 

function CookieDelId( _cookie, _id ) {
	c1 =',,' +getCookie( _cookie ) +',,';
	c2 =c1.replace( ',' +_id +',', ','  );
	c3 =c2.replace( /,{2,3}/g, '' );
	setCookie( _cookie, c3, history_cookie_expiration, '' );
	return c3;
}

function CookieAddId( _cookie, _id ) {
	c =_id +(getCookie( _cookie ) ? ',' +CookieDelId( _cookie, _id ) : '');
	setCookie( _cookie, c, history_cookie_expiration, '' );
}

function HistoryAddUser( _id ) {
	CookieAddId( history_cookie_name, _id );
}

function HistoryDelAll() {
	if (window.confirm('Are you sure?')) {
		clearCookie( history_cookie_name, '' );
		$('historylist').style.display ='none';
	}
}

function HistoryDelUser( _id ) {
	if (_id == history_del_user_id) {
		id =history_del_user_id.substr(1);
		
		h =CookieDelId( history_cookie_name, id );
		if (h == '') {
			$('historylist').style.display ='none';
			return;
		}
		
		$('P'+id).style.display ='none';
		$('U'+id).style.display ='none';
	}
}