var CFG = { URL : '/ajax/ajax.php' }



function comprovaCamp ( id_camp, color ) {

	if ( $(id_camp).value != "" )
	{
		$(id_camp).className='comentari-'+color;
	}
	else
	{
		$(id_camp).className='comentari-error';
	}
}

function comprovaMail ( id_camp, color ) {

	if ( $(id_camp).value != "" && echeck( $(id_camp).value ) )
	{
		$(id_camp).className='comentari-'+color;
	}
	else
	{
		$(id_camp).className='comentari-error';
	}
}


function comprovaCheck ( id_camp , id_area ) {

	if ( $(id_camp).checked )
	{
		$(id_area).className='areamarro';
	}
	else
	{
		$(id_area).className='';
	}
}



function veure_imatge( id_article, id_imatge, lloc, key )
{
	new Ajax( CFG.URL, {
		method: 'post',
		postBody: 'id_imatge='+ id_imatge +'&lloc='+ lloc +'&id_article='+ id_article +'&key='+ key +'&accio=veure_imatge',
		onComplete: veure_imatge_cb
	} );
}
function veure_imatge_cb( resposta )
{
	var ajax_data = resposta.responseText;
	var res = ajax_data.split("||");

	if( res[3] )
	{
		$('imatge-article-' + res[3] ).innerHTML = res[0];
		$('imatge-peu-' + res[3] ).innerHTML = res[1];
		$('imatge-miniatures-' + res[3] ).innerHTML = res[2];
	}
	else
	{
		$('imatge-article').innerHTML = res[0];
		$('imatge-peu').innerHTML = res[1];
		$('imatge-miniatures').innerHTML = res[2];
	}
}


function veure_sessio ()
{
	$('sessio').style.display = 'block';
	$('orquestra').style.display = 'none';
}
function veure_orquestra ()
{
	$('sessio').style.display = 'none';
	$('orquestra').style.display = 'block';
}


function afegeix_arxiu()
{
	var var_nou = $( 'imatge-root' ).cloneNode(true);
	
	var_nou.style.display = 'block';
	var_nou.id = '';

	$('insereix-imatge').parentNode.insertBefore( var_nou, $('insereix-imatge') );
}
function desassocia( node )
{
	// elimina el continent del select que ja no volem
	var tipus = node.className;
	node.parentNode.removeChild( node );
}
