	var pcPow=1;
	var mobile = ((navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i)));
	var isIpad = (navigator.userAgent.match(/iPad/i));
	var isTop=false;
	var detailCover;
	var isChangePage=false;
	var playIco="../img/common/playico.png";
	var playerPass="../img/apps/player.swf";
	var isIE;
	var pageLogTag=[];
	var showElementTag=[];
	var query = window.location.search;
	function construction(){
		jQuery(  
			  function ($) { 
			    isIE=$.browser.msie;
				isMSIE6 = (isIE && $.browser.version < 7) ? true : false;		
				new root.main.Index();				
				}
			);
	}
	var root = 
	{  
	  main: { 
		Index: function() {			
				if (isIpad||mobile) {
					 pcPow=0.1;
				}
				if (pcPow==1) {
					$(".globalMenu span").BTN_EF();
					$("#SubMenu a").BTN_EF();
					$("#footer a").BTN_EF();
				}			
			//log
			if(pageLogTag.length>1){
				getLog(pageLogTag[0]);	
			}
			/* PageTop */
			$('#pageTop').PageTop();
		 
			/* resize */			
			fixed1("bg",0,0);
			$(window).resize(resize);
			resize(null);
			
		} //Index 
	  } //main
	}; //root
	
	var winW;
	var winH;	
	var imgW = 1500;
    var imgH = 786;
	var underH=40;
	
	function resize(e){	
           	winW = $(window).width();
          	winH = $(window).height();
			var scaleW = winW / imgW;
            var scaleH = winH / imgH;
            var fixScale = Math.max(scaleW, scaleH);			
			var setW = imgW * fixScale;
            var setH = imgH * fixScale;
			var moveX = Math.round((winW - setW) * 0.80);
            var moveY = Math.round((winH - setH) * 0.10);
			
			var setH2=(imgH+underH)* fixScale;
			
			$('#bgimg').css({
				'left':moveX,
                'top':moveY,
				'width':setW,
				'height':setH2
			  });
	}
	
	 function fixed1(id,x_num,y_num){
            var div=$("#"+id);
                div.css({
                    position:'fixed',
                    left:x_num,
                    top:y_num
                });            
           if(isMSIE6){div.exFixed();};			
        }
		
		var nnnnPage;
		function setPage(str){
			nnnnPage=str;
			if(isLocal){
				changePage();
			}else{
				if(document.referrer&&document.referrer.indexOf(str)==-1){				
				changePage();
				}
			}
		}
		
		function changePage(){	
			isChangePage=true;
			if(pcPow==1){
				detailCover =$("<div/>",{id:"detailCover"});
				$("#headerDown").append(detailCover);
				$("#SubMenu").hide();
			}
		}
		
		function contLoadEnd(){
			if(isTop){
				$("#container").css("background","url('img/common/dummy.gif')");
			}else{
				$("#container").css("background","url('../img/common/dummy.gif')");
			}
		};
		


/************************************************

* pageIn

************************************************/


function detailCoverOut(){
	if(isChangePage){
		if(pcPow==1){
			detailCover.animate({opacity:0},800,"linear");
			$("#SubMenu").fadeIn(350);
		}else{
			$("#SubMenu").show();
		}
	}
}


function prePageIn(){	
	$('html,body').attr('scrollTop',0);	
	if(pcPow==1){	
		$(".moveCont").each(function(){
						var ta=	$(this);
						ta.css("top",winH);
						});	
	}
	
}

function pageIn(){
		 if(isMSIE6){
			  DD_belatedPNG.fix('.pngFix');
			  setTimeout("pageIn2()",1000);
			 }else{
				pageIn2();
			 }
}

function pageIn2(){
			contLoadEnd();			
			$("#bg").show();
			$("#wrapper").css("display","block");	
			detailCoverOut();
			oripageIn();
			var i=0;
			var delayNum;
			if(pcPow==1){
				$(".moveCont").each(function(){
						var ta=	$(this);	 
						delayNum=ta.attr("no");
						delayNum=((delayNum!=undefined)?delayNum:i);
								ta.stop()
								.delay(delayNum*200)
								.animate({top: 0}, 900, 'easeInOutQuart');
								i++;
					});
				
				var totalDelay=i*250+1350;
				setTimeout("pageFunction()",totalDelay);
				setTimeout("pageIn3()",totalDelay-150);	
			}else{
				pageFunction();
				$("#footer").fadeIn();
			}			
}



	function pageIn3(){
		if(pcPow==1){
			$("#footer").fadeIn();	
			$("#footer").show();//簡易的にIE8のTopﾍﾟーｼﾞ対策
			
		}
	}

 
	//log
	var mixiTag=[];
	var twitterTag=[];
	var facebookTag=[];
	function facebook(){
		if(facebookTag.length>0){
			getLog(facebookTag[0],facebookTag[1]);
		}
	}
	function twitter(){
		if(twitterTag.length>0){
			getLog(twitterTag[0],twitterTag[1]);
		}
		
	}
	function mixi(){
		if(mixiTag.length>0){
			getLog(mixiTag[0],mixiTag[1]);
		}		
	}
	
function setSocial(tag,tag2,key){	
var dataUrl="http://pocarisweat.jp/"+tag+"/";
var dataUrl2='http%3A%2F%2Fpocarisweat.jp%2F'+tag+'%2Findex.html';
var mixhtml='<a href="http://mixi.jp/share.pl" onClick="mixi();" class="mixi-check-button" data-key="'+key+'" data-url="'+dataUrl+'">mixiチェック</a><script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>';
var tweethtml='<a href="http://twitter.com/share" class="twitter-share-button" data-url="'+dataUrl+'" data-text="ポカリスエット公式サイト｜'+tag2+'  #pocarisweat" data-count="horizontal" data-lang="ja">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js" charset="utf-8"></script>';
var facehtml='<iframe src="http://www.facebook.com/plugins/like.php?href='+dataUrl2+'&amp;layout=button_count&amp;show_faces=false&amp;width=120&amp;action=like&amp;font&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:20px;" allowTransparency="true"></iframe>';

$(".sosial").html('<span class="mixi">'+mixhtml+'</span><span class="tweet">'+tweethtml+'</span><span class="facebook">'+facehtml+'</span>');
$(".tweet").hover(function(){twitter();},function(){});
$(".facebook").hover(function(){facebook();},function(){});
}

function oripageIn(){}
function pagePause(b){}
