// PEU
function peu(secure){
var sImgBase = (secure==null) ? "http://multi.tvcatalunya.com" : "https://secure.ccrtvi.com"; 
document.write("<br><table width=\"836\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"txtPetit\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><a href=\"http://www.ccrtvi.cat\"><img src=\"" + sImgBase + "/img/tvc/peu_log_ccrtv.gif\" width=\"190\" height=\"22\" border=\"0\" style='margin-top:5px' alt='Logotip de CCRTV Interactiva'></a></td><td><a href=\"http://www.tv3.cat\"><img src=\"" + sImgBase + "/img/tvc/peu_log_tvc.gif\" width=\"190\" height=\"22\" border=\"0\" style='margin-top:5px' alt='Logotip de Televisi&oacute; de Catalunya'></a></td><td width=\"100%\" style='text-align:right'>&copy; 2007 CCRTV Interactiva, S.A. | Televisi&oacute; de Catalunya, S.A.<br><a href=\"http://www.tv3.cat/mapaweb.htm\">Mapa web</a> | <a href='http://www.tv3.cat/rss/'><img border='0' height='13' width='13' alt='RSS' src='/img/tvc/ico_rss_peu.gif' /> RSS</a> | <a href=\"http://www.tv3.cat/avis\" target=\"_blank\" title=\"Enlla&ccedil; a una nova plana\">Av&iacute;s legal</a> | ");
document.write("<a href='http://www.tv3.cat/iqua/' onClick=\"window.open(this.href,'_blank','width=430,height=400,top=238,left=240');return false;\">Segell de qualitat</a> | <a href='http://www.tv3.cat/ptvcatalunya/atcSeccio.jsp'>Atenció a l'Audičncia</a> <a href='http://www.tv3.cat/ptvcatalunya/atcSeccio.jsp'><img src=http://www.ccma.cat/atencio/img/logoatencio_peu.gif width='11' height='13' border='0' alt=\"Atenció a l'Audičncia\" style='margin-top:2px'></a></td></tr></table></td></tr></table><br>");
}
// PEU HOME
function peu_home(){
document.write("<br><table width=\"836\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"txtPetit\"> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><a href=\"http://www.ccrtvi.cat\"><img src=\"http://multi.tvcatalunya.com/img/tvc/peu_log_ccrtv.gif\" style='margin-top:5px' width=\"190\" height=\"22\" border=\"0\" alt='Logotip de CCRTV Interactiva' ></a></td><td><a href=\"http://www.tv3.cat\"><img  src=\"http://multi.tvcatalunya.com/img/tvc/peu_log_tvc.gif\" style='margin-top:5px' width=\"190\" height=\"22\" alt='Logotip de Televisi&oacute; de Catalunya' border=\"0\"></a></td><td width=\"100%\" style='text-align:right'>&copy; 2007 CCRTV Interactiva, S.A. | Televisi&oacute; de Catalunya, S.A.<br><a href=\"http://www.tv3.cat/mapaweb.htm\">Mapa web</a> | <a href='http://www.tv3.cat/rss/'><img border='0' height='13' width='13' alt='RSS' src='/img/tvc/ico_rss_peu.gif' /> RSS</a> | <a href=\"http://www.tv3.cat/avis\" title=\"Enlla&ccedil; a una nova plana\" target=\"_blank\">Av&iacute;s legal</a> | ");
document.write("<a href='http://www.tv3.cat/iqua' onClick=\"window.open(this.href,'_blank','width=430,height=400,top=238,left=240');return false;\">Segell de qualitat</a> | <a href='http://www.tv3.cat/ptvcatalunya/atcSeccio.jsp'>Atenció a l'Audičncia</a> <a href='http://www.tv3.cat/ptvcatalunya/atcSeccio.jsp'><img src='http://www.ccma.cat/atencio/img/logoatencio_peu.gif' width='11' height='13' border='0' alt=\"Atenció a l'Audičncia\" style='margin-top:2px'></a></td></tr></table></td></tr></table>");
}
// UTILS
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

