/* ------------------------------------------------------------------

 common.js
	
------------------------------------------------------------------ */

//
// TAB
//
$(document).ready(function(){
		$(".tabArea > .tabMenu > li:first").addClass("select");
		$(".tabMenu > li").hover(function(){
			$(this).css("cursor","pointer");
		},function(){
			$(this).css("cursor","default");
		});

		$(".tabArea > div").hide();
		$(".tabArea > div:first").show();
		$('.tabMenu li a[href]').click(function(e){e.preventDefault()});

	$(".tabMenu > li").click(function () {
		$(".tabMenu > li").removeClass("select");
		$(this).addClass("select");
		$(".tabArea > div").hide();
		$(".tabArea > div").eq($(".tabMenu > li").index(this)).show();
	});

});

$(function(){
	$(".tabMenu > li").hover(function() {
			$(this).addClass('over');
		}, 
		function() {
			$(this).removeClass('over');
			}
		);
});

//
//ロールオーバー
//
;(function($){
$(document).ready(function(){
$("a img[src*='_ov']").addClass("current");
$("a img[class!='current'],:image").mouseover(function(){
if ($(this).attr("src").match(/_ot./)){
$(this).attr("src",$(this).attr("src").replace("_ot.", "_ov."));
return;
}
}).mouseout(function(){
if ($(this).attr("src").match(/_ov./)){
$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
return;
}
}).click(function(){
if ($(this).attr("src").match(/_ov./)){
$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
return;
}
});


//preload images
var images = [];
$("a img,:image").each(function(index){
if($(this).attr("src").match(/_ot./)){
images[index]= new Image();
images[index].src = $(this).attr("src").replace("_ov.", "_ot.");
}
});
});
})(jQuery);


//
//ポップアップ
//
function openCWindow(uri, width, height){
	var left = Math.floor((screen.width-width)/2);
	var top  = Math.floor((screen.height-height)/2);
	var win = window.open(uri, "owin", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width="+width+",height="+height+",left="+left+",top="+top);
	if(document.all == void 0 && document.layers == void 0 && document.getElementById == void 0){
		win.resizeTo(width, height);
		win.moveTo(left, top);
	}
	if (win) {
		win.focus();
	}
}

