// JavaScript Document
var j = jQuery.noConflict();   

function switchLiCnt(obja,objb){
	
	j('#' + obja).children().mouseover(function(){
		if(j(this).attr("class") != "on"){
			j('#' + obja).children().removeClass('on');
			j(this).addClass("on");
			key = j('#' + obja).children().index(j(this));
			j('#' + objb).children().removeClass('on');
			j('#' + objb).children().eq(key).addClass("on");
		}
	})
}

var classSwitchImg = function(obj,obja,objb,objc){
	this._c = this._h = this.imgnum =0;
	this.imgnum = j(obja).children().size();
	for(k=0;k<this.imgnum;k++){
		if(k > 0){
			if (k==1){
				j(objb).append('<span class="two">0'+ (k + 1) +'</span>');
			}else{
				j(objb).append('<span>0'+ (k + 1) +'</span>');
			}
		}else{
			if (k==1){
				j(objb).append('<span class="two on">0'+ (k + 1) +'</span>');
			}else{
				j(objb).append('<span class="on">0'+ (k + 1) +'</span>');
			}
		}
	}
	this.PalyImg = function(){
		var _this = this;
		j(objb + ' > span').mouseover(function(){
			var i = j(objb + ' > span').index(j(this));
			clearInterval(_this._h);
			_this.Change(i);
			_this._c = i;
		})
		j(obj).hover(function(){clearInterval(_this._h)}, function(){_this.Play()});
		_this.Play();
	}
	this.Play = function(){
		var _this = this;
		var callback = function(){ _this.Autoswitch(); };
		this._h = setInterval(callback, 2000);
	}
	this.Change = function(id){
		j(obja + " > img").hide().eq(id).fadeIn('slow');
		j(objb + ' > span').removeClass().eq(id).addClass('on').blur();
		if (id==1){
			j(objb + ' > span').removeClass().eq(id).addClass('on two').blur();
		}else{
			j(objb + ' > span').eq(1).addClass('two').blur();	
		}
		j(objc + " > img").hide().eq(id).fadeIn('slow');
	}
	this.Autoswitch = function(){
		this._c = this._c >= (this.imgnum-1) ? 0 : this._c + 1;
		this.Change(this._c);
		
	}
}



