function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}


// Crea instancia de XMLHttpRequest según el navegador
function creaAjax() {	
	var xmlhttp = false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function arrodoneix(numero) {
	var result=Math.round(numero*100)/100 ;
	return result;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}



function pregunta(x) {
	MM_showHideLayers('flotant','','show')
	MM_effectAppearFade('contingut', 200, 100, 30, false);
	var obj = document.getElementById('resposta');
	//var lang=readCookie('lang');
	obj.innerHTML='loading...';
	ajax1=creaAjax();
	ajax1.open('GET', "ajax/respostes_consumidor.php?preg="+x, true);
	ajax1.onreadystatechange = function() {
		if (ajax1.readyState == 4 && ajax1.status == 200) {
			obj.innerHTML =ajax1.responseText+'<p>&nbsp;</p>';
			
		}
	}
	ajax1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajax1.send(null);
	
}
