var waittext = "<div align=\"center\">Загружается...&nbsp;<img src=\"/inc/loading.gif\"></div>";var no_post_text = '<div align=\"center\">нет ни одного сообщения</div>';function no_post(n) {	switch (n) {		case 0:	{$('#waitTab').html(no_post_text); break;}		case 1:	{$('#accTab').html(no_post_text); break;}		case 2:	{$('#rejTab').html(no_post_text); break;}	}};function login() {	var user = encodeURI(document.getElementById('userLogin').value);	var psw = encodeURI(document.getElementById('pswLogin').value);	var nocache = Math.random();	$('#guru_content').html(waittext).load('/guru_func.php?act=in&user='+user+'&pass='+psw+'&nocache='+nocache);}function comment_login() {	var firm_id = document.getElementById('firm_id').value;	var login = encodeURI(document.getElementById('userLogin').value);	var psw = encodeURI(document.getElementById('pswLogin').value);	var nocache = Math.random();	$('#comment_body').html(waittext).load('/guru_func.php', {act: 'com_in', user: login, pass: psw, fi_id: firm_id, n: nocache});}function registerUser() {	$('#reg_result').html(waittext);	var user = encodeURI(document.getElementById('userReg').value);	var pass = encodeURI(document.getElementById('passReg').value);	var pass2 = encodeURI(document.getElementById('pass2Reg').value);	var fullname = encodeURI(document.getElementById('fullnameReg').value);	var email = encodeURI(document.getElementById('emailReg').value);//	var wmz = encodeURI(document.getElementById('wmzReg').value);	var yad = encodeURI(document.getElementById('yadReg').value);	var phone_no = encodeURI(document.getElementById('phoneReg').value);	var pay_to = $(":radio[name=pay_to]").filter(":checked").val();	var nocache = Math.random();	if (user=='' || pass=='') { // || fullname=='' || email=='' || yad=='' || phone_no==''		$("#reg_result").html('<span class="error_msg">Заполните все обязательные поля!</span>');	}	else if (pass != pass2) {		$("#reg_result").html('<span class="error_msg">Пароль и его повтор не совпадают!</span>');	}	else {		$("#reg_result").load('/guru_func.php?act=reg&user='+user+'&pass='+pass+'&fullname='+fullname+'&email='+email+'&yad='+yad+'&phone='+phone_no+'&pay_to='+pay_to+'&nocache='+nocache);	};}function send_post() {	var firm_id = document.getElementById('firm_id').value;	var caption = document.getElementById('post_caption').value;	var posttext = document.getElementById('post_text').value;	var nocache = Math.random();	$('#post_send_res').html(waittext).load("/guru_func.php", {act:"newpost", c: caption, t: posttext, fid: firm_id, n: nocache}, function() {		$('#post_send_res').html('<span class="ok_msg">Сообщение отправлено.</span>');		document.getElementById('do_post').reset();	});/**/}function show_post_form () {	$('#guru_action').html(waittext).load("/guru_func.php?act=postform","", function() {		$('#submit_post').click( send_post );	});/**/}function get_posts (st,pg) {	var s = "";	switch (st) {		case 0:	{s = "#wait"; break;}		case 1:	{s = "#acc"; break;}		case 2:	{s = "#rej"; break;}	}	$(s+'Post').load("/guru_func.php?act=getpost&st="+st+"&pg="+pg).hide().fadeIn('normal');	$(s+'Tab .post_page_list').removeClass('post_current_page');	$('#page_'+st+'_'+pg).addClass('post_current_page');}function change_page () {	var s = $(this).attr('id');	var stat = parseInt(s.substring(5,20));	var page = parseInt(s.substring(7,20));//	alert("Status: "+stat+" Page: "+page);	get_posts(stat,page);}function show_posts () {	$('#guru_action').html(waittext).load("/guru_func.php?act=viewpost","", function() {		$('#view_posts').tabs({ fxFade: true, fxSpeed: 'fast' });	});}function show_profile() {	$('#guru_action').html(waittext).load("/guru_func.php?act=show_profile");}function update_profile () {	var fn = document.getElementById('fullnamePrf').value;	var em = document.getElementById('emailPrf').value;	var ph = document.getElementById('phonePrf').value;//	var wz = document.getElementById('wmzPrf').value;	var yd = document.getElementById('yadPrf').value;	var pt = $(":radio[name=pay_to]").filter(":checked").val();	var nocache = Math.random();	$('#prf_result').html(waittext).load("/guru_func.php", {act:"upd_profile", fullname: fn, email: em, yad: yd, phone: ph, pay_to: pt, n: nocache}, function() {		$('#prf_result').html('<span class="ok_msg">Профиль обновлён.</span>');	});/**/}function init_login_reg() {	$('#log_reg').tabs({ fxFade: true, fxSpeed: 'fast' });	$('#buttonLogin').click ( login );	$('#buttonReg').click ( registerUser );}function do_in_reg () {	$().ready( function () {		$('#guru_content').load("/guru_func.php","", function() {			init_login_reg();			show_posts();		});	});};function set_firm_id ( fid ) {	$('#firm_id').val(fid);	$().ready( function () {		$('#submit_post').click( send_post );		$('#buttonLogin').click( comment_login );	});};
