function setModal() {
	//select all the a tag with name equal to modal
	$(window).load(function(){
	
		var ftime = "firsttime";
		if($.cookie(ftime)){
			
		}else{
			$.cookie(ftime,1, {expires:7}); //cookieを有効期限を7日間でセット
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('<div />', {  
				id: 'mask' 
		}).appendTo('body'); 
		$('<div />', {  
				id: 'firstView',  
				html: '<p><img src="lib/img/top/logo_firstview.gif" alt="SHINKO STUDIO" /></p><p class="fviewLead">Please select your language. ご覧になる言語をお選びください。</p><p class="fviewLink"><a href="#" id="moveEng">ENGLISH</a>　　|　　<a href="#" id="closeModal">日本語</a></p>' 
		}).appendTo('body'); 
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight,"overflow-y":"auto","overflow-x":"hidden"});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.9);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		//$('#firstView').css('top',  (winH - $('#firstView').height())/2 - 200);
		$('#firstView').css('top',240);
		$('#firstView').css('left', (winW - $('#firstView').width())/2);
		
		function resizeContainer(e) {
						winH = $(window).height();
						winW = $(window).width();
						maskH = $(document).height();
						maskW = $(window).width();
						var mlH = $('#firstView').height();
						var mlW = $('#firstView').width();
						var posY = (winH - mlH)/2+$(window).scrollTop();
						var posX = (winW - mlW)/2;
						$('#firstView').css({'top':240,'left':posX});
						$('#mask').css({"width":maskW,"height":maskH,"overflow-y":"auto","overflow-x":"hidden"});
				}
				$(window).bind("resize", resizeContainer);
				$(window).bind("scroll", resizeContainer);
	
		//transition effect
		$('#firstView').delay(800).fadeIn(1000); 		
		$('#closeModal').click(function(){
			$('#firstView').fadeTo(300,0,function(){$('#firstView').remove();});
			$('#mask').delay(200).fadeTo(500,0,function(){$('#mask').remove();});
			return false;
		})
		$('#moveEng').click(function(){
			$('#firstView').fadeTo(300,0,function(){$('#firstView').remove();});
			$('#mask').delay(200).fadeTo(200,1,function(){window.location.replace('en/index.php');});	
			return false;
		});
}
		});		
}
