var Browser={ IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) } var colors=[[5,43,64],[255,158,28],[10,86,128]]; var morphTime=1000; var morphBreak=3500; var morphStarttime=0; var morphStop=false; var morphTime=1000; var morphInterval=100; var morphList=[[],[],[]]; var areaList=['termin','news','kurs']; var morphOut; var morphOutArea; var morphIn; var morphInArea; var morphFct; function morphInit(){ for(i in areaList){ c=0; while(document.getElementById(areaList[i]+'content'+c)){ morphList[i].splice(morphList[i].length,0,c); c++; } } for(i in morphList) if(morphList[i].length>0){ morphOut=0; morphOutArea=i; break; } if(morphList[morphOutArea].length>1){ morphIn=1; morphInArea=morphOutArea; } if(morphOut.toString().length||false){ document.getElementById(areaList[morphOutArea]+'button'+morphList[morphOutArea][morphOut]).style.backgroundColor="#"+rgbProgress(colors[0],colors[1],1); setRankings(); } morphFct=window.setInterval("morph()",morphBreak); for(i in morphList){ if(document.getElementById('area'+i)==null) continue; document.getElementById('areas'+i).onkeydown= document.getElementById('areas'+i).onclick= document.getElementById('areas'+i).onmouseover= document.getElementById('areas'+i).onfocus=function(){ if(morphStarttime) return; regex=/^areas([\d]+)$/; regex.exec(this.id); key=RegExp.$1; morphIn=0; morphInArea=key; setRankings(); window.clearInterval(morphFct); morphFct=null; if(morphIn!=morphOut||morphInArea!=morphOutArea) morph(); morphStop=true; } for(j in morphList[i]){ document.getElementById(areaList[i]+'button'+morphList[i][j]).onkeydown= document.getElementById(areaList[i]+'button'+morphList[i][j]).onclick= document.getElementById(areaList[i]+'button'+morphList[i][j]).onmouseover= document.getElementById(areaList[i]+'button'+morphList[i][j]).onfocus=function(){ if(morphStarttime) return; regex=/^(\w+)button([\d]+)$/; regex.exec(this.id); n=RegExp.$2; for(x in areaList) if(areaList[x]==RegExp.$1) break; m=x; keys=[m,n]; morphIn=keys[1]; morphInArea=keys[0]; setRankings(); window.clearInterval(morphFct); morphFct=null; if(morphIn!=morphOut||morphInArea!=morphOutArea) morph(); morphStop=true; } } } } function morph(){ var date=new Date(); var current=date.getTime(); window.clearInterval(morphFct); morphFct=null; if(!morphStarttime&&morphInterval){ morphStarttime=current; morphFct=window.setInterval("morph()",morphInterval); }else if(current>=(morphStarttime+morphTime)||!morphInterval){ morphOut=morphIn; morphOutArea=morphInArea; if(morphList[morphOutArea].length>(morphOut+1)){ morphIn=morphOut+1; morphInArea=morphOutArea; }else{ area=null; for(i in morphList){ if(i<=morphOutArea) continue; if(!morphList[i].length) continue; area=i; break; } if(area==null){ for(i in morphList){ if(!morphList[i].length) continue; area=i; break; } } if(area==null) area=morphOutArea; morphInArea=area; morphIn=0; } morphStarttime=0; setRankings(); if(!morphStop) morphFct=window.setInterval("morph()",morphBreak); }else{ setOpacity(areaList[morphOutArea]+'content'+morphList[morphOutArea][morphOut],1-(current-morphStarttime)/morphTime); document.getElementById(areaList[morphOutArea]+'button'+morphList[morphOutArea][morphOut]).style.backgroundColor="#"+rgbProgress(colors[0],colors[1],1-((current-morphStarttime)/morphTime)); document.getElementById(areaList[morphInArea]+'button'+morphList[morphInArea][morphIn]).style.backgroundColor="#"+rgbProgress(colors[0],colors[1],(current-morphStarttime)/morphTime); if(morphOutArea!=morphInArea){ document.getElementById('areas'+morphInArea).style.backgroundColor="#"+rgbProgress(colors[0],colors[2],(current-morphStarttime)/morphTime); setOpacity('area'+morphInArea,(current-morphStarttime)/morphTime); document.getElementById('areas'+morphOutArea).style.backgroundColor="#"+rgbProgress(colors[0],colors[2],1-(current-morphStarttime)/morphTime); setOpacity('area'+morphOutArea,1-(current-morphStarttime)/morphTime); } morphFct=window.setInterval("morph()",morphInterval); } } function rgbProgress(src,dst,progress){ col=[(dst[0]-src[0])*progress+src[0],(dst[1]-src[1])*progress+src[1],(dst[2]-src[2])*progress+src[2]]; return rgbToHex(col[0],col[1],col[2]); } function rgbToHex(R,G,B) {return toHex(R)+toHex(G)+toHex(B)} function toHex(N){ if (N==null) return "00"; N=parseInt(N); if (N==0 || isNaN(N)) return "00"; N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N); return "0123456789ABCDEF".charAt((N-N%16)/16)+"0123456789ABCDEF".charAt(N%16); } if(Browser.IE){ var setOpacity=function(element,value){ function stripAlpha(filter){ return filter.replace(/alpha\([^\)]*\)/gi,''); } element=document.getElementById(element); var currentStyle=element.currentStyle; if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal')) element.style.zoom=1; var filter=element.style['filter'],style=element.style; if(value==1||value===''){ (filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter'); return element; }else if(value<0.00001) value=0; style.filter=stripAlpha(filter)+'alpha(opacity='+(value * 100)+')'; style.display=value!=0?'':'none'; return element; }; }else if(Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){ function setOpacity(element,value){ element=document.getElementById(element); element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value; element.style.display=value!=0?'':'none'; return element; }; }else if(Browser.WebKit){ function setOpacity(element,value){ element=document.getElementById(element); element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value; element.style.display=value!=0?'':'none'; if(value==1) if(element.tagName=='IMG'&&element.width){ element.width++; element.width--; }else try{ var n=document.createTextNode(' '); element.appendChild(n); element.removeChild(n); }catch(e){ } return element; }; }else{ var setOpacity=function(element,value){ element=document.getElementById(element); element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value; element.style.display=value!=0?'':'none'; return element; }; } function setRankings(){ for(i in morphList){ if((elementAreas=document.getElementById('areas'+i))==null) continue; elementArea=document.getElementById('area'+i); if(i==morphOutArea){ elementAreas.style.backgroundColor='#'+rgbToHex(colors[2][0],colors[2][1],colors[2][2]); elementArea.style.zIndex=102; elementArea.style.display='block'; setOpacity(elementArea.id,1); }else{ elementAreas.style.backgroundColor='#'+rgbToHex(colors[0][0],colors[0][1],colors[0][2]); elementArea.style.zIndex=103; elementArea.style.display='none'; setOpacity(elementArea.id,0); } for(j in morphList[i]){ elementContent=document.getElementById(areaList[i]+'content'+morphList[i][j]); elementButton=document.getElementById(areaList[i]+'button'+morphList[i][j]); elementContent.style.display='block'; setOpacity(elementContent.id,1); if(i==morphOutArea&&j==morphOut){ elementContent.style.zIndex=92; elementButton.style.backgroundColor="#"+rgbToHex(colors[1][0],colors[1][1],colors[1][2]); }else if(i == morphInArea && j == morphIn){ elementContent.style.zIndex=91; elementButton.style.backgroundColor="#"+rgbToHex(colors[0][0],colors[0][1],colors[0][2]); }else{ elementContent.style.zIndex=90; elementButton.style.backgroundColor="#"+rgbToHex(colors[0][0],colors[0][1],colors[0][2]); } } } } function getHeight(element){ return getDimensions(element).height; } function getWidth(element){ return getDimensions(element).width; } function getDimensions(element){ element=document.getElementById(element); var display=element.style['display']; if (display!='none'&&display!=null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els=element.style; var originalVisibility=els.visibility; var originalPosition=els.position; var originalDisplay=els.display; els.visibility='hidden'; els.position='absolute'; els.display='block'; var originalWidth=element.clientWidth; var originalHeight=element.clientHeight; els.display=originalDisplay; els.position=originalPosition; els.visibility=originalVisibility; return {width: originalWidth, height: originalHeight}; }