function calcImage(imgName, amount, textCell, textContent, topic, userspace,lang) {
	if (document.getElementById('need').value=='') {
		if (lang == 'es') {
			wd_amount_of = 'Cantidad de';
			wd_aprox_space = 'Espacio aproximado';
			clear = 'borrar selección';
			clickToSave='(clicar icono para grabar)';
		} else if (lang == 'cat') {
			wd_amount_of = 'Quantitat de';
			wd_aprox_space = 'Espai aproximat';
			clear = 'esborrar selecció';
			clickToSave='(clicar icona per a gravar)';
		} else if (lang == 'en') {
			wd_amount_of = 'Number of';
			wd_aprox_space = 'Aproximate space';
			clear = 'clear selection';
			clickToSave='(click to save value)';
		}
		for(i=1; i <= amount; i++) {
			document.getElementById(imgName+i).src = "\/images\/icons\/calculator\/" + imgName + "_70.png";
		}
		var txtObj = document.getElementById(textCell);
		txtObj.innerHTML = '<div class="bg_br_blue"><div  id="clear" style="display:none;color:red;font-weight:bold;cursor:pointer;float:right;" onclick="clearValue(\''+imgName+'\',\''+textCell+'\',\''+amount+'\',\''+lang+'\');">x ' + clear + '<\/div><div style="margin-top:16px;"><img src="/images/icons/info.png" style="float:left;margin-right:10px;" valign="middle" \/><h3><span style="font-size:12px;">'+wd_amount_of+' '+topic+':<\/span> ' + userspace + ' <\/h3><h1><span style="font-size:14px;">'+wd_aprox_space+':<\/span> ' + textContent + '&sup2;<\/h1><\/div><div id="clickSave">'+clickToSave+'<\/div><\/div>';
    }
}

function resetImg(imgName,textCell, amount, lang) {
	if (document.getElementById('need').value=='') {
		if (lang == 'es') {
			helpTxt = '<div class="bg_brighter_blue"><p><b>Mueve el ratón encima de los iconos para ver el tamaño estimado de tu trastero.<\/b></p></div>';
		} else if (lang == 'cat') {
			helpTxt = '<div class="bg_brighter_blue"><p><b>Mou el ratolí sobre les icones per a veure la grandària benvolguda del teu traster.<\/b><\/p></div>';
		} else if (lang == 'en') {
			helpTxt = '<div class="bg_brighter_blue"><p><b>Move the cursor on the icons and see the estimated space for your box.<\/b></p></div>';
		}
		var txtObj = document.getElementById(textCell);
		for(i=1; i <= amount; i++) {
			document.getElementById(imgName+i).src = "\/images\/icons\/calculator\/" + imgName + "_70_grey.png";
		}
		txtObj.innerHTML= helpTxt;
    }
}

function setValue(need) {
	if (document.getElementById('need').value=='') {
		document.getElementById('clear').style.display='block';
		document.getElementById('clickSave').style.display='none';
		document.getElementById('need').value=need;
		//document.getElementById('text').value=need +'²';
		document.getElementById('step1ok').style.display='block';
	}
}

function clearValue(imgName,textCell,amount,lang) {
	if (document.getElementById('need').value!='') {
		document.getElementById('need').value='';
		//document.getElementById('text').value='';
		document.getElementById('step1ok').style.display='none';
		resetImg(imgName,textCell, amount, lang);
	}
}

function getPhones(center) {
	if (document.all ){
		document.all['phones'].innerHTML='<img src="/images/loading.gif" border="0" alt="${ml_loading}" title="${ml_loading}" width="16" height="16" />';
	} else {
		document.getElementById('phones').innerHTML='<img src="/images/loading.gif" border="0" alt="${ml_loading}" title="${mlloading}"  width="16" height="16" />';
	}
	ajax_get_html('/ajax/phones.php', "phones", '&center_quarter=' + center);
}

function getCenterPhones(center,language) {
    setTimeout("ajax_get_html('/ajax/getPhones.php', 'phones', '&center_quarter=" + center + "&LANGUAGE=" + language+"');",1200);
	if (document.all ){
		document.all['phones'].innerHTML='<div align="center"><img src="/images/loading32.gif" border="0" alt="...LOADING..." title="...LOADING..." width="32" height="32" /></div>';
	} else {
		document.getElementById('phones').innerHTML='<div align="center"><img src="/images/loading32.gif" border="0" alt="...LOADING..." title="...LOADING..."  width="32" height="32" /></div>';
	}
    setTimeout("new Effect.Highlight('td1', {startcolor:'#a6c9ed',endcolor:'#ffffff'});new Effect.Highlight('td2', {startcolor:'#a6c9ed',endcolor:'#ffffff'});",1200); 
}