
	/*
	 *
	 * 外部ファイル読み込み
	 ***************************************************************************************************/
	jQuery.require = (function(){
	 	var jspath = "/_/js/";
		var csspath = "/_/css/";
		var loadFile = function(obj){
			if(obj.type=='js'){
				document.write('<script type="text/javascript" src="' + jspath + obj.file + '"></script>');
			}else{
				document.write('<link rel="stylesheet" type="text/css" media="all" href="' + csspath + obj.file + '" />');
			}
		}
		var rfunc = function(exfiles){
			if(exfiles.join){
				for(var i=0,l=exfiles.length;i<l;i++){
					loadFile(exfiles[i]);
				}
			}else{
				loadFile(exfiles);
			}
		}
		return rfunc;
	})();

	//外部読み込みファイルリスト
	var exfilelist = [
/* 		{type:"js",file:"libs/jquery.lazyload.mini.js"}, */
		{type:"js",file:"libs/jquery.easing.1.3.js"},
		{type:"js",file:"drifters_jq.js"}
		];
		
	$.require(exfilelist);
	


	$(function(){
		
		//$("img:not(#features img)").lazyload({ effect : "fadeIn" });

		//Top
		
			//news ticker
			$("#news li").newsTicker({});
			
			//features
			$('#features').features({rw:$('#feat_btn_rw'),ff:$('#feat_btn_ff')});
			
		//event-schedule
	
			$('.eventitem').eventitem();
			$('.eventlistitem').eventlistitem();	
			

		//Magazine
		
			$('.magazineitem').magazineitem();
			$('.magazinelistitem').magazinelistitem();	
				
				
		/*
		 * 共通：ボックスへシャドウの適応
		 * ※最後に適応すること
		 */
	
			if ($.browser.msie && $.browser.version < 5)
			{			
				$('.shadowbox').dropShadow(
				{
					left : 0 ,
					top : 0 ,
					blur : 3 ,
					color : "#c0c0c0",
					swap:false
				}
				);
			}
			
			
		//スクロール
		if(location.hash != "" && location.hash != "#"){	
			scrollTo(location.hash,true);
			return false;
		}
			
	});


	var globalnaviheight = -100;

	/**
	 * 指定の要素位置までスクロールする
	 * @trgid	対象要素名
	 */	
	function scrollTo(trgid,addmargin){
		var topp = 0;
		if(addmargin == true){
			topp += globalnaviheight;
		}
		
		var hashid = trgid;
		if(trgid == "#event"){
			trgid = "#eventschedule";
		}
		
		var obj = {}
		obj.duration = 500;
		obj.easing   = "easeInOutExpo";
		if(trgid == "#pagetop"){
			topp = 0;
		}else{
			topp += $(trgid).offset().top;
			if(location.hash != hashid){
			obj.complete   = function(){location.hash = hashid};
			}
		}
		$('html, body').animate(
							{ scrollTop: topp }, 
							obj
							);
		return false;
	}

