
function show_hide_country_select(id, b){
	if (b) {
		document.getElementById('country_select_' + id).style.display = 'block';
		document.getElementById('change_country_' + id).style.display = 'none';
	}
	else {
		document.getElementById('country_select_' + id).style.display = 'none';
		document.getElementById('change_country_' + id).style.display = 'block';
	}
	return false;
}

function select_country(id, type){
	//Cargar por ajax los datos del pais seleccionado
	
	var country = document.getElementById('sel_country_' + id).value;
	var lang = document.getElementById('__lang').value;
	var superprefix = document.getElementById('__superprefix').value;
	var url = get_data_url + "country=" + country + "&lang=" + lang + "&superprefix=" + superprefix + "&microtype=" + type;
	LoadURL(url, 'show_data("' + id + '")');
}

function show_data(id){
	var values = ajax_result.split("|");
	document.getElementById('sms_prefix_' + id).innerHTML = values[0];
	document.getElementById('sms_phone_' + id).innerHTML = values[1];
	document.getElementById('sms_cost_' + id).innerHTML = values[2];
	document.getElementById('sms_operators_' + id).innerHTML = values[4];
	document.getElementById('change_country_text_' + id).innerHTML = document.getElementById('__change_country').value.replace('__country__', values[5])
	show_hide_country_select(id, false);
}
function showMicroFrame(show, hide){
	/*var id1 = 'iframe_body1';
	var id2 = 'iframe_body2';
	var mostrar = id1 == id ? id1 : id2;
	var ocultar = id1 == id ? id2 : id1;*/
	
	document.getElementById(show).style.display = 'block';
	document.getElementById(hide).style.display = 'none';
}

function changeSelected(obj, idzone){
	var vinculos = document.getElementById(idzone).getElementsByTagName('a');
	for ( i = 0; i < vinculos.length; i++ ) {
		if ( vinculos[i].className.lastIndexOf('active') != -1 ) vinculos[i].className = '';
	}
	obj.className = 'active';
}

function checkPhoneNumber(id) {
	var re5digit=/^([0-9]){8,}$/;
	if ( document.forms['form_' + id].elements['code'].value.search(re5digit) == -1 ) {
		return false;
	}
	document.forms['form_' + id].style.display = 'none';
	document.forms['form2_' + id].style.display = 'block';
	return true;
}
