
//---------------------------------------------------------------------------

function WindowOpen(url,target,features){
	if(!window.opener || window.opener.closed){
	if(features=="default"){
		var NewWin=window.open(url,target);
		}	else{
				var NewWin=window.open(url,target,features);
				}	
		NewWin.focus();
	} 
	else{ 
	window.opener.location.href = url; 
	window.opener.focus();
	} 
return false;

}

//---------------------------------------------------------------------------
//ロールオーバー
function RollOver(obj,val) {
	obj.src = val;
} 
//---------------------------------------------------------------

function Print(){		//現在のページを印刷用に別ウィンドウで開く
URL= location.href;
		URL = URL.split("pagetop");
		URL2 ="";
		URL = URL.join(URL2);
		URL = URL.split("#");
		URL = URL.join(URL2);
		URL = URL.split("%23");
		URL = URL.join(URL2);
	if (URL.indexOf("?print",0) == -1){
		URL=URL+'?print';
		WindowOpen(URL,'print','default');
	}
}

function PrintStart(){		//印刷
	if(document.getElementById || document.layers){
		window.print();
	}
}

//---------------------------------------------------------
function zoomPht(url){//画像拡大画面

	var wx = 400;
	var wy = 450;
	var x = (screen.width  - wx) / 2;
	var y = (screen.height - wy) / 2;
	
	var PhtWin = window.open("","subWin","left="+x+",top="+y+",width="+wx+",height="+wy);
			
	var str = "<html><head><title>拡大画像<\/title><\/head>\n<body onLoad=\"focus()\">\n<div align=center><p><img src=\""+url+"\" width=\"350\" height=\"350\" alt=\"拡大画像\"></p>\n<p style=\"font-size:10px\;color:#AAAAAA\;margin-top:5px\;\">※ 画像と実際の商品とは色が若干異なって見える場合がございます。</p>\n<p><a href=\"javascript:window.close();\"><img src=\"http:\/\/www.qbb.co.jp\/img\/close.gif\" alt=\"ウィンドウを閉じる\" width=\"95\" height=\"16\" border=\"0\"><\/a><\/p>\n<\/div>\n<\/body>\n<\/html>";
		PhtWin.document.open();
		PhtWin.document.write(str);
		PhtWin.document.close();
	}

//---------------------------------------------------
 function Display(id){
	if(document.all){
		if(document.all(id).style.display == "block"){
			document.all(id).style.display = "none";
			
		}else if(document.all(id).style.display == "none"){
			document.all(id).style.display = "block";
		}
	}else if(document.getElementById){
		if(document.getElementById(id).style.display == "block"){
			document.getElementById(id).style.display = "none";
		}else if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "block";
		}
	}
}


// 入力チェック***********************************************

function clear(form){//フォームアイテムの背景クリア
	for (i=0;i<form.elements.length ;i++) {
		form.elements[i].style.backgroundColor=''
    }
}

//....................................................................................................................................................................................

var strZen = '０１２３４５６７８９ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＤＸＹＺａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ−＿．＠'
var strhHan = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.@'
var strZenNum = '０１２３４５６７８９−'
var strhHanNum = '0123456789-'
var strNum = '0123456789-０１２３４５６７８９−'
var caps='0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ'

//....................................................................................................................................................................................
function chktext_ZenHan(oj) {//全角→半角変換
  var newStr = ''
  for (i=0;i<oj.value.length;i++){
    if (strZen.indexOf(oj.value.charAt(i)) != -1) {
      newStr += strhHan.charAt(strZen.indexOf(oj.value.charAt(i)))
		}    
	else{
      newStr += oj.value.charAt(i)
	  }
  }
  oj.value = newStr
}
//....................................................................................................................................................................................

 function chktext_1byte(oj,name){//半角英数かチェック
    err = 0;
    for (i=0;i<oj.value.length;i++){
      if (strhHan.indexOf(oj.value.charAt(i)) == -1) {
	  err++;
	  }
    }
    if (err!=0) {
	alert(name+'は半角英数字で入力してください。');
		}
  }
  //....................................................................................................................................................................................

 function chk_caps(oj,name){//小文字かチェック
    err = 0;
    for (i=0;i<oj.value.length;i++){
      if (caps.indexOf(oj.value.charAt(i)) == -1) {
	  err++;
	  }
    }
    if (err!=0) {
	alert(name+'は半角英数小文字で入力してください。');
		}
  }
  


//....................................................................................................................................................................................
function chktext_ZenNum(oj) {
  var newStr = ''
  for (i=0;i<oj.value.length;i++){
    if (strZen.indexOf(oj.value.charAt(i)) != -1) {
      newStr += strhHanNum.charAt(strZenNum.indexOf(oj.value.charAt(i)))
		}    
	else{
      newStr += oj.value.charAt(i)
	  }
  }
  oj.value = newStr
}
//....................................................................................................................................................................................
 function chk_Num(oj,name){//半角数字チェック
    err = 0;
    for (i=0;i<oj.value.length;i++){
      if (strNum.indexOf(oj.value.charAt(i)) == -1) {
	  err++;
	  }
    }
    if (err!=0) {
	alert(name+'は半角数字で入力してください。');
	oj.value='';
	oj.style.backgroundColor='#FFE0E0';
		}
	else{
		chktext_ZenNum(oj);
		oj.style.backgroundColor='';
	}
  }

//....................................................................................................................................................................................


function toZenKana(oj){//半角カナ→全角カナ変換
	txt = "ｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｧｨｩｪｫｬｭｮｯ､｡ｰ｢｣ﾞﾟ";
	zen = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンァィゥェォャュョッ、。ー「」";
	zen+= "　　　　　ガギグゲゴザジズゼゾダヂヅデド　　　　　バビブベボ　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　";
	zen+= "　　　　　　　　　　　　　　　　　　　　　　　　　パピプペポ　　　　　　　　　　　　　　　　　　　　　　　　　　　　　";
	str = "";
	for (i=0; i<oj.value.length; i++){
		c = oj.value.charAt(i);
		cnext = oj.value.charAt(i+1);
		n = txt.indexOf(c,0);
		nnext = txt.indexOf(cnext,0);
		if (n >= 0){
			if (nnext == 60){
				c = zen.charAt(n+60);
				i++;
			}else if (nnext == 61){
				c = zen.charAt(n+120);
				i++;
			}else{
				c = zen.charAt(n);
			}
		}
		if ((n != 60) && (n != 61)){
			str += c;
		}
	}
	oj.value=str;
}
//...............................................................
function chkZip(oj){//郵便番号4桁目に「-」を入れる
    err = 0;
    for (i=0;i<oj.value.length;i++){
      if (oj.value.indexOf("-",0) == -1) {
	  err++;
	  }
    }
	if (err!=0) {
		newStr =''
		len=oj.value.length;
		strA = oj.value.substring(0,3);
		strB = oj.value.substring(3,len);
		newStr= strA+'-'+strB;
		oj.value = newStr;
		}

}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function jobWin(url,name,option) { 
window.open(url,name,option);
}

