
/**
 *
 * 共通JS
 * 前ページ共通のJS設定
 *
 */
 

	jQuery.easing.def = "string";
 
	/*
	 *
	 * 外部ファイル読み込み
	 ***************************************************************************************************/
	jQuery.require = (function(){
	 	var jspath = "/va/_commons/baseDir/js/";
		var csspath = "/va/_commons/baseDir/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:"jquery.easing.1.3.js"},
		{type:"js",file:"xlargeva_jq.js"},
		{type:"js",file:"jquery.dropshadow.js"},
		{type:"js",file:"jquery.dimensions.min.js"},
		{type:"js",file:"jquery.rollover.js"},
		{type:"js",file:"easySlider1.7.js"}
	];
		
	$.require(exfilelist);
		
		
	/*
	 *
	 * 起動
	 ***************************************************************************************************/
	$(document).ready(function(e){
			
			
		/**
		 * サーチフォーム
		 */	
		$("input","#search").mouseover(function(){
			$(this).addClass("input-over");
		}).mouseout(function(){
			$(this).removeClass("input-over");
		}).focusin(function(){
			$(this).removeClass("input-over");
			$(this).addClass("input-focusin");
		}).focusout(function(){
			$(this).removeClass("input-over");
			$(this).removeClass("input-focusin");
		});
			
			
		/*
		 * ボック マウスアクションの適応
		 */
		 
		 	//NEWS,MOVIE,BLOG
		 	
			$('.newsbox,.moviebox,.blogbox').each(function(){
					
				$(this).css("cursor","pointer");
				$(this).click(function(){
					location.href = $("a",this).attr("href");
				});
					
				var type;
				if($(this).hasClass('newsbox')) type = "news";
				if($(this).hasClass('blogbox')) type = "blog";
				if($(this).hasClass('moviebox')) type = "movie";
			
				$(this).mouseenter(function(){
					$(this).addClass(type + 'box-over');
					$(".title",this).addClass(type + 'title-over');
				});
				$(this).mouseleave(function(){
					$(this).removeClass(type + 'box-over');
					$(".title",this).removeClass(type + 'title-over');					
				});
				$(".title",this).append($("a",this).html());
				$("a",this).html("");
					
			});
			
		 	//Items
		 
			$('.itembox,.subitembox').each(function(){
			
				$(this).css("cursor","pointer");
			
				$(this).css("overflow","hidden");
				$(".outline",this).css("bottom",'-'+ ($(".outline",this).height() + 10) + 'px');
				$(".outline",this).addClass('outline-over');
				$(this).mouseenter(function(){
					$(".outline",this).stop();
					$(".outline",this).animate({bottom:'-1px'},{queue:false,duration:300});
				});
				$(this).mouseleave(function(){
					$(".outline",this).stop();
					$(".outline",this).animate({bottom:'-'+ ($(".outline",this).height() + 10) + 'px'},{queue:false,duration:200});
				});
					
				$(this).click(function(){
					location.href = $("a",this).attr("href");
				});
				$(".title",this).append($("a",this).html());
				$("a",this).html("");
						
			});
				
				
			//News index
			
			$('.newsindexbox,.sblogindexbox').each(function(){
				
				
				$(this).css("cursor","pointer");
				$(this).click(function(){
					location.href = $("a",this).attr("href");
				});
					
				var type = "newsindex";
				
				$(this).mouseenter(function(){
					$(this).addClass(type + 'box-over');
					$(".title",this).addClass('title-over');
					$(".description",this).addClass('description-over');
					$(".date",this).addClass('date-over');
				}).
				mouseleave(function(){
					$(this).removeClass(type + 'box-over');
					$(".title",this).removeClass('title-over');					
					$(".description",this).removeClass('description-over');
					$(".date",this).removeClass('date-over');
				});
					
				$(".title",this).append($("a",this).html());
				$("a",this).html("");
						
			});


			//links brand link
			
			$('.brandbox').each(function(){
			
				var _href = $("a",this).attr("href");
				var _target = $("a",this).attr("target");
				_target = _target == "" ? "_self" : _target;
				
				$(this).
				mouseenter(function(){
					$(this).addClass('brandbox-over');				
				}).
				mouseleave(function(){
					$(this).removeClass('brandbox-over');
				}).
				click(function(){
					window.open(_href, _target);
				}).
				css("cursor","pointer")
					
				$(this).append($("a",this).html());
				$("a",this).html("");
				
			});
			
			
			//Search index
			$('.searchindexbox').each(function(){
			
				var _href = $("a",this).attr("href");
				var _target = $("a",this).attr("target");
				_target = _target == "" ? "_self" : _target;
				
				$(this).
				mouseenter(function(){
					$(this).addClass('searchindexbox-over');				
					$('.title',this).addClass('title-over');
					$('.date',this).addClass('date-over');
				}).
				mouseleave(function(){
					$(this).removeClass('searchindexbox-over');
					$('.title',this).removeClass('title-over');
					$('.date',this).removeClass('date-over');
				}).
				click(function(){
					window.open(_href, _target);
				}).
				css("cursor","pointer")
					
				$(".title",this).append($("a",this).html());
				$("a",this).html("");
						
			});
				


			//記事内容
			//レイアウト調整
			$('#newsdetailmain,#sblogdetailmain').each(function(){
					$(".detailcontent",this).each(function(){
					var i= 0;
					$("p",this).each(function(){
						
						if(i == 0){
						
							var imgc = 0;
							$("img",this).each(function(){
							if(imgc >= 1) return;
							$(this).css("margin","0px");
							$(this).css("padding","0px");
							imgc++;
							})
							}
							
							i++;
								
						})
					});
			});


	
			//News Dettail タイトル：複数行対応
			$('#newsdetailmain,#itemdetaillmain,#sblogdetailmain').each(function(){
				var h = $(".title",this).height() + 10;
				h = h < 40 ? 40 : h;
				$(".detailtitle",this).css("height",h + "px");
				$(".date",this).css("line-height",h + "px");
				if($(".newicon-s",this).size() == 0) return;
				var imatop = (h - $(".newicon-s",this).height()) / 2 - 1;
				$(".newicon-s",this).css("margin-top",imatop + "px");
			});



			//ギャラリー
			$(".picgallery").picgallery({});
				
					

		/*
		 * TOP:Features
		 */	
	 
			$("#featurelist").vafeatureslider({
				loop:false,
				numericId: "featureindex"
			});				
				
			if($.browser.mozilla){
				$(".rounded-img").each(function() {
					$(this).wrap(function(){
						return '<span class="' + $(this).attr('class') + '" style="background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;behavior:url(/va/_commons/baseDir/css/ie-css3.htc);" />';
					});
					$(this).css("opacity","0.0");
				});
			}


		/*
	 	 * navi
 		 */
						
 			//タイトル付きリスト
			$('.titlelist').titlelist({})
	
	
			//開閉式リスト
			$('.expandlist').expandlist({}); 		 
 		
 		
			//位置の固定
			if($(".navi").html()){
			var _self = this;
			setTimeout(function(){
 			$(_self).navifixps({
 				//excludeids:"#title-news"	//このIDを持つページは対象から排除する
 				//enableids:"#title-brandconcept"	//このIDを持つページを対象にする
 			});
 			},1000);
 			}
 				
	
		/*
		 * 共通：ボックスへシャドウの適応
		 * ※最後に適応すること
		 */

			if ($.browser.msie && $.browser.version < 5)
			{			
				$('.shadowbox,.whbtn,.shadowbutton').dropShadow(
				{
					left : 0 ,
					top : 0 ,
					blur : 3 ,
					color : "#c0c0c0",
					swap:false
				}
				);
			}
			
	});
	
	
	/**
	 * 指定の要素位置までスクロールする
	 * @trgid	対象要素名
	 */	
	function scrollTo(trgid){
		$('html, body').animate(
							{ scrollTop: $(trgid).position().top }, 
							{ duration:500, easing:"easeInOutExpo" });
		return false;
	}
		
	/**
	 * スライドリストの追加
	 * @target		対象とする要素名
	 * @numericId	ナンバーボタンを出力する対象要素名
	 */
	var runSlideList = [];
	var runSlideNumIdList = [];
	function addRunSlideList(target,numericId){
		runSlideList.push(target);
		runSlideNumIdList.push(numericId != undefined ? numericId.split("#").join("") : 0);
	}
			
	
