var _Common_ = {
	initRollovers:function(){
		if (!document.getElementById) return
		var aPreLoad = new Array();
		var sTempSrc;
		var aImages = document.getElementsByTagName('img');
		var img_Len = aImages.length;
		for (var i = 0; i < img_Len; i++) {		
			if (aImages[i].className == 'over') {
				var src = aImages[i].getAttribute('src');
				var ftype = src.substring(src.lastIndexOf('.'), src.length);
				var hsrc = src.replace(ftype, '_over'+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('_x'+ftype, ftype);
					this.setAttribute('src', sTempSrc);
				}
			}
		} 
		
		var aInputs = document.getElementsByTagName('input');
		var img_Len = aInputs.length;
		for (var i = 0; i < img_Len; i++) {		
			if (aInputs[i].className == 'over') {
				var src = aInputs[i].getAttribute('src');
				var ftype = src.substring(src.lastIndexOf('.'), src.length);
				var hsrc = src.replace(ftype, '_over'+ftype);
	
				aInputs[i].setAttribute('hsrc', hsrc);
				aPreLoad[i] = new Image();
				aPreLoad[i].src = hsrc;
				aInputs[i].onmouseover = function() {
					sTempSrc = this.getAttribute('src');
					this.setAttribute('src', this.getAttribute('hsrc'));
				}	
				aInputs[i].onmouseout = function() {
					if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_x'+ftype, ftype);
					this.setAttribute('src', sTempSrc);
				}
			}
		}   
		return;
	},
	rand:function(x){
		number = Math.floor(Math.random() * x);
		return number;
	},
	url_Parse:function(url){
		var _ = false;
		if(url.indexOf("?") > 0 && url.indexOf("=") > 0){
			_ = new Array();
			var array = url.split("#");
			array = array[0].split("?");
			array = array[1].split("&");
			for(var i=0;i<array.length;i++){
				array[i] = array[i].split("=");
				var hash = array[i][0];
				var value = array[i][1];
				
				_[hash] = value;
			}
			delete array;
		}
		return _;
	},
	scrollInit:function(){
		$('a[href^=#]').click(function(){
			var href= this.hash;
			var $target = $(href == '#TOP' ? 'body' : href);
			if($target.size()){ 
				var top = $target.offset().top; 
				$($.browser.safari ? 'body' : 'html')
				.animate({scrollTop:top}, 1000, 'easeOutCubic',function(){
				
					location.href = href;
				}); 
				return false;
			}
		})
		$('area[href^=#]').click(function(){
			var href= this.hash;
			var $target = $(href == '#TOP' ? 'body' : href);
			if($target.size()){ 
				var top = $target.offset().top; 
				$($.browser.safari ? 'body' : 'html')
				.animate({scrollTop:top}, 1000, 'easeOutCubic',function(){
				
					location.href = href;
				}); 
				return false;
			}
		})
	
	},
	popupWindow:function(url, width, height, option, windowName){
		if (!width) width = window.innerWidth || document.documentElement.clientWidth;
		if (!height) height = window.innerHeight || document.documentElement.clientHeight;
		if (!option) option = 'menubar=yes, toolbar=yes, location=yes, status=yes, scrollbars=yes, resizable=yes';
		if (!windowName) windowName = "popup";
		var x = (screen.availWidth - width)/2;
		var y = (screen.availHeight - height)/3;
		var o = option+', width='+width+', height='+height+', left='+x+', top='+y;
		var win = window.open(url, windowName, o);
		
		if (win){
			win.focus();
			return false;
		} else {
			return true;
		}
	}

};
var Cookie = { //cookie
	read:function(CookieName){
		if(document.cookie){
			var cookie_Data = document.cookie;
			var Name =cookie_Data.indexOf(CookieName + "=",0);
			if(Name >= 0){
				var Data = cookie_Data.indexOf(";",Name + CookieName.length + 1);
				Data >= 0? Data = cookie_Data.substring(Name + CookieName.length + 1,Data): Data = cookie_Data.substring(Name + CookieName.length + 1,cookie_Data.length);
				return(Data);
			}
		}
		return(false);
	},
	set:function(CookieName,Value){
		var time =new Date();
		time.setTime(time.getTime() + (1000*365*60*60*24));
		var exptime =";expires=" + time.toGMTString();
		document.cookie = CookieName + "=" + Value + exptime + "; path=/";
	},
	Delete:function(CookieName){
		var time =new Date();
		time.setTime(time.getTime() - (1000*365*60*60*24));
		var exptime =";expires=" + time.toGMTString();
		document.cookie = CookieName + "=" + exptime + "; path=/";
	}
};

jQuery(function($) {
	_Common_.initRollovers();
	// _Common_.scrollInit();
});
jQuery.extend( jQuery.easing,
{
	def: 'easeOutCubic',
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	}
});

var bbs = {
	init:function(){
		var num = this.rand(49);
		
		document.write('<input type="hidden" value="'+num+'" name="code_id" />');
		document.write('<img alt="" src="/bbs_img/'+(num+1)+'.gif" />');
	},
	rand:function(x){
		number = Math.floor(Math.random() * x);
		return number;
	}

}
function inf_open(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=550");
}
function inf_open2(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=450");
}
function inf_open3(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=450");
}
function inf_open4(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=450");
}
function inf_open5(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=450");
}
function inf_open6(s_data){
 Middle = window.open(s_data, "middle_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=618,height=450");
}
