	function jscopri(idd)
	{if ($("#"+idd+":first").is(":hidden")) {$("#"+idd).slideDown(100);} else {/*$("#"+idd).hide(300); */$("#"+idd).slideUp(5);}}	
	function jmostra(idd)
	{$("#"+idd).slideDown(100);}		
	function jnascondi(idd)
	{$("#"+idd).slideUp(5);}	
	function jnascondiPar(idd,p)
	{$("#"+idd).fadeOut(p);}	
	function jmostraPar(idd,p)
	{$("#"+idd).fadeIn(p);}	

            
	
			function playVideo(movie,img,autostart,hdfile,title,description)
			{
				  $("#titolo").html(title);
				  $("#description").html(description);
				  var so = new SWFObject('/player.SWF','mpl','630','402','9','#000000');
				  so.addParam('allowfullscreen','true');
				  so.addParam('allowscriptaccess','always');
				  so.addParam('wmode','opaque');
				  so.addVariable('author','Black Bean Games');
				  so.addVariable('file','/video/'+movie+'&image='+img);
				  so.addVariable('autostart',autostart);
				  so.addVariable('start','0');
				  so.addVariable('title','World Rally Championship');
				  so.addVariable('bufferlength','10');
				  so.addVariable('controlbar','over');
				  so.addVariable('plugins','sharing-1');       //usare revolt-1 per play audio
				  
				  if(hdfile!='')
				  {
					so.addVariable('plugins','hd-1,sharing-1');
					so.addVariable('hd.file',hdfile);
					so.addVariable("hd.state",false);
					so.addVariable("hd.autoswitch",false);
					so.addVariable("hd.bandwidth",1000);            
				  }
		  
				  so.addVariable('skin','/skin_bekle_1.swf');
				  so.addVariable('linktarget','http://www.wrcthegame.com/');
				  so.write('mediaspace');
				  setTimeout('jnascondiPar(\'sfumino\',1500)',5500);
				  setTimeout('jnascondiPar(\'didascalia\',1500)',5200);
			}
			
			function playVideoYT(movie,img,autostart,hdfile,title,description)
			{
				  $("#titolo").html(title);
				  $("#description").html(description);
				  var so = new SWFObject('/player.SWF','mpl','630','402','9','#000000');
				  so.addParam('allowfullscreen','true');
				  so.addParam('allowscriptaccess','always');
				  so.addParam('wmode','opaque');
				  so.addVariable('author','Black Bean Games');
				  so.addVariable('file',movie+'&image='+img);
				  so.addVariable('autostart',autostart);
				  so.addVariable('start','0');
				  so.addVariable('title','World Rally Championship');
				  so.addVariable('bufferlength','10');
				  so.addVariable('controlbar','over');
				  so.addVariable('plugins','sharing-1');       //usare revolt-1 per play audio
				  
				  if(hdfile!='')
				  {
					so.addVariable('plugins','hd-1,sharing-1');
					so.addVariable('hd.file',hdfile);
					so.addVariable("hd.state",false);
					so.addVariable("hd.autoswitch",false);
					so.addVariable("hd.bandwidth",1000);            
				  }
		  
				  so.addVariable('skin','/skin_bekle_1.swf');
				  so.addVariable('linktarget','http://www.wrcthegame.com/');
				  so.write('mediaspace');
				  setTimeout('jnascondiPar(\'sfumino\',1500)',5500);
				  setTimeout('jnascondiPar(\'didascalia\',1500)',5200);
			}			
			
			
	        function fmk$PostCall(url,parString,callBack,content){
                  var ajax = assegnaXMLHttpRequest();
                  if(ajax) {
                    ajax.open("POST", url, false);
		            ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		            ajax.setRequestHeader("Content-length", parString.length);
                    ajax.setRequestHeader("connection", "close");
                    ajax.send(parString);
                    return ajax.responseText;
                  } 
                  else {
                    return false;
                  }		        
	        }			

            function salvaSUPPORT(q) 
            {
                if(q>1)
                    q = 0;            
                var alertSTD = "<h1>Customer support</h1><em>WRC</em><br/><p>";
                var MailMissed = new Array("E-Mail missed","E-Mail mancante");            
                var controlInvalid = new Array("Invalid secure number","Numero di sicurezza non valido");            
                var controlText = new Array("Question missed","Domanda mancante");            
                
                var MailInvalid = new Array("Invalid E-Mail","E-Mail non valida");            
                
                var StoringKO = new Array("Service unavailable; please retry later","Registrazione non terminata a causa di errori;<br />riprovare in seguito");   
                var StoringOK = new Array("Thank you!<br>Your question was successfully recorded","Grazie!<br>Richiesta inviata al customer support di SBKX!");   
                
            
                 if (document.frmPostQuest.email.value == '') 
                 {
                    Sexy.error(alertSTD+MailMissed[q]+'</p>');
                    return false;
                 }
                if (document.frmPostQuest.email.value.indexOf('@') == -1) { Sexy.error(alertSTD+MailInvalid[q]+'</p>'); return false; }
                if (document.frmPostQuest.email.value.indexOf('.') == -1) { Sexy.error(alertSTD+MailInvalid[q]+'</p>'); return false; }
                if (document.frmPostQuest.email.value.indexOf(',') >= 0) { Sexy.error(alertSTD+MailInvalid[q]+'</p>'); return false; }
                
                
                 if (document.frmPostQuest.control.value == '') 
                 {
                    Sexy.error(alertSTD+controlInvalid[q]+'</p>');
                    return false;
                 }
                 
                 if (document.frmPostQuest.question.value == '') 
                 {
                    Sexy.error(alertSTD+controlText[q]+'</p>');
                    return false;
                 }                 
                          
                strP = "email="+document.frmPostQuest.email.value+"&country="+document.frmPostQuest.country.value+"&type="+document.frmPostQuest.type.value+"&platform="+document.frmPostQuest.platform.value+"&question="+encodeURI(document.frmPostQuest.question.value);
                s = fmk$PostCall('/EXECsupport',strP,true,'catalogoDati');
                switch(s)
                {
                    case '-1':
                        Sexy.error(alertSTD+StoringKO[q]+'</p>');
                        break;                
                    case '1':
                        Sexy.info(alertSTD+StoringOK[q]+'</p>');
                        document.frmPostQuest.email.value = '';
                        break;
                    default:
                        Sexy.error(alertSTD+StoringKO[q]+'</p>');
                        break;
                }
                
                document.frmPostQuest.email.value = '';
                document.frmPostQuest.question.value = '';                
                return false;
            } 			
			
			
								votato = 0;
								function prendiElementoDaId(id_elemento) {
									var elemento;
									if(document.getElementById){
										elemento = document.getElementById(id_elemento);
									}else{
										elemento = document.all[id_elemento];
									}
									return elemento;
								};			


								function votaStelle(v,cid)
								{
									if(votato==1) return;
									for(k=1;k<=v;k++)
									{
										prendiElementoDaId("star"+k).src = '/images/star.on.png';
									}
									c = eseguiInRemoto('/votaACT.php?m='+cid+'&v='+v+'&nocache='+new Date().getTime());
									if(c=='-9')
									{
										Sexy.alert('<h1>WRC2011</h1><em>WRC The Game</em><br/><br><p>Immagine gi&agrave; votata!');
										for(k=1;k<=v;k++)
										{
											prendiElementoDaId("star"+k).src = '/images/star.off.png';
										}
										document.getElementById('rateLabel').innerHTML = '';
									}
									votato = 1;
									switch(v)
									{
										case 1:document.getElementById('rateLabel').innerHTML = 'Terrible';break;
										case 2:document.getElementById('rateLabel').innerHTML = 'booo';break;
										case 3:document.getElementById('rateLabel').innerHTML = 'Not so bad';break;
										case 4:document.getElementById('rateLabel').innerHTML = 'Good';break;
										case 5:document.getElementById('rateLabel').innerHTML = 'WOW!';break;
									}
									if(c=='-9') document.getElementById('rateLabel').innerHTML = '';
																		
								}
								function offStelle()
								{
									if(votato==1) return;
									for(k=1;k<=5;k++)
									{
										var f = prendiElementoDaId("star"+k).src;
										if(f.indexOf('/images/star.on.png') == -1)
										{
											prendiElementoDaId("star"+k).src = '/images/star.off.png';
										}
									}
									document.getElementById('rateLabel').innerHTML = '&nbsp;';
								}
								function onStelle(v)
								{
									if(votato==1) return;
									for(k=1;k<=v;k++)
									{
										var f = prendiElementoDaId("star"+k).src;
										if(f.indexOf('/images/star.on.png') == -1)
										{	
											prendiElementoDaId("star"+k).src = '/images/star.rollon.png';
										}
									}
									
									switch(v)
									{
										case 1:document.getElementById('rateLabel').innerHTML = 'Terrible';break;
										case 2:document.getElementById('rateLabel').innerHTML = 'booo';break;
										case 3:document.getElementById('rateLabel').innerHTML = 'Not so bad';break;
										case 4:document.getElementById('rateLabel').innerHTML = 'Good';break;
										case 5:document.getElementById('rateLabel').innerHTML = 'WOW!';break;
									}
								}
								
	function manageAbuse(v,abid)
	{
		strP = "v="+v+"&abid="+abid+"&nocache="+new Date().getTime();

		s = fmk$PostCall('/EXECManageabuse',strP,true,'catalogoDati');
		switch(s)
		{
			case '1':
				Sexy.info('<p>Process completed</p>');
				break;
			default:
				Sexy.error('<p>Service unavailable; please retry later</p>');
				break;
		}
	}


	function createCookie(name,value,days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
	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 eraseCookie(name) {createCookie(name,"",-1);}
	
			
