function isAjaxPossible(){
	if ($.browser.msie && $.browser.version<7 ){
		try{
			if(window.ActiveXObject){
				return true;
			}
		}catch(e){
			return false;
		}
	}
	return true;
}
var TextareaHelper = {
  resize:function(element){
    if(!element.attr('orign_rows')){
      element.attr('orign_rows',element.attr('rows'));
    }
    var num_min_rows = parseInt(element.attr('orign_rows'));
    var rows = parseInt(element.attr('rows'));
    var cols = parseInt(element.attr('cols'));
    var str_text = element.attr('value');
    var num_rows = 1;

    if(str_text){
      var arr_rows = str_text.split("\n");
      num_rows = arr_rows.length;
      var i = 0;
      for(i=0;i<num_rows;i++){
        if(arr_rows[i]){
          var text_row = arr_rows[i];
          if(text_row.length >0 && text_row.length>cols){
            num_rows += Math.floor(text_row.length/cols);
          }
        }
      }
    }
    var num_rows_optimal = num_rows+2;
    if(num_rows_optimal<num_min_rows){
      num_rows_optimal = num_min_rows;
    }
	var max_rows = 25;
	if(num_rows_optimal>max_rows){
		num_rows_optimal = max_rows;
	}
    if(num_rows_optimal!=rows){

		element.attr('rows',num_rows_optimal);
    }
  }
};
$(document).ready(function() {
	if (
		!($.browser.msie && parseInt($.browser.version)<7)
	) {
		$('textarea').keyup(function () {
			TextareaHelper.resize($(this));
		});
		$('textarea').each(function () {
			TextareaHelper.resize($(this));
		});
	}
	$('.accordion h2 a').click(function(){
		$(this).blur();
	});
	$('.accordion:not(.open)').each(function(){
		$(this).Accordion({
			header: 'h2',
			alwaysOpen: false,
			animated: false,
			active: false,
			showSpeed: 100,
			hideSpeed: 100
		});
	});
	$('.accordion.open').each(function(){
		$(this).Accordion({
			header: 'h2',
			animated: false,
			showSpeed: 100,
			hideSpeed: 100
		});
	});




});