/**
* @Charset "UTF-8"
*/

$().ready(function(){
$("#plate_carryover").hide();
$("#plate_tristar_again").hide();
	$(".pop").bind("click", function(){
		url = $(this).attr("href");
		window.open(url, 'pop', 'width=610, height=500, scrollbars=yes');
		return false;
	});
	$(".popshort").bind("click", function(){
		url = $(this).attr("href");
		window.open(url, 'popshort', 'width=600, height=400, scrollbars=yes');
		return false;
	});
	$(".kanjukuoh").bind("click", function(){
		url = $(this).attr("href");
		window.open(url, 'kanjukuoh', 'width=980, height=648, status=no, location=no, toobar=no, menubar=no, scrollbars=no');
		return false;
	});
	$(".close").bind("click", function(){
		window.close();
		return false;
	});
	$("#floatWindow_bg").bind("click", function(){
		closeAll();
	});
	closeAll();
	swfobject.embedSWF("img/plate_head.swf", "plate_head", "674", "280", "9.0.0", "lib/expressInstall.swf");
});

function checkKan(){
	if($("#is_kan").val() == "甘"){
		return true;
	}else{
		$("#floatWindow_bg").css({
			"top":0,
			"left":0,
            "width": $().width(),
            "height": $().height(),
            "opacity": "0.5",
			"z-index":0
         }).show();
		getPosition();
		$("#floatWindow").css({
            "opacity": "1",
			"z-index":1
		}).show();
		$(window).bind("resize", function(){
			getPosition();
			$("#floatWindow_bg").css({
				"width": $().width(),
				"height": $().height()
			 });
		});
		$(window).scroll(function(){
			getPosition();
		});
		return false;
	}
}
function closeAll(){
	$("#floatWindow_bg").hide();
	$("#floatWindow").hide();
}
function getPosition(){
	leftnum = Math.floor(($(window).width() - $("#floatWindow").width()) / 2);
	topnum = Math.floor(($(window).height() - $("#floatWindow").height()) / 2);
	if($(window).scrollTop()>0){
		topnum += $(window).scrollTop();
	}
	$("#floatWindow").css({
	  "top": topnum,
	  "left": leftnum
	});
}
function turn(ORDER){
	if(ORDER=='over'){
		$("#plate_tristar").flip({ direction: 'lr', color:'#FFFCDB', 'bgColor':'#FFFCDB', content:$("#plate_carryover") });
	}else{
		$("#plate_tristar").flip({ direction: 'rl', color:'#FFFCDB', 'bgColor':'#FFFCDB', content:$("#plate_tristar_again") });
	}
	return false;
}
