var lastWidth=0;var lastHeight=0;var callbackFunction="";function URLEncode(e){var g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()";var b="0123456789ABCDEF";var f="";for(var c=0;c<e.length;c++){var d=e.charAt(c);if(d==" "){f+="+"}else{if(g.indexOf(d)!=-1){f+=d}else{var a=d.charCodeAt(0);if(a>255){alert("Unicode Character '"+d+"' cannot be encoded using standard URL encoding.\n(URL encoding only supports 8-bit characters.)\nA space (+) will be substituted.");f+="+"}else{f+="%";f+=b.charAt((a>>4)&15);f+=b.charAt(a&15)}}}}return f}function URLDecode(e){var a="0123456789ABCDEFabcdef";var d="";var b=0;while(b<e.length){var c=e.charAt(b);if(c=="+"){d+=" ";b++}else{if(c=="%"){if(b<(e.length-2)&&a.indexOf(e.charAt(b+1))!=-1&&a.indexOf(e.charAt(b+2))!=-1){d+=unescape(e.substr(b,3));b+=3}else{alert("Bad escape combination near ..."+e.substr(b));d+="%[ERROR]";b++}}else{d+=c;b++}}}return d}function closeDialog(){if(typeof(window.customCloseDialog)=="function"){customCloseDialog()}fadeOutScreen();el=window.top.document.getElementById("jsWindow");js=window.top.document.getElementById("jsDialog");var ua=navigator.userAgent.toLowerCase();var msie=ua.indexOf("msie ");if(msie>0){$("#jsWindow").html("")}if(el){el.parentNode.removeChild(el)}if(js){js.parentNode.removeChild(js)}window.customCloseDialog="";if((typeof(callbackFunction)!="undefined")&&(callbackFunction!="")){eval(callbackFunction);callbackFunction=""}}function closeDialogAlert(){fadeOutScreen({alerta:"Alerta"});try{el=window.top.document.getElementById("jsWindowAlert");js=window.top.document.getElementById("jsDialogAlert")}catch(a){el=window.self.document.getElementById("jsWindowAlert");js=window.self.document.getElementById("jsDialogAlert")}if(el){el.parentNode.removeChild(el)}if(js){js.parentNode.removeChild(js)}}function ecms_confirm(a,b){if(confirm(a)){window.location.href=b}}function dialogAjaxLoadURL(a){var c={success:function(k){el=window.top.document.getElementById("divJSDialogContent");var d='<script id="initDlgScript" type="text/javascript">';var j="<\/script>";var i="";var g="";startScript=k.responseText.search(/<script [^>]*>/i);endScript=k.responseText.search(/<\/script>/i);if(startScript>-1){g=k.responseText.substring(0,startScript-1);i=k.responseText.substring(startScript,endScript-1);i=i.substring(i.search(/>/i)+1);var f=window.top.document.getElementsByTagName("head")[0];var e=window.top.document.getElementById("jsDialog");if(e){e.parentNode.removeChild(e)}e=window.top.document.createElement("script");e.type="text/javascript";e.id="jsDialog";e.text=i;f.appendChild(e);el.innerHTML=g}else{el.innerHTML=k.responseText}if(k.responseText.indexOf("tabber")>-1){var h=({});el=window.top.document.getElementById("dialog_tabber_object");tabber=new tabberObj(h);tabber.init(el)}if(k.responseText.indexOf("InputTextMandatory")>-1){checkMandatoryStartup()}if(k.responseText.indexOf("jsInitDialog()")>-1){jsInitDialog()}},upload:function(d){this.success(d)}};var b=YAHOO.util.Connect.asyncRequest("GET",a,c)}function getPageSizeWithScroll(){try{if(window.top.innerHeight&&window.top.scrollMaxY){yWithScroll=window.top.innerHeight+window.top.scrollMaxY;xWithScroll=window.top.innerWidth+window.top.scrollMaxX}else{if(window.top.document.body.scrollHeight>window.top.document.body.offsetHeight){yWithScroll=window.top.document.body.scrollHeight;xWithScroll=window.top.document.body.scrollWidth}else{yWithScroll=window.top.document.body.offsetHeight;xWithScroll=window.top.document.body.offsetWidth}}}catch(a){if(window.self.innerHeight&&window.self.scrollMaxY){yWithScroll=window.self.innerHeight+window.self.scrollMaxY;xWithScroll=window.self.innerWidth+window.self.scrollMaxX}else{if(window.self.document.body.scrollHeight>window.self.document.body.offsetHeight){yWithScroll=window.self.document.body.scrollHeight;xWithScroll=window.self.document.body.scrollWidth}else{yWithScroll=window.self.document.body.offsetHeight;xWithScroll=window.self.document.body.offsetWidth}}}arrayPageSizeWithScroll=new Array(xWithScroll,yWithScroll);return arrayPageSizeWithScroll}function fadeInScreen(c){alerta="";if(c!=null&&c.alerta=="Alerta"){alerta="Alerta"}ps=getPageSizeWithScroll();div='<div class="fade_screen" style="width:'+ps[0]+"px;height:"+ps[1]+'px;position:absolute;top:0;left:0;z-index:999;" id="_fade_div'+alerta+'">&nbsp;</div>';try{var a=window.top.document.createElement("div");a.innerHTML=div;window.top.document.getElementsByTagName("body")[0].appendChild(a);a.style.top="0px";a.style.left="0px"}catch(b){var a=window.self.document.createElement("div");a.innerHTML=div;window.self.document.getElementsByTagName("body")[0].appendChild(a);a.style.top="0px";a.style.left="0px"}}function fadeOutScreen(b){alerta="";if(b!=null&&b.alerta=="Alerta"){alerta="Alerta"}try{el=window.top.document.getElementById("_fade_div"+alerta)}catch(a){el=window.self.document.getElementById("_fade_div"+alerta)}if(el){el.parentNode.removeChild(el)}}function openAjaxDialog(c){var a=460;var b=370;if((typeof(c.width)!="undefined")&&(c.width!="")){a=parseInt(c.width)}if((typeof(c.height)!="undefined")&&(c.height!="")){b=parseInt(c.height)}openDialog(c.title,'<div style="left:'+(a-20)+"px;top:"+(((b-50)/2)-15)+'px;"><img src="/templates/todojunto/img/loading3.gif" width="31" height="31" /></div>',a,b,c.color,"",c.showclose);if((typeof(c.callback)!="undefined")&&(c.callback!="")){callbackFunction=c.callback}dialogAjaxLoadURL(c.url)}function openAlert(a){dw=350;dh=150;cntnt='<table style="width:100%;height:100%"><tr><td style="text-align:center"><img src="/templates/todojunto/img/ico/ico_alerta.gif"></td></tr><tr><td style="text-align:center">'+a+'</td></tr><tr><td style="text-align:center"><button id="buttonOk" type="submit" style="background-color:transparent;margin:0;border:0;cursor:pointer;width:auto;" onclick="closeDialogAlert();return false;" onmouseover="rolloverBoto(this.id);" onmouseout="rolloutBoto(this.id);"><table cellpadding="0" cellspacing="0"><tr><td id="buttonOk_e" class="button_e_down"></td><td id="buttonOk_c" class="button_c_down">'+strOk+'</td><td id="buttonOk_d" class="button_d_down"></td></tr></table></button></td></tr></table>';openDialog("Alerta",cntnt,dw,dh,"blue")}function openDialog(k,h,j,g,f,c,l,d){var b=navigator.userAgent.toLowerCase();var i=b.indexOf("msie ");if(i>0){var a=parseInt(b.substring(i+5,b.indexOf(".",i)))}else{var a=0}try{if(i>0){winW=window.top.document.body.offsetWidth;winH=window.top.document.documentElement.clientHeight;if(winH==0){winH=document.body.offsetHeight}}else{winW=window.top.innerWidth;winH=window.top.innerHeight}}catch(e){if(i>0){winW=window.self.document.body.offsetWidth;winH=window.self.document.documentElement.clientHeight;if(winH==0){winH=document.body.offsetHeight}}else{winW=window.self.innerWidth;winH=window.self.innerHeight}}jsLeft=(winW-parseInt(j))/2;try{if((a==0)||(a>=7)){jsTop=((winH-parseInt(g))/2)+window.top.document.documentElement.scrollTop}else{jsTop=((winH-parseInt(g))/2)+window.top.document.documentElement.scrollTop}}catch(e){if((a==0)||(a>=7)){jsTop=((winH-parseInt(g))/2)+window.self.document.documentElement.scrollTop}else{jsTop=((winH-parseInt(g))/2)+window.self.document.documentElement.scrollTop}}if(f==null){f="black"}if(typeof(l)=="undefined"){l=true}if(typeof(d)=="undefined"){d=""}win=_dialog_header({title:k,jsTop:jsTop,jsLeft:jsLeft,jsWidth:j,jsHeight:g,color:f,dv:c,showClose:l,tipus:d});win+=unescape(h);win+=_dialog_footer(f,j);if(k=="Alerta"){fadeInScreen({alerta:"Alerta"})}else{fadeInScreen()}try{dialogWindow=window.top.document.createElement("div");dialogWindow.innerHTML=win;dialogWindow.style.top=jsTop+"px";dialogWindow.style.left=jsLeft+"px";window.top.document.body.appendChild(dialogWindow)}catch(e){dialogWindow=window.self.document.createElement("div");dialogWindow.innerHTML=win;dialogWindow.style.top=jsTop+"px";dialogWindow.style.left=jsLeft+"px";window.self.document.body.appendChild(dialogWindow)}if(k=="Alerta"){dd=new YAHOO.util.DD("jsWindowAlerta");dd.useShim=true;dd.setHandleElId("jsWindowHandleAlerta")}else{dd=new YAHOO.util.DD("jsWindow");dd.useShim=true;dd.setHandleElId("jsWindowHandle")}}function openExtVideoDialog(d,c,a,e,b){incStats(b);if((c==0)||(c=="")){c=800}if((a==0)||(a=="")){a=600}openDialog(d,URLDecode(e),parseInt(c)+36,parseInt(a),"black","divJSDialogResources")}function openFLVDialog(e,d,b,a){if(typeof(e.codrecurs)!="undefined"){incStats(e.codrecurs,e.mirror)}if(typeof(e.mirror)=="undefined"){e.mirror=""}var c="";c+='<a href="'+e.mirror+"/"+e.file+'" style="display:block;width:425px;height:350px" id="player"></a>';openDialog(e.title,c,460,364,"black","divJSDialogResources","undefined","f4v");flowplayer("player","/flash/flowplayer327/flowplayer.commercial-3.2.7.swf",{key:key_flowplayer})}function openFLVDialog2(e,d,b,a){if(typeof(e.codrecurs)!="undefined"){incStats(e.codrecurs,e.mirror)}if(typeof(e.mirror)=="undefined"){e.mirror=""}var c="";c='<object type="application/x-shockwave-flash" data="'+e.mirror+'/flash/flowplayer/FlowPlayer.swf" width="425" height="350" id="FlowPlayer">';c+='	<param name="allowScriptAccess" value="always" />';c+='	<param name="movie" value="'+e.mirror+'/flash/flowplayer/FlowPlayer.swf" />';c+='	<param name="quality" value="high" />';c+='	<param name="scaleMode" value="showAll" />';c+='	<param name="allowfullscreen" value="false" />';c+='	<param name="wmode" value="transparent" />';c+='	<param name="allowNetworking" value="all" />';c+='	<param name="flashvars" value="config={ ';c+="		autoPlay: false, ";c+="		loop: false, ";c+="		initialScale: 'scale',";c+="		showLoopButton: false,";c+="		showPlayListButtons: false,";c+="     showMenu: false,";c+="     fullScreenScriptURL: '',";c+="		playList: [";c+="			{ url: '"+e.mirror+"/"+e.file+"', type: 'flv' }";c+="		]";c+='		}" />';c+="</object>";openDialog(e.title,c,460,370,"black","divJSDialogResources")}function openIMGDialog(b){if(typeof(b.codrecurs)!="undefined"){incStats(b.codrecurs,b.mirror)}if(typeof(b.mirror)=="undefined"){b.mirror=""}margin_top=72;margin_left=36;width=800;height=600;if(navigator.appName.indexOf("Microsoft")!=-1){maxH=document.body.offsetHeight-20}else{maxH=window.innerHeight-16}if(height>maxH){ratio=maxH/height;height=maxH;width=Math.round(width*ratio)}var a="";a='<div height="'+height+'"><img src="'+b.mirror+"/"+b.imatge+'" alt="'+b.title+'" style="max-width:'+width+"px;width:expression(this.width>"+width+" ? '"+width+"px' : true);max-height:"+height+"px;height:expression(this.height>"+height+"?'"+height+"px':true);\" /></div>";openDialog(b.title,a,parseInt(width)+margin_left,parseInt(height)+margin_top,"black","divJSDialogResources")}function openResource(params){$.get("index.php",{di:1,p:"resources",op:"openResource",idRecurs:params.id},function(data){eval(data)})}function openMP3Dialog(b){if(typeof(b.codrecurs)!="undefined"){incStats(b.codrecurs,b.mirror)}if(typeof(b.mirror)=="undefined"){b.mirror=""}var a="";a='<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="240" height="70">';a='<param name="movie" value="'+b.mirror+'/flash/reproductor.swf">';a='<param name="quality" value="high">';a='<embed src="'+b.mirror+"/flash/reproductor.swf?titol="+URLEncode(b.title)+"&reduccio=0&ruta="+b.mirror+b.file+'&descarrega=false&sgae=false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="240" height="70"></embed></object>';openDialog(b.title,a,276,70,"black","divJSDialogResources")}function openSWFDialog(c){if(typeof(c.mirror)=="undefined"){c.mirror=""}if(typeof(c.codrecurs)!="undefined"){incStats(c.codrecurs,c.mirror)}var b=false;if(typeof(c.nova_finestra)!="undefined"&&c.nova_finestra==1){b=true}base_path=c.base_path;c.mirror="";base_path=c.file.substring(0,c.file.lastIndexOf("/")+1);margin_top=72;margin_left=36;if((c.width==0)||(c.width=="")){c.width=800}if((c.height==0)||(c.height=="")){c.height=600}if(navigator.appName.indexOf("Microsoft")!=-1){maxH=document.body.offsetHeight-20-(margin_top*2)}else{maxH=window.innerHeight-16-(margin_top*2)}if(c.height>maxH){ratio=maxH/c.height;c.height=maxH;c.width=Math.round(c.width*ratio)}if(b){window.open("/openSwf.php?&codrecurs="+c.codrecurs+"&mirror="+c.mirror)}else{var a="";a="<div>";a+='<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="'+c.width+'" height="'+c.height+'" allowFullScreen="true">';a+='<param name="movie" value="'+c.mirror+c.file+'" />';a+='<param name="quality" value="high" />';a+='<param name="base" value="'+base_path+'" />';a+='<param name="allowFullScreen" value="true" />';if(c.parametre!=""&&c.valor!=""){a+='<param name="'+c.parametre+'" value="'+c.valor+'"/>'}a+='<embed src="'+c.mirror+c.file+'" quality="high" base="'+base_path+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+c.width+'" height="'+c.height+'" allowFullScreen="true"></embed>';a+="</object>";a+="</div>";if(c.mirror.search("mirror")!=-1){c.mirror=c.mirror.replace("http://","")}else{c.mirror=""}a+='<div style="text-align:center;margin-top:10px;"><a href="javascript:void(0);" onclick="window.open(\'/openSwf.php?&codrecurs='+c.codrecurs+"&mirror="+c.mirror+"');\">"+strNovaFinestra+"</a></div>";openDialog(c.title,"",parseInt(c.width)+margin_left,parseInt(c.height)+margin_top,"black","divJSDialogResources");YAHOO.util.Dom.get("divJSDialogResources").innerHTML=a}}function openLink(b,a){incStats(a);window.open(b,"_blank")}function resizeDialog(b,a){el=document.getElementById("jsWindowArea");if(el){window.lastWidth=el.style.width;window.lastHeight=el.style.height;el.style.width=b+"px";el.style.height=a+"px"}}function restoreDialogSize(){resizeDialog(parseInt(window.lastWidth),parseInt(window.lastHeight))}function carregarMp3FlowPlayer(){$(".fpAudio").each(function(){flowplayer(this.id,{wmode:"opaque",src:"/flash/flowplayer327/flowplayer.commercial-3.2.7.swf"},{key:key_flowplayer,plugins:{controls:{fullscreen:false,height:30,autoHide:false}},clip:{autoPlay:false}})})}function carregarVideosActivitats(){$(".fpVideo").each(function(){flowplayer(this.id,{wmode:"opaque",src:"/flash/flowplayer327/flowplayer.commercial-3.2.7.swf"},{key:key_flowplayer,clip:{autoPlay:false}})})}$(document).ready(function(){$(document).keyup(function(a){if(a.keyCode==27){closeDialog();closeDialogAlert()}})});
