function opacity_pic(){
	this.box = $('#pic_display');
	this.cover = $('#pic_display .cover');
	this.cover_li = $('#pic_display .cover li');
	this.all_pic = $('#pic_display .all_pic li');
	this.current = -1;
}
opacity_pic.prototype = {
	
	init:function(){
		var that = this;
		
		this.cover_li.each(function(i){
			$(this).hover(function(){
				that.clear_opacity(i);
				that.text_up(i);
				if(that.current != i && that.current >= 0 ){
					that.change_opacity(that.current);
					that.text_down(that.current);
				}
				that.current = i;
			},function(){
				
			});
		});
		
		this.box.hover(function(){
			if(that.current >= 0){
				that.text_up(that.current);
			}
			that.show_big_cover();			
		},function(){
			if(that.current >= 0){
				that.text_down(that.current);
			}
			that.hide_big_cover();
		});		
		
	},
	
	show_big_cover:function(){
		this.cover.show();
	},
	
	hide_big_cover:function(){
		this.cover.hide();
	},
	
	clear_opacity:function(i){
		$(this.cover_li[i]).addClass('opacity02');
		$(this.cover_li[i]).removeClass('opacity01');
		$(this.cover_li[i]).find('div').show();
	},
	
	change_opacity:function(i){
		$(this.cover_li[i]).addClass('opacity01');
		$(this.cover_li[i]).removeClass('opacity02');
		$(this.cover_li[i]).find('div').hide();
	},
	
	text_up:function(i){
		$(this.cover_li[i]).find('span').animate({top:'167px'},300);
	},
	
	text_down:function(i){
		$(this.cover_li[i]).find('span').animate({top:'192px'},0);
	}
	
}

function open_win(){
	this.back_win = $('#back_win');
	this.pop_win = $('#pop_win');
	this.each_pic = $('#pic_display .cover li');
	this.each_li_pic = $('#pic_display .all_pic li');
}

open_win.prototype = {
	
	init:function(){
		var that = this;
		if(document.all){
			this.each_li_pic.each(function(i){
				$(this).click(function(){
					//that.open_big_win();
					//that.open_pop_win();
				});			   
			});
		}else{
			this.each_pic.each(function(i){
				$(this).find('div').click(function(){
					//that.open_big_win();
					//that.open_pop_win();
				});			   
			});
		}
		this.back_win.click(function(){
			//that.hide_big_win();
			//that.hide_pop_win();
		});
	},
	
	open_big_win:function(){
		this.back_win.width(document.documentElement.clientWidth);
		this.back_win.height(document.documentElement.clientHeight);
		this.back_win.show();
	},
	
	hide_big_win:function(){
		this.back_win.hide();
	},
	
	open_pop_win:function(){
		var that = this;
		left1 = document.documentElement.clientWidth/2 - 50 + 'px';
		left2 = document.documentElement.clientWidth/2 - 350 + 'px';
		top1 = document.documentElement.clientHeight/2 - 100 + 'px';
		top2 = document.documentElement.clientHeight/2 - 250 + 'px';
		this.pop_win.css({'left':left1,'top':top1}).show();
		this.loading('12.html');
		
	},
	
	loading:function(url){
		$("#pop_win").html('<div class="loading"></div>');
		var that = this;
		$.post(url, function(data) {
			if($("#pop_win").html(data)){
				setTimeout(function(){
					that.pop_win.animate({width:'700px',left:left2});
					that.pop_win.animate({height:'500px',top:top2});
				},200);
			}
		});
	},
	
	
	hide_pop_win:function(){
		this.pop_win.css({width:'100px',height:'100px'});
		this.pop_win.hide();
	}
}

$(function(){
	new opacity_pic().init();
	new open_win().init();
});