avex = {
	d  : document,
	ua : navigator.userAgent,
	os : navigator.appVersion.indexOf("Win"),
	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
	},
	Flash : {
		play : false,
		version : 7,
		init : function(){
			var p = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
			if( p ){
				var w = navigator.plugins["Shockwave Flash"].description.split(" ");
				var l = w.length;
				var v = 0;
				for( var i=0; i<l; ++i ){
					n = parseInt(w[i]);
					if( !isNaN( n ) ){
						v = w[i];
					}
				}
				this.setPlay(v >= this.version)
			}else if( avex.Browser.IE && avex.os ) {
				var d = avex.d;
				d.write( '<SCR' + 'IPT LANGUAGE="VBScript"\>'+"\n");
				d.write( 'on error resume next '+"\n");
				d.write( 'call avex.Flash.getVersion()' + "\n");
				d.write( 'FlashCanPlay = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & contentVersion)))' + "\n");
				d.write( 'call avex.Flash.setPlay(FlashCanPlay)' + "\n");
				d.write('<'+'/SCR' + 'IPT\>'+"\n");
			}
		},
		getVersion : function(){
			contentVersion = this.version;
			return this.version;
		},
		setPlay : function(flg){
			this.play = flg;
		},
		loadMovie : function(fname, bgcolor, imgname) {
			var d = avex.d;
			if( this.play ){
				document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="780" height="126" id="index" align="middle">');
				document.write('<param name="allowScriptAccess" value="sameDomain" />');
				document.write('<param name="movie" value="' + fname +'" />');
				document.write('<param name="swLiveConnect" value="true" />');
				document.write('<param name="wmode" value="transparent" />');
				document.write('<param name="quality" value="high" />');
				document.write('<param name="bgcolor" value="' + bgcolor + '" />');
				document.write('<embed src="' + fname +'" quality="high" bgcolor="' + bgcolor + '" width="780" height="126" id="index" name="index" align="middle" swLiveConnect=true allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
				document.write('</object>');
			}else{
				d.write('<img src="'+imgname+'" border="0" alt="" name="" usemap="#error">');
			}
		},
		loadMovieEx : function(fname, bgcolor, imgname, vars) {
			var d = avex.d;
			if( this.play ){
				document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="780" height="126" id="index" align="middle">');
				document.write('<param name="allowScriptAccess" value="sameDomain" />');
				document.write('<param name="movie" value="' + fname +'" />');
				document.write('<param name="FlashVars" value="' + vars +'" />');
				document.write('<param name="swLiveConnect" value="true" />');
				document.write('<param name="wmode" value="transparent" />');
				document.write('<param name="quality" value="high" />');
				document.write('<param name="bgcolor" value="' + bgcolor + '" />');
				document.write('<embed src="' + fname + '" FlashVars="'+ vars +'" quality="high" bgcolor="' + bgcolor + '" width="780" height="126" id="index" name="index" align="middle" swLiveConnect=true allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
				document.write('</object>');
			}else{
				d.write('<img src="'+imgname+'" border="0" alt="" name="" usemap="#error">');
			}
			
		}
	},
	Cookie : {
		init : function(){
		
		},
		set : function(c,v,e){
			var d = new Date();
			var s = "";
			
			d.setDate(d.getDate()+e);
			s += c + "=" + escape(v);
			s += (e==null)?"":"; expries="+d;
			avex.d.cookie = s;
		},
		get : function(c){
			var st="";
			var ed="";
			var dp = avex.d.cookie;
			if( dp.length > 0 ){
				st = dp.indexOf(c + "=");
				if( st != -1 ){
					st = st + c.length + 1;
					ed = dp.indexOf( ";", st );
					if( ed == -1 ){
						ed = dp.length;
					}
					return unescape( dp.substring(st, ed));
				}
			}
			return null;
		}
	},
	StyleChanger : {
		init : function(){
			this.createDriverFunction('index');
		},
		setStyleId : function(id){
			avex.Cookie.set("StyleId", id, 1);
		},
		getStyleId : function(){
			return avex.Cookie.get("StyleId");
		},
		loadCSS : function(){
			
			var id = this.getStyleId();
			if( id ){
				var d = avex.d;
				d.write('<link rel="stylesheet" type="text/css" media="screen" href="../css/'+ id + '.css">');
			}
		},
		loadMenu : function(f,bg,img,menu){
			var id = this.getStyleId();
			
			if( id ){
				var d = avex.d;
				var v = 'id=' + id + '&amp;menu=' + menu;
				avex.Flash.loadMovieEx(f,bg,img,v);
			}else{
				avex.Flash.loadMovieEx(f,bg,img,1);
			}
		},
		cmd : function(c,a){
			if( c == 'setStyleId' ){
				this.setStyleId(a);
			}
		},
		createDriverFunction : function(id) {
			d = avex.d;
			
			d.write('<script language="javascript">'+"\n");
			d.write('<!--'+"\n");
			d.write('function '+ id + '_DoFSCommand(c,a){'+"\n");
			d.write('avex.StyleChanger.cmd(c,a);'+"\n");
			d.write('}'+"\n");
			d.write('//-->'+"\n");
			d.write('</script>'+"\n");
			
			d.write( '<SCR' + 'IPT LANGUAGE="VBScript"\>'+"\n");
			d.write( 'on error resume next '+"\n");
			d.write( 'Sub '+ id + '_FSCommand(ByVal c,ByVal a)' +"\n");
			d.write( 'call ' + id + '_DoFSCommand(c,a)' + "\n");
			d.write( 'End Sub'+"\n");
			d.write('<'+'/SCR' + 'IPT\>'+"\n");
		}
	},
	init : function(){
		this.Flash.init();
		this.Cookie.init();
		this.StyleChanger.init();
	}
};

avex.init();