/*--------------------------------------
	スクロールしながら目的地へ
---------------------------------------*/

function getScrollLeft() { 
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {

  /*WinIE6標準モード稼動オブジェクト差異対応
    WinIE6標準モードとそれ以外で、それぞれ稼動しているオブジェクトを取り出す*/
  docele=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;

  return docele.scrollLeft;

 } else if (window.pageXOffset) {
  return window.pageXOffset;
 } else {
  return 0;
 }
}

function getScrollTop() { 
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {

  /*WinIE6標準モード稼動オブジェクト差異対応
    WinIE6標準モードとそれ以外で、それぞれ稼動しているオブジェクトを取り出す*/
  docele=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;
  
  return docele.scrollTop;

 } else if (window.pageYOffset) {
  return window.pageYOffset;
 } else {
  return 0;
 }
}

var pageScrollTimer;

function pageScroll(toX,toY,frms,cuX,cuY) { 
 if (pageScrollTimer) clearTimeout(pageScrollTimer);
 if (!toX || toX < 0) toX = 0;
 if (!toY || toY < 0) toY = 0;
 if (!cuX) cuX = 0 + getScrollLeft();
 if (!cuY) cuY = 0 + getScrollTop();
 if (!frms) frms = 6;

 if (toY > cuY && toY > (getAnchorPosObj('end','enddiv').y) - getInnerSize().height) toY = (getAnchorPosObj('end','enddiv').y - getInnerSize().height) + 1;
 cuX += (toX - getScrollLeft()) / frms; if (cuX < 0) cuX = 0;
 cuY += (toY - getScrollTop()) / frms;  if (cuY < 0) cuY = 0;
 var posX = Math.floor(cuX);
 var posY = Math.floor(cuY);
 window.scrollTo(posX, posY);

 if (posX != toX || posY != toY) {
  pageScrollTimer = setTimeout("pageScroll("+toX+","+toY+","+frms+","+cuX+","+cuY+")",16);
 }
}

function jumpToPageTop() { 
  pageScroll(0,0,7);
}




/*--------------------------------------
	DW標準の「サブウィンドウで開く」
---------------------------------------*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}





/*--------------------------------------------
	FireFoxでも強引にウインドウを閉じる
---------------------------------------------*/

function close_win(){
var nvua = navigator.userAgent;
if(nvua.indexOf('MSIE') >= 0){
if(nvua.indexOf('MSIE 5.0') == -1) {
top.opener = '';
}
}
else if(nvua.indexOf('Gecko') >= 0){
top.name = 'CLOSE_WINDOW';
wid = window.open('','CLOSE_WINDOW');
}
top.close();
}



/*--------------------------------------------------
	お手軽ロールオーバー
----------------------------------------------------
	[1]class="imgover"
	[2]ファイル名の語尾に「_o」付けた画像を用意
----------------------------------------------------
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.dnolan.com/code/js/rollover/
*/

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

/*
window.onload = initRollovers;
*/



// 縫い合わせユニフォームカラーシミュレーターのページをポップアップで開く
//------------------------------------------------------------------------------
var dspWidth  = screen.width;
var dspHeight = screen.height;

function openwind(){
	var winWidht  = dspWidth-10;
	var winHeight = dspHeight-55;
	var winLeft   = 0;
	var winTop    = 0;

	var optSt = "directories=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";

	optSt += "width=" +winWidht + ",height=" +winHeight + ",left=" +winLeft + ",top=" +winTop;
	
	if (dspWidth < 1000){
		var win1 = window.open('http://www.longyong.jp/uniform_info/UniformSimulator2.htm','LONGLONG3D',optSt);
		/* var win1 = window.open('http://dp17283101.lolipop.jp/simulator/stitch/UniformSimulator2.htm','LONGLONG3D',optSt); */
	}
	else{
		var win1 = window.open('http://www.longyong.jp/uniform_info/UniformSimulator1.htm','LONGLONG3D',optSt);
		/* var win1 = window.open('http://dp17283101.lolipop.jp/simulator/stitch/UniformSimulator1.htm','LONGLONG3D',optSt); */
	}
}


