function load_city(rid,cid) {
        $.ajax({
                type: "POST",
                url: "/load_city.ajax.php",
                data: ({
                    region_id: $('#'+rid).val()
                }),
                success: function(msg){
					if(msg!='') {
						$('#'+cid).html(msg);
					}
                }
        });
}

$(document).ready(function(){

$('.cool-ta').bind('keyup', function(){
	c=substr_count($('.cool-ta').val(), '\n');
	h=80+c*(2+parseInt($(this).css('font-size')));
	if(h<150) h=150;
	if(parseInt($(this).css('height'))+10>h && parseInt($(this).css('height'))-10<h) {
		
	} else {
		$(this).animate({height:h+'px'},300);
	}
});

});




function substr_count( haystack, needle, offset, length ) { // Count the number of substring occurrences
    //
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    var pos = 0, cnt = 0;
    if(isNaN(offset)) offset = 0;
    if(isNaN(length)) length = 0;
    offset--;
    while( (offset = haystack.indexOf(needle, offset+1)) != -1 ){
        if(length > 0 && (offset+needle.length) > length){
            return false;
        } else{
            cnt++;
        }
    }
    return cnt;
}

