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;
	},
	addLoadEvent:function(func){
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		}
		else {
			window.onload = function() {
				func();
				oldonload();
			}
		}
	}
}
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=/";
	}
}

var thumbnail = {};
thumbnail.data = "";
thumbnail.init = function (){
	var x = 1;
	while(document.getElementById("ThumbNail_" + x)){
		
		thumbnail.set("ThumbNail_" + x);
		x++;	
	}
	
};
thumbnail.set = function(id){
	var a = document.getElementById(id).getElementsByTagName("a");
	var ln = a.length;
	
	for(i=0;i<ln;i++){
		a[i].onclick = function(){
			return false;
		};
		a[i].onmouseover = function(){
			thumbnail.chg(this);
		};
		a[i].onmouseout = function(){
			thumbnail.rvs(this);
		};

	}
	
};
thumbnail.chg = function(Obj){
	var img = Obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("img")[0];
	this.data = img.src;
	img.src = Obj.href;
	
};
thumbnail.rvs = function(Obj){
	var img = Obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("img")[0];
	img.src = this.data;

};
	

_Common_.addLoadEvent(_Common_.initRollovers);
_Common_.addLoadEvent(thumbnail.init);



