function get_country_by_ajax(){
	var country_id = $('in_country').value;
	if(!country_id || country_id == 0){
		return false;
	}
	
	
	$('retailers_holder').innerHTML = 'Please wait...';
	new Ajax.Updater({ success: 'retailers_holder' }, base_url+'home/international_retailers_ajax/'+country_id, {
		evalScripts: true
	});
}
/*
function update_location(country_id){
	var this_url = window.location.href;
	var url_chunks = this_url.split("/");
	var reconstructed_url = "";
	
	if(url_chunks.last() != "international"){
		url_chunks.pop();
	}
	url_chunks.each(function(s, index){
		reconstructed_url += s + "/";
	});
	reconstructed_url += "#"+country_id;
	//alert(reconstructed_url);
	window.location.href = reconstructed_url;
}
*/

function reclass_rows(elm){
	var rows = $(elm).select("div.retailer_row");
	var row_num = 0;
	for(x=0; x<rows.length; x++){
		elm = $(rows[x]);
		if(elm.hasClassName("retailer_row")){
			row_num++;
			row_class = (row_num % 2)+1;
			if(elm.hasClassName("row1")){
				elm.removeClassName('row1');
			}
			if(elm.hasClassName("row2")){
				elm.removeClassName('row2');
			}
			elm.addClassName("row"+row_class);
		}
	}
}

function confirm_remove(id){
	var confirmation=window.confirm("Are you sure you want to delete International Retailer #"+id);
	if (confirmation){
		window.location = base_url+"admin/international_retailers/delete/"+id;
	}
}