// NOVES FUNCIONS TV3.CAT
// LOAD FLASH OBJECT
/* PINTA GENERIC FLASH */
function insertSimpleFlash(url,w,h){
var str='';
str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';
str+='<param name="movie" value="'+url+'" />';
str+='<param name="quality" value="high" />';
str+='<param name="wmode" value="transparent" />';
str+='<param name="menu" value="false" />';
str+='<param value="exactfit" name="scale" />';
str+='<param name="swliveconnect" value="true">';
str+='<embed src="'+url+'" quality="high" swliveconnect="true" wmode="transparent" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';
str+='</object>';
document.write(str);
}
function updateSimpleFlash(url,w,h){
var str='';
str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';
str+='<param name="movie" value="'+url+'" />';
str+='<param name="quality" value="high" />';
str+='<param name="wmode" value="transparent" />';
str+='<param name="menu" value="false" />';
str+='<param value="exactfit" name="scale" />';
str+='<param name="swliveconnect" value="true">';
str+='<embed src="'+url+'" quality="high" swliveconnect="true" wmode="transparent" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';
str+='</object>';
document.getElementById('svp').innerHTML = str;
}
// SWAP TABS DESTACAT
function swapTabs(sel,tot) {
var id, id;
	for(var i=1;i<=tot;i++){
		var id = 'bdest'+i;
		document.getElementById(id).className = 'box_destacats_hidden';
			if(i == sel){
			document.getElementById(id).className = 'box_destacats';
			}
	}
}
// SWAP VIDEOS DESTACAT
function swapVideos(sel,tot) {
var id;
	for(var i=1;i<=tot;i++){
		var id = 'bvideo'+i;
		document.getElementById(id).className = 'vmodul';
			if(i == sel){
			document.getElementById(id).className = 'vmodul_hidden';
			document.getElementById('vAvanTitol').innerHTML = vPlayListData[i-1][0];
			document.getElementById('vTitol').innerHTML = vPlayListData[i-1][1];
			updateSimpleFlash('flash/svp.swf?streamURL='+vPlayListData[i-1][2]+'&posterURL='+vPlayListData[i-1][3]+'&videoANCHO=320&videoALTO=240',320,240);
			//alert(vPlayListData[i-1][2]+" ,img:  "+vPlayListData[i-1][3]);
			}
	}
}

// LOGICA CARROUSEL

// VARS
var carrusInterval;
var initCarrus = 0;
var cTimer = 9000; //en ms
// SWAP CARROUSEL
function swapCarrus(sel) {
	//alert(sel+" ;  "+carrusLength+" ;  "+carrusdata[sel]);
	var id;
	for(var i=1;i<=carrusLength;i++){
		var id = 'cLabel'+i;
		document.getElementById(id).className = '';
			if(i == sel){			
			document.getElementById(id).className = 'selected';
			loadCarru(carrusdata[i-1]);
			}
	}
	stopCarrus();
	runCarrus(sel);
}
//
function runCarrus(sel){
carrusInterval = setTimeout("updateCarrus("+sel+")",cTimer);
}
//
function stopCarrus(){
clearTimeout(carrusInterval);
}
//
function updateCarrus(sel){
initCarrus = sel;
initCarrus++;
if(initCarrus > carrusLength){initCarrus = 1;}
swapCarrus(initCarrus);
}
//
function loadCarru(c){
	var	tempExt = c[0].substr((c[0].lastIndexOf(".")+1),3);
	if(tempExt == "swf"){		
		var w = 624;
		var h = 210;
		var str='';
		str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';
		str+='<param name="movie" value="'+c[0]+'?_url='+c[1]+'" />';
		str+='<param name="quality" value="high" />';
		str+='<param name="wmode" value="transparent" />';
		str+='<param name="menu" value="false" />';
		str+='<param value="exactfit" name="scale" />';
		str+='<param name="swliveconnect" value="true">';
		str+='<embed src="'+c[0]+'?_url='+c[1]+'" quality="high" swliveconnect="true" wmode="transparent" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';
		str+='</object>';		
		document.getElementById('currentCarrousel').innerHTML = str;
	}else{
		document.getElementById('currentCarrousel').innerHTML = '<a href="'+c[1]+'"><img src="'+c[0]+'" alt="carrousel" width="624" height="210" border="0" /></a>';
		}
}

