$.preloadImages = function() {
	for (var i = 0; i<arguments.length; i++) {
		img = new Image();
		img.src = arguments[i];
	}
}

function CheckRequestForm()
{

	if (document.requestform.OrgName.value=="")
	{
		alert('Введите название своей организации!');
		return false;
	}
	if (document.requestform.ContactName.value=="")
	{
		alert('Введите имя контактного лица!');
		return false;
	}

	if (document.requestform.OrgPhone.value=="")
	{
		alert('Введите контактный телефон!');
		return false;
	}

	if (document.requestform.OrgEmail.value=="")
	{
		alert('Введите контактный Email!');
		return false;
	}

	if (document.requestform.OrgEmail.value=="@")
	{
		alert('Введите контактный Email!');
		return false;
	}

	if (document.requestform.keystring.value=="")
	{
		alert('Введите код с картинки!');
		return false;
	}

	return true;
}


function otherChecked(radioObj)
{
	if(!radioObj)
		return;
	var radioLength = document.Poll.poll_voteNr.length;
	if(document.Poll.poll_voteNr[radioLength-1].checked == true)
	 {
		 alert('OK');
	 }
}


function NextManager(id)
{	
	//alert(id);
	document.getElementById("faces").innerHTML=arrmans[id-1];
}


function viewimage(file_name,w,h) {
	$('#big_image').attr("src",file_name);
	$('#big_image').attr("width",w);
	$('#big_image').attr("height",h);

	$('#big_image_holder').css('width',w+20);
	$('#big_image_holder').css('height',h+17);
	
	var windowWidth = $(window).width();
 
    $('#big_image_holder').css({
        "position" : "absolute",
        "left" : windowWidth / 2 - w / 2,
        "top" : 150
    });	
	
	$('#big_image_holder').css('display','block');

}

function hide_pic() {
	$('#big_image_holder').css('display','none');
}

function Calculator() {
	var f = document.getElementById("mgu_calculator");
	var req = new JsHttpRequest();
	$('#calculator_result').html('<center><img src="/images/ajax_loader.gif" width="32" height="32" border="0" alt="" /></center>');

	req.onreadystatechange = function() {
		if (req.readyState == 4) {				
			if (req.responseJS) {
				$('#calculator_result').html(req.responseJS.q||'');
				$('#Comments').val(req.responseJS.itog||'');
			}
			$("#calcrequest_result").html(req.responseText);
		}
	}

	req.open(null, '/action.php?do=calc', true);

	req.send( { q: f } );	
	
}


function SendCalcRequestForm() {
	var f = document.getElementById("calcrequestform");
	var req = new JsHttpRequest();
	$('#calcrequest_result').html('<img src="/images/ajax_loader.gif" width="32" height="32" border="0" alt="" />');

	req.onreadystatechange = function() {
		if (req.readyState == 4) {				
			if (req.responseJS) {
				if (req.responseJS.q=='') {
					$('#calcrequest_result').html(req.responseJS.er||'');
				} else {
					$('#calcrequest').html(req.responseJS.q||'');
				}
				
			}
			//$("#calcrequest_result").html(req.responseText);
		}
	}

	req.open(null, '/action.php?do=SendCalcRequestForm', true);
	req.send( { q: f } );
}