// 昇華プリントユニフォームカラーシミュレーターのページをポップアップで開く
//------------------------------------------------------------------------------
function openStSimulator(){
	win=window.open('http://www.longyong.jp/simulator/print/index.html','','toolbar=0,status=0,location=0,menubar=0,fullscreen=0,scrollbars=yes,resizable=yes,width=955,height=715');
}

// LaBOLA縫い合わせユニフォームカラーシミュレーターのページをポップアップで開く
//------------------------------------------------------------------------------
var dspWidth  = screen.width;
var dspHeight = screen.height;

function openwind2(){
	var winWidht  = dspWidth-10;
	var winHeight = dspHeight-55;
	var winLeft   = 0;
	var winTop    = 0;

	var optSt = "directories=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,";

	optSt += "width=" +winWidht + ",height=" +winHeight + ",left=" +winLeft + ",top=" +winTop;
	
	if (dspWidth < 1000){
		var win1 = window.open('http://www.longyong.jp/labola/stitch/UniformSimulator2a.htm','LONGLONG3D',optSt);
		/* var win1 = window.open('http://dp17283101.lolipop.jp/simulator/stitch/UniformSimulator2.htm','LONGLONG3D',optSt); */
	}
	else{
		var win1 = window.open('http://www.longyong.jp/labola/stitch/UniformSimulator1a.htm','LONGLONG3D',optSt);
		/* var win1 = window.open('http://dp17283101.lolipop.jp/simulator/stitch/UniformSimulator1.htm','LONGLONG3D',optSt); */
	}
}


// LaBOLA昇華プリントユニフォームカラーシミュレーターのページをポップアップで開く
//------------------------------------------------------------------------------
function openStSimulator2(){
	win=window.open('http://www.longyong.jp/labola/print/index.html','','toolbar=0,status=0,location=0,menubar=0,fullscreen=0,scrollbars=yes,resizable=yes,width=955,height=715');
}




// カート　詳細画面 画像切替
//------------------------------------------------------------------------------
function img_switcher(obj){
	
	document.getElementById("Main_Img").src = obj.href;
	return false;
}




// ログイン判定
//------------------------------------------------------------------------------
var login ={};

login.init = function(){
	var name = "accnm";
	if(Cookie.read(name)){
		document.write('<li><a href="https://www.longyong.jp/mypage/memberpage.php"><img src="/img/navi_01.gif" class="imgover" alt="マイページ" width="90" height="17" border="0" /></a></li>');
		document.write('<li><a href="https://www.longyong.jp/mypage/login.php?cmd=logout"><img src="/img/navi_05.gif" class="imgover" alt="ログアウト" width="90" height="17" border="0" /></a></li>');
		document.write('<li class="name">ようこそ' + decodeURIComponent(Cookie.read(name)) + 'さん</li>');
	}else{
		document.write('<li><a href="https://www.longyong.jp/form/inquiry/" target="_blank"><img src="/img/navi_02.gif" class="imgover" alt="新規会員登録" width="100" height="17" border="0" /></a></li>');
		document.write('<li><a href="https://www.longyong.jp/mypage/login.php"><img src="/img/navi_04.gif" class="imgover" alt="ログイン" width="90" height="17" border="0" /></a></li>');
	}
	
	
	//<li><a href="https://www.longyong.jp/mypage/memberpage.php"><img src="../img/navi_01.gif" class="imgover" alt="マイページ" width="90" height="17" border="0" usemap="#mai" /></a></li>
	//<li class="name">ようこそ○○さん</li>

	
};

var Cookie = { //cookie
	read:function(CookieName){
		if(document.cookie){
			var cookie_Data = document.cookie;
			var data = "";
			cookie_Data = cookie_Data.split("; ");
			for(var i=0;i<cookie_Data.length;i++){
				cookie_Data[i] = cookie_Data[i].split("=");
			}
			
			for(var i=0;i<cookie_Data.length;i++){
			
				if(CookieName == cookie_Data[i][0]){
					data += cookie_Data[i][1];
				}
			
			}
			if(data != ""){
				return(data);
			}
		}
		return(false);
	}
}

function MM_jumpMenu02(targ,selObj,restore){ //v3.0
eval(targ+".location='"+Header_Script+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
} 