// JavaScript Document
$(function(){
	_init();
});
function _init(){
	//$(".uiFlash").uiSlide();
	$(".tag").uiSwitch();
	$(".mrcdtLeft").bind({
		click:function(){
			moveTag(".mrcdtContent",0);
		}
	});
	$(".mrcdtRight").bind({
		click:function(){
			moveTag(".mrcdtContent",1);
		}
	});
	$(".pmLeft").bind({
		click:function(){
			moveTag(".pmContent",0);
		}
	});
	$(".pmRight").bind({
		click:function(){
			moveTag(".pmContent",1);
		}
	});//changeImg
	$(".mrcdtContent img").bind({
		click:function(){
			$("#changeImg").attr("src",this.src);
		}
	});
	var $leftImg = $(".leftImg");
	if($leftImg.length > 0){
		$leftImg.find("img").bind({
			click:function(){
				$("#showImgs").attr("src",$(this).attr("src"));
			}
		});
	}
	
	
	//
	$("#yxwdMap area").bind({
		click:function(){
			openWin.call(this);
			return false;
		}
	});
	//
	$(".ycscBox a").bind({
		click:function(){
			var $box = $(this).parents(".ycscBox");
			if($box.hasClass("ycscShow")){
				$box.removeClass("ycscShow");
			}else{
				$box.addClass("ycscShow");
			}
			return false;
		}
	});
}
function moveTag(box,move){
	var $box = $(box),
		ow = $(box).find("li").width(),
		w = $(box).find("li").width(),
		bW = $(box).find("li").length*w;
		if(move){
			w = parseInt($(box).find("ul").css("margin-left"),10) - (w + parseInt($(box).find("li").css("margin-right"),10));
		}else{
			w = w + parseInt($(box).find("ul").css("margin-left"),10) + parseInt($(box).find("li").css("margin-right"),10);
		}
		w = Math.abs(w) + ow < bW ? w : 0;
		$box.find("ul").animate({
			"margin-left":w
		},200);
}
function openWin(){
	var html = "<div class=\"layerBox\"><div class=\"lbTitle\"><span class=\"lbtName\">" + (this.title || this.alt) + "</span><a href=\"#\" class=\"lbcClose\" title=\"close\">Close</a></div><div class=\"lbContent\"><iframe src=\"" + this.href + "\" width=\"100%\" height=\"300\" border=\"0\" frameborder=\"no\"></iframe></div></div>";
	DecideBrowers();
	TB_WIDTH = 284;
	TB_HEIGHT = 338;
	tb_position();
	$("#TB_window").show().append(html).css("border","0");
	$(".lbcClose").click(tb_remove).focus();
}
