
var yonexTeamWearClass = Class.create();
yonexTeamWearClass.prototype = {
	
	config:{
		swf:"loader.swf",
		installswf:"expressInstall.swf",
		flashversion:"8.0.0",
		flashvars:null,
		params:{
			scale:"noscale",
			quality:"high"
		},
		attributes:null,
		container:"Container",
		width:1000,
		height:618
	},
	
	initialize:function(config){
		if(config) Object.extend(this.config,config);
		swfobject.embedSWF(this.config.swf,this.config.container,this.config.width,this.config.height,this.config.flashversion,this.config.installswf,
			this.config.flashvars,this.config.params,this.config.attributes);
		this.refreshPosition();
		Event.observe(window,"resize",this.refreshPosition.bind(this));
	},
	
	refreshPosition:function(){
		var csize = this.getClientSize();
		var _x = csize.width/2-this.config.width/2;
		var _y = csize.height/2-this.config.height/2;
		_x = (_x<0) ? 0:_x;
		_y = (_y<0) ? 0:_y;
		
		var con = $(this.config.container);
		Object.extend(con.style,{
			left:_x+"px",
			top:_y+"px"
		});
	},
	
	getClientSize:function(){
		return {
			height: (document.documentElement.clientHeight && document.compatMode && document.compatMode=="CSS1Compat" ?  (navigator.userAgent.indexOf('Opera') > -1 && parseFloat(window.opera.version()) < 9.5 ? document.body.clientHeight : document.documentElement.clientHeight) : document.body.clientHeight),
			width: (document.documentElement.clientWidth && document.compatMode && document.compatMode=="CSS1Compat" ? document.documentElement.clientWidth : document.body.clientWidth)
		}
	}
}


Event.observe(window,"load",function(){
	yonexTeamWear = new yonexTeamWearClass();
});

