
	function checkRegForm ()
	{
		document.reg_form.fSend.value = 1;
		document.reg_form.submit();
	}	


	function checkLoginForm()
	{
		document.login_form.fSend.value = 1;
		document.login_form.submit();
	}

	function checkOptionsForm()
	{
		document.options_form.fSend.value = 1;
		document.options_form.submit();
	}
	
	function checkCategoryBusinessAddForm(val)
	{
		document.category_business_add_form.fSend.value = val;
		document.category_business_add_form.submit();
	}

	function checkCategoryEditForm()
	{
		document.category_edit_form.fSend.value = 1;
		document.category_edit_form.submit();
	}


	function addModerator()
	{
		document.moderators_form.operation.value = 'add_moderator';
		document.moderators_form.submit();
	}

	function removeModerator(moderator_id)
	{
		document.moderators_form.operation.value = 'remove_moderator';
		document.moderators_form.moderator_id.value = moderator_id;
		document.moderators_form.submit();
	}

	
	function checkUploadForm()
	{
		if (document.getElementById('file_photo').value == '')
		{
			alert('Please select a photo to upload.');
			return false;
		}	
		else
		{
			document.upload_form.fUpload.value = 1;
			return true;
		}	
		
	}	
	
	function checkMail()
	{
		document.add_form.operation.value = 'mail_me';
		document.add_form.submit();
	}

	function checkReviewAddForm()
	{
		document.review_add_form.fSend.value = 1;
		document.review_add_form.submit();
	}

	
	function checkReviewUploadForm()
	{

		document.review_upload_form.fUpload.value = 1;
		return true;
	
	}
	
	function checkSplashUploadForm()
	{

		document.splash_upload_form.fUpload.value = 1;
		document.splash_upload_form.submit();
	
	}
	

	function checkBusinessAddForm()
	{
		document.business_form.fSend.value = 1;
		document.business_form.submit();
	}

	function checkBusinessEditForm()
	{
		document.business_form.fSend.value = 1;
		document.business_form.submit();
	}
	
	function checkSplashEditForm()
	{
		document.splash_form.fSend.value = 1;
		document.splash_form.submit();
	}

	function checkLinkEditForm()
	{
		document.link_form.fSend.value = 1;
		document.link_form.submit();
	}
	
	function checkCategoryAddForm()
	{
		document.category_form.fSend.value = 2;
		document.category_form.submit();
	}

	function checkCommentForm()
	{
		document.add_form.operation.value = 'comment_add';
		document.add_form.submit();
	}

	function checkPostForm()
	{
		document.add_form.operation.value = 'post_add';
		document.add_form.submit();
	}

	function switchMeasurements()
	{
		document.options_form.switchUnits.value = 1;
		document.options_form.submit();
	}
	
	function switchMeasurementsReview()
	{
		document.review_add_form.switchUnits.value = 1;
		document.review_add_form.fSend.value = 1;
		document.review_add_form.action = '#measurements';
		document.review_add_form.submit();
	}

	
	function sortItems()
	{
		document.sort_form.submit();
	}	


	function switchUnits()
	{
		document.reviews_form.operation.value = 'switch_unit';
		document.reviews_form.submit();
	}
	
	function deleteReview(review_id)
	{
		if (1 == confirm("Remove this review?"))
		{
			document.reviews_form.operation.value = 'review_del';
			document.reviews_form.review_id.value = review_id;
			document.reviews_form.submit();
		}
	}

	function deleteComment(comment_id)
	{
		if (1 == confirm("Remove this comment?"))
		{
			document.comments_form.operation.value = 'comment_del';
			document.comments_form.comment_id.value = comment_id;
			document.comments_form.submit();
		}
	}


	function deletePost(post_id)
	{
		if (1 == confirm("Remove this post?"))
		{
			document.posts_form.operation.value = 'post_del';
			document.posts_form.post_id.value = post_id;
			document.posts_form.submit();
		}
	}


	function deleteModPost(post_id)
	{
		if (1 == confirm("Remove this post?"))
		{
			document.posts_form.operation.value = 'mod_post_del';
			document.posts_form.post_id.value = post_id;
			document.posts_form.submit();
		}
	}
	
	
	function deleteSplashPhoto(photo_id)
	{
		if (1 == confirm("Remove this photo?"))
		{
			document.splash_form.operation.value = 'splash_delete';
			document.splash_form.photo_id.value = photo_id;
			document.splash_form.submit();
		}
	}


	function editComment(comment_id, url)
	{
		document.comments_form.operation.value = 'comment_edit';
		document.comments_form.comment_id.value = comment_id;
		document.comments_form.redirect_url.value = url;
		document.comments_form.submit();
	}

	function editPost(post_id, url)
	{
		document.posts_form.operation.value = 'post_edit';
		document.posts_form.post_id.value = post_id;
		document.posts_form.redirect_url.value = url;
		document.posts_form.submit();
	}




	function checkThreadAddForm()
	{
		document.talk_thread_add.operation.value = 'talk_thread_add';
		document.talk_thread_add.submit();
	}

	function report(operation, id, url)
	{
		switch (operation)
		{
			case 'review_report':
			{
				document.reviews_form.operation.value = operation;
				document.reviews_form.review_id.value = id;
				document.reviews_form.redirect_url.value = url;
				document.reviews_form.submit();
				break;
			}	

			case 'comment_report':
			{
				document.comments_form.operation.value = operation;
				document.comments_form.comment_id.value = id;
				document.comments_form.redirect_url.value = url;
				document.comments_form.submit();
				break;
			}

			case 'profile_report':
			{
				document.profile_report_form.operation.value = operation;
				document.profile_report_form.author_id.value = id;
				document.profile_report_form.redirect_url.value = url;
				document.profile_report_form.submit();
				break;
			}

			case 'post_report':
			{
				document.posts_form.operation.value = operation;
				document.posts_form.post_id.value = id;
				document.posts_form.redirect_url.value = url;
				document.posts_form.submit();
				break;
			}

		}
	}



	function removeBusinessCategory(gender, category_id)
	{
		document.business_category_form.operation.value   = 'remove_category';
		document.business_category_form.gender.value      = gender;
		document.business_category_form.category_id.value = category_id;
		document.business_category_form.submit();
	}

	function addBusinessCategory(gender)
	{
		if (gender == 1)
		{
			document.business_category_form.operation.value = 'add_women_category';
			document.business_category_form.category_id.value = document.business_category_form.women_category_id.value;
		}
		else
		{
			document.business_category_form.operation.value = 'add_men_category';
			document.business_category_form.category_id.value = document.business_category_form.men_category_id.value;
		}	
		
		document.business_category_form.submit();
	}

	function vote(review_id, is_helpfull)
	{
		var ind = 'helpfull_' + review_id;
		
		// Создаем новый объект JSHttpRequest.
		var req = new Subsys_JsHttpRequest_Js();

		// Код, АВТОМАТИЧЕСКИ вызываемый при окончании загрузки.
		req.onreadystatechange = function()
		{
			if (req.readyState == 4)
			{
				if (req.responseJS)
				{
					// Записываем в <div> результат работы.
					document.getElementById(ind).innerHTML = (req.responseJS.content||'');
				}
			}
		}
		
		// Разрешаем кэширование (чтобы при одинаковых запросах
		// не обращаться к серверу несколько раз).
		req.caching = false;
		//alert(ind);
		// Подготваливаем объект.
		req.open('POST', '/libs/JsHttpRequest_helpfull_vote.php', true);
		// Посылаем данные запроса (задаются в виде хэша).

		req.send({review_id: review_id, is_helpfull: is_helpfull});

	}
	


	function checkAdminCategoryForm(val)
	{
		if(val == 1)
		{
			document.admin_category_form.operation.value = 'approve';
		}
		else
		{
			document.admin_category_form.operation.value = 'deny';
		}	
		
		document.admin_category_form.submit();
	}


	function checkMoreratorReportsForm(val)
	{
		
		if(val == 1)
		{
			document.mod_report_form.operation.value = 'ignore';
		}
		else
		{
			document.mod_report_form.operation.value = 'remove';
		}

		document.mod_report_form.submit();
	}


	function checkAdminUserForm(val)
	{
		if(val == 1)
		{
			document.admin_user_form.operation.value = 'approve';
		}
		else
		{
			document.admin_user_form.operation.value = 'deny';
		}

		document.admin_user_form.submit();
	}

	function checkModBusinessForm(val)
	{
		if(val == 1)
		{
			document.mod_business_form.operation.value = 'approve';
		}
		else
		{
			document.mod_business_form.operation.value = 'deny';
		}

		document.mod_business_form.submit();
	}

	function checkModLinkForm(val)
	{
		if(val == 1)
		{
			document.mod_link_form.operation.value = 'approve';
		}
		else
		{
			document.mod_link_form.operation.value = 'deny';
		}

		document.mod_link_form.submit();
	}
	
	
	function revertChanges(val)
	{
		document.mod_revert_form.queue_id.value = val;
		document.mod_revert_form.operation.value = 'revert';
		document.mod_revert_form.submit();
	}	


	function checkContactForm()
	{
		document.contact_form.operation.value = 'contact';
		document.contact_form.submit();
	}

	function checkTitleKeywordsForm()
	{
		document.title_and_keywords_form.operation.value = 'title_keywords';
		document.title_and_keywords_form.submit();
	}

	
	
	
