function elem(id) { return document.getElementById(id); }

function reg(reg) { return new RegExp(reg); }

function validator(val, reg, console, errortext, submit) {
	if(reg.test(val)) {
		console.innerHTML = '';
		if(submit) submit.disabled = '';
	} else {
		console.innerHTML = errortext;
		if(submit) submit.disabled="disabled";
	}
}

function show_comment(id,id2){
	if(document.getElementById(id).style.display=="none"){
		document.getElementById(id).style.display="";
	} else {
		document.getElementById(id).style.display="none";
	}
	return true;
}
function hidden_comment(id,id2){
	if(document.getElementById(id).style.display=="hidden"){
		document.getElementById(id).style.display="";
	} else {
		document.getElementById(id).style.display="hidden";
	}
	return true;
}

function return_search(value) {
    document.search_item.search.value=value;
    document.getElementById('search').focus();
}

$(document).ready(function(){
	if ($.browser.msie){
		$('ul.menu li>span.corners-top').each(function(i){
			$(this).css('width',$(this).parent().find('dt').get(0).offsetWidth-12);
		});
		if ($.browser.version == '6.0'){
			var t = null;
			$('ul.menu>li').hover(
			function(){
				if (t) {
					clearTimeout(t);
				}
				$('ul.menu>li').not(this).removeClass('hover');
				$(this).addClass('hover');
			},
			function(){
				var el = $(this);
				t = setTimeout(function(){
					el.removeClass('hover');
				},500);
			});
		}
	}
	var thide = false;

	if ($.browser.msie){
		$('.marker').hover(
		function(){
			$(this).addClass('hover');
			$(this).find('dt').css('width',$(this).find('span.title').get(0).offsetWidth);
		},
		function(){
			$(this).removeClass('hover');
		});
	}

	$('div.cloud ul:eq(1)').hide();

	var fbwrap = $('<div class="show-container"></div>').css({'display':'none'}).appendTo($(document.body));
	var fbbg = $('<div class="bg"></div>').css({'opacity': 0.8}).click(function(){
		fbwrap.css({'display':'none'});
	}).appendTo(fbwrap);
});
