// JavaScript Document

<!--//--><![CDATA[//><!--

function setSrch(btn) {
	switch(btn) {
		case 'oninet':
			document.getElementById('srch_form').action = 'http://www.google.ru/search?source=ig&hl=ru';
			document.getElementById('as_sitesearch').value = '';
			document.getElementById('srchfield').name = 'q';
		break;
		case 'onsite':
			document.getElementById('srch_form').action = 'http://www.google.ru/search?&hl=ru';
			document.getElementById('as_sitesearch').value = 'www.kemrsl.ru';
			document.getElementById('srchfield').name = 'as_q';
		break;
		default:
			document.getElementById('srch_form').action = 'http://phpopac.kemrsl.ru/elcat.php';
			document.getElementById('srchfield').name = 'term1';
	}	
	document.getElementById('onsite').className = "" ;
	document.getElementById('oninet').className = "" ;
	document.getElementById(btn).className = "active";
	document.getElementById('srchfield').focus();
}

last_factiv='f0';
function setImg(el) {
	document.getElementById(last_factiv).className = '';
	el.className = 'active';
	last_factiv = el.id;
	document.getElementById('main_img').src = el.href;
	document.getElementById('main_img_url').href = el.href.replace(/.jpg/gim,'_big.jpg');
}

function show(id) {
	document.getElementById(id).style.display = 'block';
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}

function ei_toggle(e) {
	$('.events-promo *').removeClass('show');
	$(e).addClass('show');
}

function mailform_add() {
   $.post("/maillist.php", {email:$('#email').val()},
    function(data){
    	if(data.res) {
    		$('#mailform').hide();
    		$('#maillist_err').hide();
    		$('#maillist_ok').show();
		} else {
    		$('#maillist_err').show();
		}
    }, "json");
}

function feedback_add(text, id) {
	$.post("/feedback.html?add=1", {"text":text, "id":id},
    function(data){
        if(data.res!=false) {
        	$('#feed_text').val('');
        	if($('#r'+data.res).html()) {
        		$('#r'+data.res).replaceWith(data.html);
			} else {
        		$('#feedback_row0').after(data.html);
			}
        	to_feedbackRow = setTimeout('$(".feedback_row").removeClass("new")', 3000);
        	//document.location = '/feedback.html';
		} else {
			alert('Введите текст сообщения');
		}
		$('.btn').removeAttr('disabled');
    }, "json");
}

//--><!]]>