function get_alts() {

	//url = $('#url').attr('value');
	//alert('1');
	var url_a;
	url_a = $("#url_a").attr('value');
	//alert('2');

	$("#result").html('<img src="images/loader.gif" alt="" /><br />Checking alt tags on '+url_a+'.');

	$.ajax({
	  type: "GET",
	  url: "crawl.php",
	  data: "url="+urlencode(url_a),
	  success: function(response){
			
		$("#result").html(response);
	
	  }
	});				


}

function urlencode( str ) {
                             
    var histogram = {}, tmp_arr = [];
    var ret = str.toString();
    
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    
    histogram["'"]   = '%27';
    histogram['(']   = '%28';
    histogram[')']   = '%29';
    histogram['*']   = '%2A';
    histogram['~']   = '%7E';
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    
    ret = encodeURIComponent(ret);
    
    for (search in histogram) {
        replace = histogram[search];
        ret = replacer(search, replace, ret) // Custom replace. No regexing
    }
    
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
    
    return ret;
}

