
var supersleight=false;function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p){d.MM_p=new Array();}
var i;var j=d.MM_p.length;var 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 preloadImages(imagesLink){if(document.images){var images=[]
var i=0
while(i<imagesLink.length){images[i]=new Image();images[i].src=imagesLink[i]
i++}}}
sfondo=1;function cambia_sfondo(){if(sfondo==3){sfondo=1;}else{sfondo++;}
obj=document.getElementById("contenuto");obj.style.backgroundImage="url(img/sfondo"+sfondo+".gif)";}
function rollOver(obj,img){return function(){if(obj.hasClassName('img_rollover')){obj.src=img;if(supersleight&&img.match(/\.png/i)!==null){supersleight.aggiorna(obj);}}}}
function attiva_rollover(obj){try{filtro=obj.style.filter;if(supersleight&&filtro){inizio="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='";src=filtro.substr(inizio.length);src=src.substr(0,src.indexOf("'"));}else{src=obj.getAttribute('src');}
if(src.match(/\_on./i)===null){nome_img=src.replace(/(.+)\.(\w+)\??[0-9]*$/,"$1");estensione_img=src.replace(/.*\/?[a-zA-Z0-9_-]+\.(\w+)\??[0-9]*$/,"$1");img_on=nome_img+"_on."+estensione_img;img_off=nome_img+"."+estensione_img;MM_preloadImages(img_on);Event.observe(obj,'mouseover',rollOver(obj,img_on));Event.observe(obj,'mouseout',rollOver(obj,img_off));}}catch(e){alert("An exception occurred in attiva_rollover(). Error name: "+e.name
+". Error message: "+e.message)}}
function cerca_rollover(){if($$('.img_rollover')){classi=$$('.img_rollover');$$('.img_rollover').each(function(obj){attiva_rollover(obj);});}}
function cerca_rollover_on_specific_kidget(kidId){if($$('#'+kidId+' .img_rollover ')){classi=$$('#'+kidId+' .img_rollover');$$('#'+kidId+' .img_rollover').each(function(obj){attiva_rollover(obj);});}}
function cerca_rollover_outside_kidget(kidClass){imgRolloverOnPage=$$('.img_rollover');var kidgets=$$(' .'+kidClass);imgRolloverInKidgetS=new Array();kidgets.each(function(kidget){imgRolloverInKidget=kidget.getElementsByClassName('img_rollover')
for(i=0;i<imgRolloverInKidget.length;i++){imgRolloverInKidgetS.push(imgRolloverInKidget[i]);}})
imgRolloverInKidgetS.each(function(elToRemove){imgRolloverOnPage=imgRolloverOnPage.without(elToRemove)})
imgRolloverOnPage.each(function(obj){attiva_rollover(obj);})}
function scroll_func(e){if(document.compatMode&&document.compatMode!="BackCompat"&&BrowserDetect.browser!='Safari'){var body=document.documentElement;}else{var body=document.body;}
if((body.scrollTop+$('tabFlaps').offsetHeight)<=$('mypage').offsetHeight){$('tabFlaps').style.top=body.scrollTop+"px";}else{$('tabFlaps').style.top=($('mypage').offsetHeight)-$('tabFlaps').offsetHeight+"px";}}
function blocca_contextmenu(e){Event.stop(e);}
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},isIPad:function(){return(this.browser=="Safari"&&this.OS=="iPad");},isIPhone:function(){return(this.browser=="Safari"&&this.OS=="iPhone");},isIPod:function(){return(this.browser=="Safari"&&this.OS=="iPod");},supportHTML5:function(){return(this.isIPad()||this.isIPhone()||this.isIPod());},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"Paparazzi",identity:"Paparazzi"},{string:navigator.userAgent,subString:"AdobeAIR",identity:"AdobeAIR"},{string:navigator.vendor,subString:"Apple",versionSearch:"Version",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"MacPPC",identity:"Mac"},{string:navigator.platform,subString:"MacIntel",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"},{string:navigator.platform,subString:"iPod",identity:"iPod"},{string:navigator.platform,subString:"iPhone",identity:"iPhone"},{string:navigator.platform,subString:"iPad",identity:"iPad"}]};BrowserDetect.init();function validateEmail(email)
{if(email.length<=0)
{return false;}
var splitted=email.match("^(.+)@(.+)$");if(splitted==null)return false;if(splitted[1]!=null)
{var regexp_user=/^\"?[\w-_\.]*\"?$/;if(splitted[1].match(regexp_user)==null)return false;}
if(splitted[2]!=null)
{var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;if(splitted[2].match(regexp_domain)==null)
{var regexp_ip=/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;if(splitted[2].match(regexp_ip)==null)return false;}
return true;}
return false;}
function detectBrowser(args)
{var errore_browser=true;allowedBrowsersDefault=[{name:'Safari',minVer:3},{name:'Firefox',minVer:2},{name:'Explorer',minVer:7},{name:'Chrome'},{name:'Paparazzi'},{name:'AdobeAIR'}]
if((typeof args!='undefined')&&(typeof args.skipBrowser!='undefined')&&(args.skipBrowser==true)){errore_browser=false;}else{allowedBrowsers=((typeof args=='undefined')||(typeof args.allowedBrowsers=='undefined'))?allowedBrowsersDefault:args.allowedBrowsers
allowedBrowsers.each(function(b){if((BrowserDetect.browser==b.name)&&((typeof b.minVer=='undefined')||(BrowserDetect.version>=b.minVer))){errore_browser=false;throw $break;}})}
var errore_flash=false;var errore_cookie=true;var cookieEnabled=(navigator.cookieEnabled)?true:false
if(cookieEnabled){var tmpcookie=new Date();chkcookie=(tmpcookie.getTime()+'');document.cookie="chkcookie="+chkcookie+"; path=/";if(document.cookie.indexOf(chkcookie,0)<0){errore_cookie=true;}else{errore_cookie=false;}}else{errore_cookie=true;}
array_errori=Array();array_errori['errore_browser']=errore_browser;array_errori['errore_flash']=errore_flash;array_errori['errore_cookie']=errore_cookie;return array_errori;}
function validateBrowser(args)
{array_errori=detectBrowser(args);if(array_errori['errore_browser']){return false;}
if(array_errori['errore_flash']){return false;}
if(array_errori['errore_cookie']){return false;}
return true;}
MPCookies={create:function(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=/";},read:function(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;},erase:function(name){createCookie(name,"",-1);}};function getTimeZone(){var rightNow=new Date();var jan1=new Date(rightNow.getFullYear(),0,1,0,0,0,0);var temp=jan1.toGMTString();var jan2=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));var std_time_offset=(jan1-jan2)/(1000*60*60);return std_time_offset
var june1=new Date(rightNow.getFullYear(),6,1,0,0,0,0);temp=june1.toGMTString();var june2=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));var daylight_time_offset=(june1-june2)/(1000*60*60);if(std_time_offset==daylight_time_offset){return std_time_offset;}else{return std_time_offset-1;}}
function checkEmailPattern(args){if(args.email==null||args.email.strip()==""||args.email.indexOf('@')==-1){return false;}
var account=args.email.split('@')[0];if(account==null||account.strip()==""||account.strip().indexOf(" ")!=-1){return false;}
var domain=args.email.split('@')[1];if(domain==null||domain.strip()==""||domain.strip().indexOf(" ")!=-1||domain.indexOf('.')==-1){return false;}else{domain='@'+domain;}
var rejectedDomains=['gmail.it','g-mail','@otmail','hotmaill','yaoo','yaooh','yhoo','yaho.','fastewebnet','@ibero.it','yhaoo','libero.net','libero.com','@lice.it'];var rejectedAccounts=['www'];var isOk=true;rejectedDomains.each(function(rejDom){if(domain.indexOf(rejDom)!=-1){isOk=false;throw $break;}})
rejectedAccounts.each(function(rejAcc){if(account.indexOf(rejAcc)!=-1){isOk=false;throw $break;}})
return isOk;}
var UpperBar=Class.create({initialize:function(){this.mainDiv=$('upper_bar');this.browserAlerts=$('browser_alerts');this.browserNotSupportedAdvise=$('browser_not_supported_adv');this.javascriptNotEnabledAdvise=$('javascript_not_enabled_adv');this.cookiesNotEnabledAdvise=$('cookies_not_enabled_adv');this.iPadBetaAdvise=$("ipad_beta_adv");this.components=new Hash();},showAlert:function(args){var showBar=true
if(args.component){if((args.component=='browser_alert')&&(args.alert)){if((typeof this.browserAlerts!='undefined')&&(typeof this.browserNotSupportedAdvise!='undefined')&&(typeof this.javascriptNotEnabledAdvise!='undefined')&&(typeof this.cookiesNotEnabledAdvise!='undefined')){this.browserNotSupportedAdvise.hide();this.javascriptNotEnabledAdvise.hide();this.cookiesNotEnabledAdvise.hide();switch(args.alert){case'browser_not_supported':this.browserNotSupportedAdvise.show();break;case'javascript_not_enabled':this.javascriptNotEnabledAdvise.show();break;case'cookies_not_enabled':this.cookiesNotEnabledAdvise.show();break;case'iPad_beta':this.iPadBetaAdvise.show();break;default:showBar=false;null;}
showBar?this.browserAlerts.show():this.browserAlerts.hide();}}else{showBar=false;}}
showBar?this.mainDiv.show():this.mainDiv.hide();},hideBar:function(){Effect.BlindUp(this.mainDiv,{duration:0.7});}})
function generalReloadPage(){window.location.reload(true);}
function getNextHighestZindex(obj){var highestIndex=0;var currentIndex=0;var elArray=Array();if(obj){elArray=obj.getElementsByTagName('*');}else{elArray=document.getElementsByTagName('*');}
for(var i=0;i<elArray.length;i++){if(elArray[i].currentStyle){currentIndex=parseFloat(elArray[i].currentStyle['zIndex']);}else if(window.getComputedStyle){currentIndex=parseFloat(document.defaultView.getComputedStyle(elArray[i],null).getPropertyValue('z-index'));}
if(!isNaN(currentIndex)&&currentIndex>highestIndex){highestIndex=currentIndex;}}
return(highestIndex+1);}
var Overlayer=Class.create({initialize:function(userManager){this.container=$('overlayer');this.userManager=userManager;this.banner_now=null;this.banner_last=null;this.pe=null;this.periodicalUpdateInterval=8;},show:function(){if(this.container==null){this.container=$('overlayer');}
this.container.show();},hide:function(options){if((typeof options!='undefined')&&(options.stop==true)){this.stopBanner();}
new Effect.Opacity($('overlayer'),{duration:0.3,from:1,to:0,afterFinish:function(effect){$('overlayer').hide()}});},startBanner:function(options){if(options!=null&&options.flashBanner==true){}else{if($$('#overlayer_int .banner').length){this.banner_now=1;var objs=$$('#overlayer_int .banner');this.banner_last=objs.last().getAttribute('id').replace('banner_','');this.pe=new PeriodicalExecuter(this.update.bindAsEventListener(this),this.periodicalUpdateInterval);}}},stopBanner:function(){if(this.pe!=null){this.pe.stop()}
var flashContainer=$$("#overlayer_int .flash")[0]
if(flashContainer!=null){flashContainer.innerHTML="";}},update:function(){this.scrollBanner({direction:'next'});},scrollBanner:function(options){var direction=(options!=null&&['next','prev'].indexOf(options.direction)!=-1)?options.direction:'next';var next=(direction=='next')?(this.banner_now+1<=this.banner_last?this.banner_now+1:1):(this.banner_now-1<1?this.banner_last:this.banner_now-1)
Effect.Fade('banner_'+this.banner_now);Effect.Appear('banner_'+next);this.banner_now=next;},skipNextBtnClicked:function(options){this.pe.stop();this.scrollBanner({direction:'next'});this.pe=new PeriodicalExecuter(this.update.bindAsEventListener(this),this.periodicalUpdateInterval);},skipPrevBtnClicked:function(){this.pe.stop();this.scrollBanner({direction:'prev'});this.pe=new PeriodicalExecuter(this.update.bindAsEventListener(this),this.periodicalUpdateInterval);},goBtnClicked:function(){switch(this.banner_now){case 1:this.userManager.goToPage({page:'friends',allowLogin:true});this.hide({stop:true});break;case 2:this.userManager.goToPage({page:'profile',tab:'magic_spell',allowLogin:true});this.hide({stop:true});break;case 3:this.userManager.goToPage({page:'profile',tab:'avatar',allowLogin:true});this.hide({stop:true});}}})
function getStringDimension(args){var string=args.string;var maxDim=args.maxDim;var dimension=0;if(string.strip().length>0){var stringToArray=string.toArray();var character=null;for(var i=0;i<stringToArray.length;i++){switch(stringToArray[i].toUpperCase()){case"M":dimension+=maxDim;break;case"W":dimension+=maxDim;break;case"I":dimension+=parseInt(maxDim*0.5);break;case"J":dimension+=parseInt(maxDim*0.5);break;case"L":dimension+=parseInt(maxDim*0.5);break;default:dimension+=parseInt(maxDim*0.8);}}}
return(dimension);}
var MPDownloadButton=Class.create({initialize:function(params){this.button=new Hash;this.download=new Hash;this.kidget=new Hash;this.user=new Hash;this.button.classes=params.button.classes?params.button.classes:'';this.button.html=params.button.html?params.button.html:'';this.button.positions=params.button.positions?params.button.positions.split(','):alert('Devi definire almeno una posizione per il pulsante!');this.download.file=params.download.file?params.download.file:alert('Andiamo in produzione senza un file da scaricare? Ne sei sicuro?');this.download.locale=params.download.locale?params.download.locale:false;this.download.path=params.download.path?params.download.path:alert('Non c\'è un file da scaricare!');this.download.throughPopup=params.download.throughPopup?params.download.throughPopup:false;this.download.tracking=params.download.tracking?params.download.tracking:true;this.kidget.id=params.kidget.id?params.kidget.id:alert('Devi dirmi di che kidget si tratta! L\'ID!!!');this.kidget.istance=params.kidget.istance?params.kidget.istance:alert('Devi dirmi l\'ID d\'istanza del Kidget!');this.user.lang=pageTabs.getUserLang()?pageTabs.getUserLang():'it';this.user.canDownload=pageTabs.userCanDownloadMedia();this.build(this.button.positions);this.bind(params.specificBind);},build:function(positions){for(var i=0;i<Number(positions.length);i++){if(this.button.html==''){this.button.html+='<a ';this.button.html+='href="'+(this.user.canDownload?(!this.download.throughPopup?this.download.path:'javascript:void(0)'):'javascript:void(0)')+'" ';this.button.html+=this.user.canDownload?'target="_blank" ':'';this.button.html+='class="MPDownloadButton scarica-'+this.user.lang+' '+(!this.user.canDownload?'cant-download':'')+' '+this.button.classes+'"';this.button.html+='>';this.button.html+=i18n.stringLocale('download_and_play','dialog');this.button.html+=this.user.canDownload?'':'<span>'+i18n.stringLocale('cant_download','dialog')+'</span>';this.button.html+='</a>';}
$$('#'+this.kidget.istance+' '+positions[i])[0].insert(this.button.html);}},bind:function(specificBind){Event.observe($$('#'+this.kidget.istance+' .scarica-'+this.user.lang)[0],'click',this.clicked.bindAsEventListener(this));if(typeof(specificBind)=='function'){specificBind();}},clicked:function(){if(this.user.canDownload){if(this.download.tracking){eventTracking.trackingDownloadPDF(this.kidget.id,this.download.file);}
if(this.download.throughPopup){window.open(this.download.path,"Download_completo","menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");}}else{}}});var MPEventTracking=Class.create({initialize:function(){this.categoriesHash={video:{profile:"VIDEO | PROFILE",stop:"VIDEO"},game:{profile:"GAME | PROFILE",stop:"GAME"},pdf:{profile:"PDF | PROFILE",kidget:"PDF | KIDGET",fan_award:"PDF | FAN-AWARD",stop:"PDF"},wallpaper:{award:{award:"WALLPAPER | AWARD ",teaser:"WALLPAPER | AWARD | TEASER "},stop:"WALLPAPER"},theme:{award:{teaser:"FF_THEME | AWARD | TEASER "},stop:"THEME"},emoticons:{award:{teaser:"MSN_EMOTICONS | AWARD | TEASER "},stop:"EMOTICONS"},msn_background:{award:{teaser:"MSN_BACKGROUNDS | AWARD | TEASER "},stop:"BACKGROUNDS"}}
this.actionsHash={download:"DOWNLOAD",play:"PLAY"}},track:function(params){var category=params.category;if(params.kidgetId){category+=" | KIDGET | "+params.kidgetId;}
this.doTracking(category,params.action,params.urlToFIle,params.optionalValue)
if(params.throughPopup&&params.downloadable){window.open(params.urlToFIle,"Download_completo","menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");}},doTracking:function(category,action,optional_label,optional_value){optional_label=typeof(optional_label)!='undefined'?optional_label:'nolabel';optional_value=typeof(optional_value)!='undefined'?optional_value:'novalue';if(typeof(pageTracker)!='undefined'){pageTracker._trackEvent(category,action,optional_label);}else{_gaq.push(['_trackEvent',category,action,optional_label])}},trackingDownloadPDF:function(params){this.doTracking(params.string,this.action.get(params.action),params.urlToFile);}});var eventTracking=new MPEventTracking();var CountDown=Class.create({initialize:function(options){this.pe=null
this.dateNow=null
this.expireYear=options.expireYears||0
this.expireMounth=options.expireMounth||0
this.expireDay=options.expireDay||0
this.expireHour=options.expireHour||0
this.expireMinute=options.expireMinute||0
this.expireSecond=options.expireSecond||0
this.intervalTimesPossible=["days","hours","minutes","seconds"]
this.dateForExpire=new Date(this.expireYear,this.expireMounth,this.expireDay,this.expireHour,this.expireMinute,this.expireSecond)
this.elements=new Hash
this.format=options.formatOfTime
this.numbersWithImage=options.numberShowedByImages||null
this.generalPath=options.generalPathForImage||""
this.elements.set("years",options.divElementForYears||"")
this.elements.set("mounth",options.divElementForMonths||"")
this.elements.set("days",options.divElementForDays||"")
this.elements.set("hours",options.divElementForHours||"")
this.elements.set("minutes",options.divElementForMinutes||"")
this.elements.set("seconds",options.divElementForSeconds||"")
this.callBack=options.callback||null
this.intervalTime=1
this.peForCountDown=null
this.peForCallback=null},start:function(){this.peForCountDown=new PeriodicalExecuter(this.countDown.bind(this),this.intervalTime);if(this.callBack){this.peForCallback=new PeriodicalExecuter(this.callBack.callback.bind(this),(this.callBack.interval/1000));}},countDown:function(){this.dateNow=new Date()
var timeRemainingInSeconds=(this.dateForExpire.getTime()-this.dateNow.getTime())/1000
var elementForCalculate=null
for(var i=0;i<this.intervalTimesPossible.size();i++){elementForCalculate=this.elements.get(this.intervalTimesPossible[i])
if(elementForCalculate!=""&&elementForCalculate!=undefined&&elementForCalculate!=null){this.insertStringFromattedIntoElement(elementForCalculate,this.buildStringFormattedForElement(elementForCalculate,this.buildStringArrayFromTimeToCalculate(timeRemainingInSeconds,this.intervalTimesPossible[i])))}}},buildStringArrayFromTimeToCalculate:function(timeRemainingInSeconds,kindOfInterval){var intervalCalculated=0
switch(kindOfInterval){case"days":intervalCalculated=60*60*24
break;case"hours":intervalCalculated=60*60
break;case"minutes":intervalCalculated=60
break;case"seconds":intervalCalculated=1
break;}
var timeFormatted=[]
var timeEffective=((Math.floor(timeRemainingInSeconds/intervalCalculated))).toString();var j=0
timeEffective=timeEffective.toArray()
while(j<timeEffective.size()){timeFormatted[j]=timeEffective[j]
j++}
return timeFormatted},insertStringFromattedIntoElement:function(element,formattedString){var i=0
if(element.size()==1){var string=""
while(i<formattedString.size()){string+=formattedString[i]
i++}
element[0].innerHTML=string}else{for(i=element.size()-1;i>=0;i--){element[i].innerHTML=(formattedString[i]!=undefined)?formattedString[i]:"0"}}},buildStringFormattedForElement:function(elementToInsert,arrayStringFromTime){var intervalTimeFromatted=[]
if(elementToInsert.size()!=1){var difference=elementToInsert.size()-arrayStringFromTime.length
var i=0
for(i;i<difference;i++){intervalTimeFromatted[i]="0"}
var j=0
for(i;i<arrayStringFromTime.length+difference;i++){intervalTimeFromatted[i]=arrayStringFromTime[j]
j++}}else{intervalTimeFromatted=arrayStringFromTime}
return intervalTimeFromatted}});var SlidingBuilder=Class.create({initialize:function(options){this.slidingContainer=new SlidingContainer({imageContainer:options.imageContainer,allTheImages:options.allTheImages,imageSet:options.imageSet,effectForSliding:options.effectForSliding,imagesHasPreview:options.imagesHasPreview,choiceContainer:options.choiceContainer,divImageInformation:options.divImageInformation,image_preview:options.image_preview})
this.slidingContainer.build()
this.effectSliding=new EffectSliding({objectSlidingContainer:this.slidingContainer,imageContainer:options.imageContainer,effectMovement:options.effectMovement,effectFading:options.effectFading,directionOfEffect:options.directionOfEffect,scrollForSlice:$$('.imageTeaser')[0].scrollWidth,imageSet:options.imageSet})
this.chrono=new Chrono({effectObject:this.effectSliding,image_has_preview:options.image_preview,imageSet:options.imageSet,slidingContainer:this.slidingContainer,nrOfSlice:options.imageContainer.children.length,durationOfEffect:options.durationOfEffect,divImageInformation:options.divImageInformation?true:false,intervalTime:options.intervalTime})},build:function(){this.chrono.checkLoadedImages()
this.chrono.start()}})
var SlidingContainer=Class.create({initialize:function(options){this.allTheImages=options.allTheImages
this.imageContainer=options.imageContainer
this.originalLenght=this.allTheImages.size()
this.imageSet=options.imageSet||"sliding"
this.imageDimensions=options.imageDimension||null
this.imagePreview=options.image_preview
this.effectForSliding=options.effectForSliding||"scroll"
options.imagesHasPreview?this.imagesHasPreview=true:this.imagesHasPreview=false
options.choiceContainer?this.choiceContainer=options.choiceContainer:this.choiceContainer=null
options.divImageInformation?this.divImageInformation=options.divImageInformation:this.divImageInformation=null},emptyFunction:function(){},build:function(options){this.buildSlidingImage()
this.choiceContainer?this.buildDirectChoiceElement():null
this.divImageInformation?this.buildDivImageInformation():null},buildSlidingImage:function(){this.imageContainer.insert({bottom:this.htmlForImages()})},insertSlidingImage:function(){this.buildSlidingImage()},removeOldsSlice:function(){var i=0
while(i<this.originalLength){delete this.imageContainer.children[i]
i++}},buildDirectChoiceElement:function(){this.choiceContainer.insert({bottom:this.htmlForDirectChoiceElement()})},buildDivImageInformation:function(){this.divImageInformation.insert({bottom:'<span class="title"></span><span class="subTitle"></span>'})},getStyleForImage:function(show){if(this.imageSet=="fading"){if(show){return"position:absolute;  -moz-opacity: 0; -khtml-opacity: 0; opacity:1; filter:alpha(opacity=1);"}
return"position:absolute; -moz-opacity: 0 -khtml-opacity: 0; opacity:0; filter:alpha(opacity=0);display:none;"}else if(this.imageSet=="sliding"){return"position:relative; float:left; margin:0px;"}
return null},htmlForImages:function(){var htmlForAllImages=''
var htmlForSingleImage=''
for(var i=0;i<this.allTheImages.size();i++){htmlForAllImages+='<a id=\"image_'+this.allTheImages[i].id+'\" class=\"imageTeaser\" style=\"'+this.getStyleForImage((i==0)?true:false)+'\" '
this.allTheImages[i].in_new_window?htmlForSingleImage+=' target=\"_blank\"':htmlForSingleImage+=''
this.allTheImages[i].link?htmlForSingleImage+=' href=\"'+this.allTheImages[i].link+'\">':htmlForSingleImage+='>'
this.allTheImages[i].url?htmlForSingleImage+='<img class=\"imageTeaser\" src=\"'+this.allTheImages[i].url+'\" ':htmlForSingleImage+=''
this.allTheImages[i].title?htmlForSingleImage+=' alt=\"'+this.allTheImages[i].title+'\"/>':htmlForSingleImage+='>'
htmlForAllImages=htmlForAllImages+htmlForSingleImage+'</a>'
htmlForSingleImage=""}
if(this.imageSet=="sliding"){htmlForAllImages+='<a id=\"image_'+this.allTheImages[0].id+' clone\" class=\"\" style=\"'+this.getStyleForImage((i==0)?true:false)+'\" '
this.allTheImages[0].in_new_window?htmlForSingleImage+=' target=\"_blank\"':htmlForSingleImage+=''
this.allTheImages[0].link?htmlForSingleImage+=' href=\"'+this.allTheImages[0].link+'\">':htmlForSingleImage+='>'
this.allTheImages[0].url?htmlForSingleImage+='<img class=\"imageTeaser\" src=\"'+this.allTheImages[0].url+'\" ':htmlForSingleImage+=''
this.allTheImages[0].title?htmlForSingleImage+=' alt=\"'+this.allTheImages[0].title+'\"/>':htmlForSingleImage+='>'
htmlForAllImages=htmlForAllImages+htmlForSingleImage+'</a>'
htmlForSingleImage=""}
return htmlForAllImages},htmlForDirectChoiceElement:function(){var htmlForAllDirectChoice=''
var htmlForSingleElement=''
for(var i=0;i<this.allTheImages.size();i++){if(this.imagePreview){htmlForSingleElement='<div class=\"singleDirectChoice direct_choice_'+this.allTheImages[i].id+'\">'
this.allTheImages[i].url_to_preview?htmlForSingleElement+='<img src=\"'+this.allTheImages[i].url_to_preview+'\" style=\"width:100%;height:100%\" alt=\"'+this.allTheImages[i].title+'\" />':htmlForSingleElement+='<img src=\"'+this.allTheImages[i].url+'\" style=\"width:100%;height:100%\" alt=\"'+this.allTheImages[i].title+'\" />'
htmlForAllDirectChoice=htmlForAllDirectChoice+htmlForSingleElement+'</div>'}else{htmlForSingleElement='<button class=\"singleDirectChoice direct_choice_'+this.allTheImages[i].id+'\">'
htmlForAllDirectChoice=htmlForAllDirectChoice+htmlForSingleElement+'</button>'}}
return htmlForAllDirectChoice},insertImageInformation:function(nrSlice){this.divImageInformation.children[0].innerHTML=this.allTheImages[nrSlice].title
this.divImageInformation.children[1].innerHTML=this.allTheImages[nrSlice].subtitle},insertImage:function(){this.imageContainer.style.right="0px"
this.imageContainer.update(this.htmlForImages())},setOpacityForElement:function(sliceElement){sliceElement.show()
sliceElement.style.opacity="opacity:0.0"
sliceElement.style.filter="alpha(opacity=0.0)"
sliceElement.style.MozOpacity=0;sliceElement.style.KhtmlOpacity=0;}});var Chrono=Class.create({initialize:function(options){this.effectObject=options.effectObject
this.intervalTime=options.intervalTime||1
this.durationOfEffect=options.durationOfEffect,this.slidingContainerObject=options.slidingContainer;this.nrOfSlice=options.nrOfSlice
this.directChoose=this.slidingContainerObject.choiceContainer
this.imageHasPreview=options.image_has_preview
this.divImageInformation=options.divImageInformation?true:false
this.prevSlice=0
this.imageSet=options.imageSet
this.currentSlice=0
this.nextSlice=1
this.linearSliding=options.linearSliding||true
this.sliceChoosebyUser=false
this.currentPeriodicalExecuter=0
this.periodicalExecuter=[]
this.periodicalExecuterForClick=null
this.i=0},deleteLoadSpinner:function(){if($$('.imagesList')[0]!=null){$$('.teaser_preload_spinner')[0].hide()
this.periodicalExecuterForClick.stop()}},checkLoadedImages:function(){this.periodicalExecuterForClick=new PeriodicalExecuter(this.deleteLoadSpinner.bind(this),0.1);},start:function(){this.effectObject.update(this)
this.showSlideInformation()
this.setImageStausForDirectChoose()
this.directChoose?this.bindDirectChoose({all:true}):null
this.periodicalExecuter[this.currentPeriodicalExecuter]=new PeriodicalExecuter(this.callSlidingObject.bind(this),this.intervalTime);},imgOver:function(window,element,isImg){if(isImg){element.style.borderWidth='2px'
element.style.borderStyle='solid'
element.style.borderColor='#f2e400'}else{element.style.backgroundColor='#aaaaaa'}},imgOut:function(window,element,isImg){if(isImg){element.style.borderWidth='2px'
element.style.borderStyle='solid'
element.style.borderColor='#FFFFFF'}else{element.style.backgroundColor='#2cbfde'}},bindDirectChoose:function(options){if(options.all){var i=0
var singleElement=null
while(i<this.directChoose.children.length){singleElement=this.directChoose.children[i]
Event.observe(singleElement,'mouseover',this.imgOver.bindAsEventListener(this,singleElement,this.imageHasPreview))
Event.observe(singleElement,'mouseout',this.imgOut.bindAsEventListener(this,singleElement,this.imageHasPreview))
Event.observe(singleElement,'click',this.sliceChoose.bindAsEventListener(this,i))
i++}}else{var singleElement=this.directChoose.children[options.idElement]
singleElement.style.cursor="pointer"
Event.observe(singleElement,'mouseover',this.imgOver.bindAsEventListener(this,singleElement,this.imageHasPreview))
Event.observe(singleElement,'mouseout',this.imgOut.bindAsEventListener(this,singleElement,this.imageHasPreview))
Event.observe(singleElement,'click',this.sliceChoose.bindAsEventListener(this,options.idElement))}},stopObserve:function(){var singleElement=this.directChoose.children[(this.currentSlice==this.nrOfSlice-1)?0:this.currentSlice]
singleElement.style.cursor=""
Event.stopObserving(singleElement,'mouseover')
Event.stopObserving(singleElement,'mouseout')
Event.stopObserving(singleElement,'click')},sliceChoose:function(window,elementChoose){if(elementChoose!=this.currentSlice){this.nextSlice=elementChoose
this.sliceChoosebyUser=true
this.callEffectAfterClick()}},callEffectAfterClick:function(){if(this.effectIsFinished){this.periodicalExecuter[this.currentPeriodicalExecuter].stop()
this.callSlidingObject()
this.currentPeriodicalExecuter++
this.periodicalExecuter[this.currentPeriodicalExecuter]=new PeriodicalExecuter(this.callSlidingObject.bind(this),this.intervalTime);}},effectFinished:function(){this.effectIsFinished=true
this.showSlideInformation()
this.setImageStausForDirectChoose()},setImageStausForDirectChoose:function(){if(this.directChoose){this.stopObserve()
this.imgOut(null,this.slidingContainerObject.choiceContainer.children[this.checkForSlideToPass(this.prevSlice)],this.imageHasPreview)
this.imgOver(null,this.slidingContainerObject.choiceContainer.children[this.checkForSlideToPass(this.currentSlice)],this.imageHasPreview)
this.bindDirectChoose({idElement:this.checkForSlideToPass(this.prevSlice)})}},showSlideInformation:function(){if(this.divImageInformation)
this.slidingContainerObject.insertImageInformation(this.checkForSlideToPass(this.currentSlice))},stop:function(){this.periodicalExecuter.stop()},checkForSlideToPass:function(slide){if(this.imageSet=="fading")
return slide
else
return(slide==this.nrOfSlice-1)?0:slide},callSlidingObject:function(){this.effectIsFinished=false
this.effectObject.effect(this.currentSlice,this.nextSlice,this.durationOfEffect,0.2)
this.setSliceToShow()
this.checkForResetStatus()},setSliceToShow:function(){this.prevSlice=this.currentSlice
this.currentSlice=this.nextSlice;if(this.linearSliding){if(this.sliceChoosebyUser){this.sliceChoosebyUser=false
this.effectObject.setOpacityForElement($(this.slidingContainerObject.imageContainer.children[this.currentSlice].id))}
this.nextSlice++;}else{this.nextSlice=this.getRandomNumber();}},getRandomNumber:function(){var random=this.nrOfSlice;while(random==this.currentSlice){random=Math.floor(Math.random()%(this.nrOfSlice-1))}
return random},checkForResetStatus:function(){if(this.nextSlice==this.nrOfSlice){if(this.imageSet=="fading")this.nextSlice=0
else this.nextSlice=1
this.effectObject.setOpacityForElement($(this.slidingContainerObject.imageContainer.children[this.currentSlice].id))}}})
var EffectSliding=Class.create({initialize:function(options){this.sliceContainer=options.objectSlidingContainer.imageContainer
this.numberOfSlice=this.sliceContainer.children.length
this.effectMovement=options.effectMovement||false
this.effectFading=options.effectFading||false
this.directionOfEffect=options.directionOfEffect||'right'
this.imageSet=options.imageSet
this.objectSlidingContainer=options.objectSlidingContainer
this.currentPosition=0
this.chrono=null
this.effectFinished=0
this.scrollForSlice=options.scrollForSlice
this.currentPage=this.currentPosition/this.scrollForSlice},update:function(object){this.chrono=object},effect:function(sliceToShow,nextSliceToShow,duration,delay){if(this.imageSet=="sliding"){this.morph(sliceToShow,nextSliceToShow,duration,delay)}else{this.fading(sliceToShow,nextSliceToShow,duration)}},fading:function(currentSlice,nextSlice,duration){var that=this
var idCurrentSlice=this.sliceContainer.children[currentSlice].id
var elementNextSlice=$(this.sliceContainer.children[nextSlice].id)
this.setOpacityForElement(elementNextSlice)
var currentImage=$(idCurrentSlice)
var nextImage=$(elementNextSlice)
currentImage.fade({duration:duration,from:1,to:0.0,afterFinish:function(){}})
nextImage.fade({duration:duration,from:0,to:1.0,afterFinish:that.effectFinish.bind(that,currentSlice)})},effectFinish:function(){this.chrono.effectFinished()},setOpacityForElement:function(sliceElement){if(this.imageSet=="fading")
this.objectSlidingContainer.setOpacityForElement(sliceElement)},morph:function(currentSlice,nextSlice,duration,delay){this.currentPosition=this.scrollForSlice*nextSlice
var that=this;this.objectSlidingContainer.imageContainer.morph(that.directionOfEffect+": "+this.currentPosition+"px",{duration:duration,delay:0,afterFinish:function(){that.checkPositionSlice(that.currentPosition,nextSlice);that.effectFinish(that);}});},checkPositionSlice:function(currentPosition,nextSlice){if(currentPosition>0&&($(this.sliceContainer.children[nextSlice].id).id).split('clone')[1]!=null){this.objectSlidingContainer.insertImage()
this.currentPosition=0}},changeSliceAssets:function(){var i=0
var length=this.sliceContainer.children.length
var sliceCloned=Object.clone(this.sliceContainer.children)
while(i<this.sliceContainer.children.length-1){this.sliceContainer.children[i]=sliceCloned[length-1]
length--;i++;}
this.currentSlice=1
this.objectSlidingContainer.insertSlidingImage()
this.objectSlidingContainer.removeOldsSlice()}})