// JavaScript Document
function pintataulerposicio(posicio, col){
	if (col!=1) col=0;
	if (origen==undefined) {origen=-1; desti=-1;}
	colorpintat=col;
	str = "<table border='0' cellpadding='0' cellspacing='0' bgcolor='#454'>";
	str += "<tr><th colspan=10>&nbsp;</th></tr>";
	for (i=0; i<8; i++) {
		str += "<tr><th width='8'>" + (col?i+1:8-i) + "</th>";
		for (j=0; j<8; j++) {
			colcas = ((i+j)%2?"#689":"#C8D0D8");

			peca = posicio.substr((col?i:7-i)*8+(col?7-j:j),1);
			if (peca>='a' && peca<='z') {
				if (peca.toLowerCase()=="d" && this.tipus=="A") peca="x";
				imatge='imn'+peca.toLowerCase();
			}
			else if (peca>='A' && peca<='Z') {
				if (peca.toLowerCase()=="d" && this.tipus=="A") peca="x";
				imatge='imb'+peca.toLowerCase();
			} else imatge='blank';


			str += "<td height='"+ampX+"' width='"+ampY+"' style='background-color:"+ colcas +";'><img src='imatges/C/"+imatge+".gif' height='"+ampX+"' width='"+ampY+"' border='0'></td>";
		}
		str += "<th width='8'><img src='imatges/blank.gif' height='1' width='10' border='0'></th></tr>\n";
	}
	str += "<tr><th>&nbsp;</th>";
	for (i=0;i<8;i++) {
		ll="abcdefgh";
		str += "<th>" + ll.substr((col?7-i:i),1) + "</th>";
	}
	str += "<th></th>";
	str += "</tr></table>";

	dWrt('tauler',str);
}

function responEnquesta(enquesta,resposta) {
	window.frames['Inferior2'].document.location.href="InferiorPortada.php?accio=ENQUESTA&noticia="+enquesta+"&resposta="+resposta;	
}
function resultatsEnquesta(enquesta) {
	window.frames['Inferior2'].document.location.href="InferiorPortada.php?accio=ENQUESTA&noticia="+enquesta;	
}
function escriu_info_partida() {
str="";
str+="<strong>" + i_p + "</strong>";
dShw('infopartida',1);
if (dGet('x')) dShw('x',1);
dWrt('infopartida',str);
switch (col_i_p){
	case 0: c="#AB5"; break;
	case 1: c="#A44"; break;
	case 2: c="#999"; break;
	case 3: c="#DA4"; break;
	case 4: c="#C0D4AB"; break;
	case 5: c="#FF8"; break;
	case 6: c="#A77"; break;
	case -1: c="#899696"; break;
	}
eval(dGet('infopartida')+".style.background='"+c+"';");
}
