function editCssLoad() {
	//document.write('<link rel="stylesheet" type="text/css" href="/css/print.css"  media="all" />');
	//document.write('<link rel="stylesheet" type="text/css" href="../css/print.css"  media="all" />');
	//document.write('<link rel="stylesheet" type="text/css" href="../regulation/css/edit.css" media="all" />'); 
	//document.write('<link rel="stylesheet" type="text/css" href="../../regulation/css/edit.css" media="all" />'); 
}

editCssLoad();




$(function () {
	$.actionSet.switchViewer();
	$.actionSet.blanklink();
	$.actionSet.pageTopAnchor();
	$.actionSet.popUpWindow();
	$.actionSet.windowClose();
	$.actionSet.ie6PicCatch();
});

$.actionSet = {
	
	switchViewer: function(options) {			
		
		$(".switchViewer .switchBtn a").click(function(){
			var pickupBtn = this.href.split(".html")[1];
			pickupBtn = pickupBtn.replace("#", ".");
			var showBtn = '.switchViewer '+pickupBtn+' td';
			var showBtnTr = '.switchViewer '+pickupBtn;
			//alert(pickupBtn);
			if(pickupBtn != ".allShow"){
				$('.switchViewer td').hide();
				$(showBtn).show();
				$('.switchViewer tr').hide();
				$('.switchViewer div').hide();
				$(showBtnTr).show();
			}else{
				$('.switchViewer td').show();
				$('.switchViewer tr').show();
				$('.switchViewer div').show();
				//alert("AllShow");
				}
			
			$(".switchViewer a").removeClass("current");
			$(this).addClass("current");
			 
			return false;
		});

	},
	
	blanklink: function(options) {
		$('a.blank').click(function(){
			window.open(this.href, '_blank');
			return false;
		});
	},
	
	pageTopAnchor: function(options) {
		jQuery.easing.quart = function (x, t, b, c, d) {
			return -c * ((t=t/d-1)*t*t*t - 1) + b;
		};
		
		$('a.pageTopAnchor').click(function () {
			$('html,body').animate({ scrollTop: 0 }, 500, 'quart');
		});
	},
	
	popUpWindow: function(options) {
		//memo:.html?name=popupName&scroll=1&width=555&height=555
		$('a.popUpWindow').click(function(){
			var queryString = this.href.replace(/^[^\?]+\??/, "");
			var params = parseQuery(queryString);
			var url = this.href.split("?")[0];
			var winName = String(params["name"]);
			var winScroll = Number(params["scroll"]);
			var winWidth = Number(params["width"]);
			var winHeight = Number(params["height"]);
			if(isNaN(winWidth)) {
				if(document.all) {
					if(document.documentElement && document.documentElement.clientHeight) { //for IE6 Strict Mode
						winWidth = document.documentElement.clientWidth;
					} else if(document.body) {
						winWidth = document.body.clientWidth;
					}
				} else if(document.layers || document.getElementById) {
					winWidth = window.innerWidth;
				}
			}
			if(isNaN(winHeight)) {
				if(document.all) {
					if(document.documentElement && document.documentElement.clientHeight) { //for IE6 Strict Mode
						winHeight = document.documentElement.clientHeight;
					} else if(document.body) {
						winHeight = document.body.clientHeight;
					}
				} else if(document.layers || document.getElementById) {
					winHeight = window.innerHeight;
				}
			}
		
			var centerW = (window.screen.width-winWidth)/2;
			var centerH = (window.screen.height-winHeight)/2;
			var newWindow;
			newWindow = window.open(url, winName, "toolbar=0, location=0, directories=0, status=0, menubar=1, resizable=yes, scrollbars=" + winScroll + ", width=" + winWidth + ", height=" + winHeight + ", left=" + centerW + ", top=" + centerH + "");
			newWindow.focus();
			return false; 
		});
		function tb_parseQuery ( query ) {
		   var Params = {};
		   if ( ! query ) {return Params;}// return empty object
		   var Pairs = query.split(/[;&]/);
		   for ( var i = 0; i < Pairs.length; i++ ) {
			 var KeyVal = Pairs[i].split('=');
			 if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
			 var key = unescape( KeyVal[0] );
			 var val = unescape( KeyVal[1] );
			 val = val.replace(/\+/g, ' ');
			 Params[key] = val;
		   }
		   return Params;
		}
	},
	
	windowClose: function(options) {
		$("a.close").click(function(){
			window.close();
		});
	},
	
	ie6PicCatch: function(options){//IE画像表示処理
		try {
		document.execCommand('BackgroundImageCache', false, true);
		} catch(e) {}
	}
	
}
