

var uj = {
	init: function() {
		var self = this;
		$(function() {
			self.rollover();
			self.smoothscroll();
			self.fukidashi();
			self.popupwindow();
		});
	},
	/*
	** RollOver
	*/
	rollover: function() {
		$("img.opa_over").fadeTo(10,0.999999);
		$("img.opa_over").hover(function(){
				$(this).fadeTo(10,0.7);
			},
			function(){
				$(this).fadeTo(10,0.999999);
			});	
	},
	/*
	** fukidashi
	*/
	fukidashi: function() {
		function simple_tooltip(target_items, name){
		 $(target_items).each(function(i){
				$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
				var my_tooltip = $("#"+name+i);
				
				if($(this).attr("title") != "" && $(this).attr("title") != "undefined" ){
				
				$(this).removeAttr("title").mouseover(function(){
							my_tooltip.css({opacity:1, display:"none"}).fadeIn(400);
				}).mousemove(function(kmouse){
						var border_top = $(window).scrollTop(); 
						var border_right = $(window).width();
						var left_pos;
						var top_pos;
						var offsetX = 90;
						var offsetY = 50;
						if(border_right - (offsetX *2) >= my_tooltip.width() + kmouse.pageX){
							left_pos = kmouse.pageX-offsetX;
							} else{
							left_pos = kmouse.pageX-offsetX;
							//left_pos = border_right-my_tooltip.width()-offsetX;
							}
							
						if(border_top + (offsetY *2)>= kmouse.pageY - my_tooltip.height()){
							//top_pos = border_top +offsetY;
							top_pos = kmouse.pageY-my_tooltip.height()-offsetY;
							} else{
							top_pos = kmouse.pageY-my_tooltip.height()-offsetY;
							}	
						
						
						my_tooltip.css({left:left_pos, top:top_pos});
				}).mouseout(function(){
						my_tooltip.css({left:"-9999px"});				  
				});
				
				}
				
			});
		}
		$(document).ready(function(){
			 simple_tooltip(".popup area","tooltip");
		});
	},
	/*
	** smoothscroll
	*/
	smoothscroll: function() {
		
		$('a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var target = $(this.hash);
				target = target.length && target;
				if (target.length) {
					var sclpos = 30;
					var scldurat = 800;
					var targetOffset = target.offset().top - sclpos;
					$('html,body')
						.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
					return false;
				}
			}
		});
	},
	/*
	** popupwindow
	*/
	popupwindow: function() {
		$(".popupwindow").click(function(){
			window.open(this.href, "WindowName","width=900,height=600,resizable=yes,scrollbars=yes");
			return false;
		});
	}
	
}
uj.init();


function setcolor(obj0,sw1){
	if (sw1 == 0) {
		bgc = '';
		crs = '';
		obj0.style.textDecoration = 'none';
	}else {
		bgc = '#fcdbd2';
		crs = 'pointer';
		
		obj0.style.textDecoration = 'underline';
		obj0.style.cursor = crs;
	}
	//obj0.style.backgroundColor = bgc;
}
function setcolorBlog(obj0,sw1,pos){
	
	var element = document.getElementById("columInnerF")
	var elementS = document.getElementById("columInnerS")
	
	if (sw1 == 0) {
		bgc = '';
		crs = '';
		obj0.style.textDecoration = 'none';
		element.style.backgroundPosition = '-999px bottom'; 
		elementS.style.backgroundPosition = '-999px bottom'; 
	}else {
		bgc = '#e8e8e8';
		crs = 'pointer';
		//obj0.style.textDecoration = 'underline';
		if(pos == 1){
			element.style.backgroundPosition = '170px bottom';
		}else if(pos == 2){
			element.style.backgroundPosition = '339px bottom'; 
		}else if(pos == 3){
			element.style.backgroundPosition = '506px bottom'; 
		}else if(pos == 4){
			elementS.style.backgroundPosition = '2px bottom'; 
		}else if(pos == 5){
			elementS.style.backgroundPosition = '170px bottom'; 
		}else if(pos == 6){
			elementS.style.backgroundPosition = '339px bottom'; 
		}else if(pos == 7){
			elementS.style.backgroundPosition = '506px bottom'; 
		}
		
		obj0.style.cursor = crs;
	}
	//obj0.style.backgroundColor = bgc;
}
function toLink(linkURL){
	location.href = linkURL;
}
