// Funció per obrir el editor de textes -------------------

function introtext(text,textb)
{
	LeftPosition = (screen.width) ? (screen.width - 505) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - 453) / 2 : 0;
	editor = window.open('intro.asp?text='+text+'&textb='+textb+'','','width=505,height=453,scrollbars=no,mainbar=no,statusbar=no,left='+LeftPosition+',top='+TopPosition+'');
}

function introtext2(text,textb)
{
	LeftPosition = (screen.width) ? (screen.width - 505) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - 453) / 2 : 0;
	editor = window.open('intro2.asp?text='+text+'&textb='+textb+'','','width=505,height=453,scrollbars=no,mainbar=no,statusbar=no,left='+LeftPosition+',top='+TopPosition+'');
}

function open_window(url,w,h) {
	LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
	window.open (url,'','width='+w+',height='+h+',scrollbars=no,mainbar=no,statusbar=no,resizable=yes,left='+LeftPosition+',top='+TopPosition+'');
}

function credits()
{
	LeftPosition = (screen.width) ? (screen.width-300)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-200)/2 : 0;
	window.open ('credits.asp','','width=300,height=200,scrollbars=no,statusbar=no,toolbar=no,mainbar=no,left='+LeftPosition+',top='+TopPosition+'');
}

function print_version(url)
{
	LeftPosition = (screen.width) ? (screen.width - 587) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - 500) / 2 : 0;
	editor = window.open(url,'','width=587, height=500, scrollbars=yes, mainbar=no, statusbar=no, left='+LeftPosition+', top='+TopPosition+'');
}

function banner(opt) {
	switch(opt) {
		
		case -1:	document.addbanner_form.pdf.disabled = true;
					document.getElementById('links_productes').style.display = 'none';
					document.addbanner_form.link_web.disabled = true;
					break;
		
		case 0:		document.addbanner_form.pdf.disabled = false;
					document.getElementById('links_productes').style.display = 'none';
					document.addbanner_form.link_web.disabled = true;
					break;
		
		case 1:		document.addbanner_form.pdf.disabled = true;
					document.addbanner_form.link_web.disabled = true;
					document.getElementById('links_productes').style.display = 'block';
					break;
					
		case 2:		document.addbanner_form.pdf.disabled = true;
					document.addbanner_form.link_web.disabled = false;
					document.getElementById('links_productes').style.display = 'none';
					break;
		
	}	
}
var opt_actiu = 0;
var prod_actiu = 0;
function show_cols(opt) {
	if (opt_actiu!=0) {
		document.getElementById(opt_actiu).style.display = 'none';
	}
	if (  prod_actiu!=0 ) {
		document.getElementById(prod_actiu).style.display = 'none';	
	}
	document.getElementById(opt).style.display = 'block';
	opt_actiu = opt;
}

function show_prod(opt) {
	if (prod_actiu!=0) {
		document.getElementById(prod_actiu).style.display = 'none';
	}
	document.getElementById(opt).style.display = 'block';
	prod_actiu = opt;
}

function prov() {
	if ( document.update_form.pais.options[document.update_form.pais.selectedIndex].value=='Spain;0' ) {
		document.update_form.provincia.disabled = false;
	} else {
		document.update_form.provincia.disabled= true;
	}
}

function prov2() {
	if ( document.update_form.pais_e.options[document.update_form.pais_e.selectedIndex].value=='Spain;0' ) {
		document.update_form.provincia_e.disabled = false;
	} else {
		document.update_form.provincia_e.disabled= true;
	}
}

//Scroll de noticies ---------------------------------------------
function init_scroll() {
	obj = document.getElementById('news_slide');
	h = obj.scrollHeight;
	obj.style.top = 0;
	moure();
}

function moure()
{
	if ( parseInt( document.getElementById('news_slide').style.top ) > -( h/2 ) )
	{
		s = parseInt( document.getElementById('news_slide').style.top );
		s -= 1;
		//s = s+'px';
		document.getElementById('news_slide').style.top = s + 'px';
	}
	else
	{
		document.getElementById('news_slide').style.top = 0;
	}
	c_interval = setTimeout("moure()",50);
}


function stop_scroller() {
	clearInterval(c_interval);
}
//Fi Scroll Noticies ----------------------------------------------
