$doc = function(name){return document.getElementById(name);}
function active(obj){if(obj)obj.focus()}

function empty(val, mn,mx)
{
	val = val.replace(/([ \n\r])?/ig,""); 
	if(val.length==0) return true;
	if((typeof mn != 'undefined') && (val.length < mn)) return true;
	if((typeof mx != 'undefined') && (val.length > mx)) return true;
	return false;
}

function check_email(val)
{
	re = /^[-_+\.a-z0-9&']+@[-a-z0-9]+\.[a-z]+.$/ig;      
	res = val.match(re);
	return res;
}

function show_statica(res)
{
	if(res['msg'])	alert(res['msg']);
	if(!res || !res['id']) return;

	if((obj = $doc(res['id'])))
	{
		if(		res['txt'])obj.innerHTML = res['txt'];
		if(		res['scrp'])
		eval(	res['scrp']);
	}
}


function validate(frm_id)
{
	save_height = $('#body_cont').height();
	
	all = $("#frm_cls_" + frm_id +" input").serialize();
	allsel = $("#frm_cls_" + frm_id +" select").serialize();
	all += '&'+allsel
	alert(all);
	if(onReq(frm_id)==false) return false;
	$('#res_table').show();
	$('#main_view').hide();
	$('#data').html('<div id="loader"><p><img src="/img/loading.gif" alt="Загрузка" /></p></div>');
	$('#data').load('/common/online.php?'+all, '', show_forms);

	//$('#body_cont').height('550px')
	//alert()
	return false;
}

function show_forms()
{
}

function close_result()
{
	$('#res_table').hide();
	$('#main_view').show();
	//$('#body_cont').height(save_height+'px')
	return false;
}

function send_mail()
{
	all = $('#fmsg').serialize();
	$('#feedbackForm').load('/common/sendmail.php?'+all, '', show_forms);
	return false;
}

