
// mouseover ------------------------------------------------------------------------------------------------------------
function onMouse() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'ov') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_r'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_r'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
//	loadBtnType();
}


// flash -------------------------------------------------------------------------------------------------
var putSWF = {	
	
	conf : [
		//["#putAreaId","filePath","swfWidth","swfHeight",flashVer]
		  ["#putSWF","swf/raider_top.swf",1000,640,8],
	],
		
	pluginVer : 0,
	
	hideFlashArea : function(){
		
		document.write('<style type="text/css">#putSWF{visibility:hidden;}</style>');
		
		
	},
	
	getFlashVer : function(){
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : null;
		if (navigator.mimeTypes["application/x-shockwave-flash"]) {
			putSWF.pluginVer = parseInt(plugin.description.replace(/Shockwave\sFlash\s/,''));
		}
		// for IE
		else{
			document.writeln('\n<script type="text/vbscript">');
			document.writeln('on error resume next');
			document.writeln('Dim Flash');
			document.writeln('Flash=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash"))');
			document.writeln('putSWF.pluginVer=Hex(Int(CreateObject("ShockwaveFlash.ShockwaveFlash").FlashVersion))');
			document.writeln('</sc'+'ript>');
			putSWF.pluginVer = parseInt(putSWF.pluginVer.replace(/0000$/,''),16);
		}
	},
	
	replaceSWF : function (){
		var i, putArea;
		for(i in putSWF.conf){
			putArea = document.getElementById(putSWF.conf[i][0].slice(1));
			alert
			if((putSWF.pluginVer>=putSWF.conf[i][4])&&putArea){
				//put swf
				putArea.innerHTML = ('<object data=\"'+putSWF.conf[i][1]+' \"type=\"application/x-shockwave-flash\" width=\"'+putSWF.conf[i][2]+' \"height=\"'+putSWF.conf[i][3]+'\"><param name=\"movie\" value=\"'+putSWF.conf[i][1]+'\" /></object>');
			}
		}
	},
	
	showFlashArea : function(){
		var i;
		for( i in putSWF.conf ){
			document.getElementById(putSWF.conf[i][0].slice(1)).style.visibility="visible"
		}
	},
	
	start : function(){
		this.hideFlashArea();
		this.getFlashVer();
		try {
			window.addEventListener('load', this.replaceSWF, false);
			window.addEventListener('load', this.showFlashArea, false);
		} catch (e) {		
			window.attachEvent('onload', this.showFlashArea);
			window.attachEvent('onload', this.replaceSWF);
		}
	}
}

putSWF.start();



// popup -------------------------------------------------------------------------------------------------
function autoPOP(){
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].getAttribute('className') == 'popup' || x[i].getAttribute('class') == 'popup')
		{
			x[i].onclick = function () {
			return winOpen(this.href)
			}
			x[i].title += '(Popup)';
		}
	}
};

function winOpen(url) {
	window.open(
		url,
		'popup',
		'width=640,height=500,scrollbars=1,resizable=1'
	);

	return false;
};



// tab -------------------------------------------------------------------------------------------------
/*-- setup --*/
function tabChange() {
tab.setup = {
   tabs: document.getElementById('tab').getElementsByTagName('li'),
   pages: [
      document.getElementById('tabBox1'),
      document.getElementById('tabBox2'),
   ]
}
tab.init();
}
/*--setup end --*/
  
var tab = {
   init: function(){
      var tabs = this.setup.tabs;
      var pages = this.setup.pages;
  
		    for(i=0; i<pages.length; i++) {
         if(i !== 0) pages[i].style.display = 'none';
         tabs[i].onclick = function(){ tab.showpage(this); return false; };
      }
   },
  
   showpage: function(obj){
      var tabs = this.setup.tabs;
      var pages = this.setup.pages;
      var num;
  
      for(num=0; num<tabs.length; num++) {
         if(tabs[num] === obj) break;
      }
  
      for(var i=0; i<pages.length; i++) {
         if(i == num) {
            pages[num].style.display = 'block';
            tabs[num].className = 'selected';
         }
         else{
            pages[i].style.display = 'none';
            tabs[i].className = null;
         }
      }
   }
}



// onload -------------------------------------------------------------------------------------------------
function loadplural() {
	if(document.getElementById('tab')) {tabChange()};
	autoPOP();
	onMouse();
}
window.onload = loadplural;