function showOtherProps () {

	$("#props_other").slideToggle("fast");
	text_props = $("#props_other_toggle").text();

	if ( text_props == "Показать" ) {
		$("#props_other_toggle").text("Скрыть");
	} else {
		$("#props_other_toggle").text("Показать");
	}

}

function selectAll () {

	var st = $('#OfferIndexForm :checkbox');

	if ( st[0].checked == true ) {
		st.each(function(){this.checked=true});
		showOfferToAll();
	} else {
		st.each(function(){this.checked=false});
		hideOfferToAll();
	}

}


/*
* TODO: умный переключатель/выбор типов площадок
*/

function selectAllPlatforms () {

	var st = $('#PlatformsList :checkbox');

	if ( st[0].checked == true ) {
		st.each(function(){this.checked=true});
		showOfferToAll();
	} else {
		st.each(function(){this.checked=false});
		hideOfferToAll();
	}

}

function showOfferToAll () {
	$('#offerToAll').css('visibility','visible');
}

function hideOfferToAll () {
	$('#offerToAll').css('visibility','hidden');
}

function checkSelectAll ( th ) {

	if ( th.checked == true ) { showOfferToAll () }
	if ( th.checked == false ) {
		
		var allCheckBoxs = $('#OfferIndexForm :checkbox');
		var stateCheckBox = false;
		
		allCheckBoxs.each ( function () { 
			if ( this.checked == true ) { stateCheckBox = true; } 
		} );
		
		if ( stateCheckBox == false ) hideOfferToAll ();
	}

}

function goBackToProps () {
	$('#PlatformsList').text('');
	$('#PlatformsList').css('width',0);
	$('#PlatformsList').css('height',0);
	return false;
}

function showPlatformsList () {

	$(document).ready(function() {

		$('#indicator').fadeIn('fast');

		$.post ( 
			'/companies/getFitingPlatforms', 
			$('#CompanyAddForm').serialize()
			, 
			function ( data ) { 
				$('#PlatformsList').html(data);
				$('#indicator').fadeOut('fast');
				
				var w = $('#form1').width();
				var h = $('#form1').height();
																
				if ( $.browser.msie ) {
					$('#PlatformsList').css('position','absolute');
				}					

				$('#PlatformsList').css('width',w);
				$('#PlatformsList').css('height',h);

			}
		);
	

        if($.browser.safari){
            bodyelem = $("body")
        } else {
            if($.browser.opera){
                bodyelem = $("html")
            } else {
                bodyelem = $("html,body")
            }
        }
        bodyelem.animate({scrollTop: 0});
    
}); 

}
