
function sError(){ return true; }
window.onerror = sError;

function music_status(_value)
{
	if( window.document.tdb_player )
	{
		// alert('Set in Flash: '+_value);
		window.document.tdb_player.SetVariable("SoundStatus",_value);
		// alert('OK');
	}
}
function play_sound(tit,fn)
{
	//alert('PlaySound');
	if( window.document.tdb_player )
	{
		//alert('Set in Flash:\nOtherSoundTitle: '+tit+'\nOtherSoundFile: '+fn);
		window.document.tdb_player.SetVariable("OtherSoundTitle",tit);
		window.document.tdb_player.SetVariable("OtherSoundFile",fn);
		//alert('OK');
	}
}

function imagewin(img,w,h)
{
	var win_x = (screen.width-w)/2;
	var win_y = (screen.height-h)/2;
	var wPARAM = '';
	wPARAM += 'left='+win_x+',top='+win_y+',width='+w+',height='+h;
	wPARAM += ',location=0,resizable=0,titlebar=0,directories=0,toolbar=0,menubar=0,scrollbars=0,status=no';
	
	var pw = window.open( 'index.php?page=image&img='+img, 'imgwin', wPARAM );
}

function changeIMG(_id,_imgsource)
{
	var e = document.getElementById(_id);
	if(e)
	{
		e.src = _imgsource;
	}
}

function popup_window(_url,_id,_width,_height)
{
	var win_x = (screen.width-_width)/2;
	var win_y = (screen.height-_height)/2;
	var wPARAM = '';
	wPARAM += 'left='+win_x+',top='+win_y+',width='+_width+',height='+_height;
	wPARAM += ',location=0,resizable=0,titlebar=0,directories=0,toolbar=0,menubar=0,scrollbars=1,status=no';
	var pw = window.open(_url,_id,wPARAM);
}

function check_prevawards(cbox)
{
	//a cada jornada posarem un name=prevaward_x_ i un id=jorn_x_
	var e1 = document.getElementById('jorn_1'); 
	var e2 = document.getElementById('jorn_2');
	var e3 = document.getElementById('jorn_3');
	var e4 = document.getElementById('jorn_4');
	var e5 = document.getElementById('jorn_5');
	var e6 = document.getElementById('jorn_6');
	var e7 = document.getElementById('jorn_7');
	
	if( e1 && e2 && e3 && e4 && e5 && e6 && e7)
	{
		// if I have checked 'no previous award submission'
		if( cbox.name=='check1' && e1.checked )
		{
			// de-check others
			e2.checked = false;
			e3.checked = false;
			e4.checked = false;
			e5.checked = false;
			e6.checked = false;
			e7.checked = false;
		}
		else if(cbox.checked)
		{
			e1.checked = false;
		}
	}
}

function particip_quin_sh(cbox)
{
	document.getElementById('particip_quin').style.display = cbox.checked ? 'block' : 'none';
}

function changeimg(i,s)
{
	 document.getElementById(i).src = s;
}


function menu_on(i,la)
{
	// if(typeof mto != 'undefined' ) clearTimeout(mto);
	 switch_menu(i,2,la);
}

function menu_out(i,b,la)
{
	// mto = setTimeout('switch_menu('+i+','+b+')',100);
	 switch_menu(i,b,la);
}

function switch_menu(i,m,l)
{
	changeimg('m0'+i,'img/'+l+'/menu_'+i+'_'+m+'.gif');
	 document.getElementById('sm0'+i).style.display =  ( m==2 ? 'block' : 'none' );
}


function hover_logo(i,m)
{
	 changeimg('pl0'+i,'img/logos/logo_'+i+'_'+m+'.jpg');
}
