
if(document.all&&document.attachEvent){function eEvent(e){this.target=e.srcElement;this.cancelBubble=e.cancelBubble;this.keyVal=event.keyCode}
function document_addEventListener(ev,func,bl){this.attachEvent("on"+ev,function(){var e=new eEvent(event);return func(e);});}
function document_removeEventListener(ev,func,bl){this.detachEvent("on"+ev,func);}
document.addEventListener=document_addEventListener;document.removeEventListener=document_removeEventListener;window.addEventListener=document_addEventListener;window.removeEventListener=document_removeEventListener;var ii=document.getElementsByTagName("*");for(var i=0;i<ii.length;i++){ii[i].addEventListener=document_addEventListener;ii[i].removeEventListener=document_removeEventListener;}}
var swanq=function(){var agt=navigator.userAgent.toLowerCase();return{RENDER_INTERVAL:Math.floor(1000/24),agt:agt,is_ie　:((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1)),is_gecko:(agt.indexOf('gecko')!=-1),is_opera:(agt.indexOf("opera")!=-1),isQuirks:(document.compatMode=='BackCompat'),log:function(str){if(this.is_gecko){console.log(str);}},$:function(id){var target=document.getElementById(id);if(target==undefined){swanq.log('swanq.$: id = "'+id+'" target not found.');}
return target;},getPosition:function(that){var targetEle=that;　　　var pos=new function(){this.x=0;this.y=0;};while(targetEle){pos.x+=targetEle.offsetLeft;pos.y+=targetEle.offsetTop;targetEle=targetEle.offsetParent;if((targetEle)&&(this.is_ie)){pos.x+=(parseInt(this.getElementStyle(targetEle,"borderLeftWidth","border-left-width"),10)||0);pos.y+=(parseInt(this.getElementStyle(targetEle,"borderTopWidth","border-top-width"),10)||0);}}
if(this.is_gecko){var bd=document.getElementsByTagName("BODY")[0];　　pos.x+=2*(parseInt(this.getElementStyle(bd,"borderLeftWidth","border-left-width"),10)||0);pos.y+=2*(parseInt(this.getElementStyle(bd,"borderTopWidth","border-top-width"),10)||0);}
return pos;},getElementStyle:function(targetElm,IEStyleProp,CSSStyleProp){var elem=targetElm;if(elem.currentStyle){return elem.currentStyle[IEStyleProp];}else if(window.getComputedStyle){var compStyle=window.getComputedStyle(elem,"");return compStyle.getPropertyValue(CSSStyleProp);}},getSwf:function(movieName){return(navigator.appName.indexOf("Microsoft")!=-1)?window[movieName]:document[movieName];},getIeBody:function(){return(document.compatMode=='BackCompat')?document.body:document.documentElement;},clientWidth:function(){return(document.all)?this.getIeBody().clientWidth:window.innerWidth;},clientHeight:function(){return(document.all)?this.getIeBody().clientHeight:window.innerHeight;},scrollTop:function(){return(document.all)?this.getIeBody().scrollTop:window.pageYOffset;},scrollLeft:function(){return(document.all)?this.getIeBody().scrollLeft:window.pageXOffset;},_EOP:"End Of Public members"};}();swanq.LayerMgr=function(){var fixTimer,maxTimer;var setCssText=function(id,style){var target=swanq.$(id);if(typeof(target.style.cssText)!='undefined'){target.style.cssText=style;}else{target.setAttribute('style',style);}};var getCssText=function(id){var o=swanq.LayerMgr.props[id];var result='';for(var i in o){result=result+i+': '+o[i]+'px;';}
return result;};var readyProp=function(id){var SL=swanq.LayerMgr;if(SL.props[id]==undefined){SL.props[id]={};}};var setProp=function(id,name,value){readyProp(id);swanq.LayerMgr.props[id][name]=value;};var setProps=function(id,dat){readyProp(id);var o=swanq.LayerMgr.props[id];for(var i in dat){o[i]=dat[i];}};var removeProps=function(id){var SL=swanq.LayerMgr;delete SL.props[id];};return{props:{},maxList:[],fixList:[],getProp:function(id,name){return this.props[id][name];},getProps:function(id){return this.props[id];},create:function(id,x,y,w,h){var left=(x==undefined)?0:x;var top=(y==undefined)?0:y;var width=(w==undefined)?100:w;var height=(h==undefined)?100:h;var result=document.createElement('div');result.setAttribute('id',id);result.style.position='absolute';result.style.left=left+'px';result.style.top=top+'px';result.style.width=width+'px';result.style.height=height+'px';setProps(id,{left:left,top:top,width:width,height:height,visible:true,maximize:false});return result;},remove:function(id){var target=swanq.$(id);if(target==undefined){return;}
target.parentNode.removeChild(target);removeProps(id);},setSize:function(id,w,h){var props={};var target=swanq.$(id);if(w!==undefined){target.style.width=w+'px';props.width=w;}
if(h!==undefined){target.style.height=h+'px';props.height=h;}
setProps(id,props);return target;},setFullSize:function(id){this.move(id,0,0);return this.setSize(id,swanq.clientWidth(),swanq.clientHeight());},move:function(id,x,y){var props={};var target=swanq.$(id);if(x!==undefined){target.style.left=x+'px';props.left=x;}
if(y!==undefined){target.style.top=y+'px';props.top=y;}
setProps(id,props);return target;},moveRel:function(id,x,y){var relx,rely;if(x!==undefined){relx=swanq.scrollLeft()+x;}
if(y!==undefined){rely=swanq.scrollTop()+y;}
return this.move(id,relx,rely);},setVisible:function(id,flg){var visibility=(flg)?"visible":"hidden";var target=swanq.$(id);target.style.visibility=visibility;setProp(id,'visible',flg);return target;},setMaximize:function(id,flg){var len=this.maxList.length;this.setFixed(id,false);this.removeMaxData(id);if(flg){this.maxList.push(this.__makeMaxData(id));}
clearInterval(this.maxTimer);if(this.maxList.length>0){this.maxTimer=setInterval(swanq.LayerMgr.__maxLoop,swanq.RENDER_INTERVAL);}
this.setFullSize(id,flg);setProp(id,'maximize',flg);},removeMaxData:function(id){var len=this.maxList.length;for(var i=0;i<len;i++){if(this.maxList[i]==id){return this.maxList.splice(i,1);}}},__makeMaxData:function(id){var target=swanq.$(id);var dat={};dat.id=id;return dat;},__maxLoop:function(){var me=swanq.LayerMgr;var dat;var len=me.maxList.length;for(var i=0;i<len;i++){dat=me.maxList[i];me.moveRel(dat.id,0,0);me.setSize(dat.id,swanq.clientWidth(),swanq.clientHeight());}},setFixed:function(id,flg){if(this.getProp(id,'maximize')==true){return;}
this.__removeFixedData(id);if(flg){this.fixList.push(this.__makeFixedData(id));}
clearInterval(this.fixTimer);if(this.fixList.length>0){this.fixTimer=setInterval(swanq.LayerMgr.__fixLoop,swanq.RENDER_INTERVAL);}},__removeFixedData:function(id){var len=this.fixList.length;var result;for(var i=0;i<len;i++){if(this.fixList[i].id==id){return this.fixList.splice(i,1);}}
return result;},__makeFixedData:function(id){var target=swanq.$(id);var dat={};dat.id=id;dat.relx=parseInt(target.style.left,10)-swanq.scrollLeft();dat.rely=parseInt(target.style.top,10)-swanq.scrollTop();return dat;},__fixLoop:function(){var dat;var len=this.fixList.length;for(var i=0;i<len;i++){dat=this.fixList[i];this.moveRel(dat.id,dat.relx,dat.rely);}},_EOP:"End Of Public members"};}();var baloon=function(){var VERSION='0_1_0';var SL=swanq.LayerMgr;return{AREA_MARGIN_X:60,AREA_MARGIN_Y:100,SWF_WIDTH:120,SWF_HEIGHT:193,timer:0,width:1000,height:1000,radian:0,baseRad:Math.PI/2,strength:0,baseStr:0.8,pos:{x:0,y:0},wind:{x:0,y:0},pageOnResize:function(){var me=baloon;me.width=swanq.clientWidth();me.height=swanq.clientHeight();},init:function(){window.addEventListener('load',baloon.pageOnLoad,false);window.addEventListener('resize',baloon.pageOnResize,false);},pageOnLoad:function(){var me=baloon;var box=SL.create('baloonbox',0,0,me.SWF_WIDTH,me.SWF_HEIGHT);box.style.zIndex=99;document.body.appendChild(box);var so=new SWFObject('baloon.swf?version='+me.VERSION,'baloonswf',me.SWF_WIDTH,me.SWF_HEIGHT,'8','#FFFFFF');so.addParam('allowScriptAccess','always');so.addParam('wmode','transparent');so.addParam('loop','false');so.addParam('menu','false');so.write('baloonbox');},swfOnLoad:function(){var me=baloon;me.timer=setInterval(me.mainLoop,swanq.RENDER_INTERVAL);me.pageOnResize();me.pos.x=Math.round(me.width/4);me.pos.y=-me.AREA_MARGIN_Y;me.move(me.pos);},mainLoop:function(){var me=baloon;me.radian=(me.radian+(Math.random()*(Math.PI*2*14/360))-(Math.PI*2*7/360))*0.99;me.strength=(me.strength+Math.random()*0.2-0.1)*0.9;me.wind.x=Math.cos(me.radian+me.baseRad)*(me.strength+me.baseStr);me.wind.y=Math.sin(me.radian+me.baseRad)*(me.strength+me.baseStr);me.pos.x=me.pos.x+me.wind.x;me.pos.y=me.pos.y+me.wind.y;var minx=me.AREA_MARGIN_X;var maxx=me.width-me.AREA_MARGIN_X-20;if(me.pos.x<minx){me.pos.x=minx;}else if(me.pos.x>maxx){me.pos.x=maxx;}
var miny=-me.AREA_MARGIN_Y;var maxy=swanq.scrollTop()+me.height+me.AREA_MARGIN_Y;if(me.pos.y<miny){me.pos.y=maxy;}else if(me.pos.y>maxy){me.pos.y=miny;}
me.move(me.pos);swanq.getSwf('baloonswf').setWind(me.wind);},move:function(point){var me=baloon;SL.move('baloonbox',Math.round(point.x)-me.AREA_MARGIN_X,Math.round(point.y)-me.AREA_MARGIN_Y);},_EOP:'End Of Public members'};}();baloon.init();