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 addItem(v,text) {
  var sel  = document.form["formf_" + v];
  if (text.value!="") {
    sel.options["formf_" + v.options.length-1] = new Option(text.value,text.value);
  //  sel.options[sel.options.length] = new Option("*新規項目を追加","new");
    text.value="";
    document.form["formf_" + v].options.selectedIndex=document.form["formf_" + v].options.length-1;
  }
  else sel.options.selectedIndex = 0;
  text.blur();
  sel.style.visibility = "visible";
  getElm("addText").style.visibility = "hidden";
}


function setformvalue(num, txt, num2, hiddens)
{
    parameter = txt.split(",");
    hidd = hiddens.split(",");


    for(i=0; i<num; i++){
	v = i - 1;
//	type = getField(document.form["formf_" +i]);
//	if(document.form["formf_" +i].type == "text"){
//	  document.form["formf_" + v].value = "微妙";
//	  var sel  = document.form["formf_" + v];
//	  addItem(v,"微妙");
//	  for(x = 0; x<sel.options.length; x++){
//	    if(document.form["formf_" + v].options[x].value == parameter[i]){
//	      document.form["formf_" + v].options.selectedIndex = x;
//	    }
//		document.write("SELECTEDDD");
//	  }
//	}else if(document.form["formf_" +i].type == "textarea"){

//	  document.write("SELECTEDDD");
	  document.form["formf_" + i].value = parameter[i];
//	}
    }
    for(x=0; x<num2; x++){
	document.form["formh_" + x].value = hidd[x];
    }
    document.form["formf_0"].disabled = true;

} // end of the 'setformvalue()' function


CR = String.fromCharCode(13);

function setformid_textarea(num,txt)
{
   moto = document.form["formf_" + num].value + txt;
   document.form["formf_" + num].value = moto;

}

function setformtext(num,txt)
{
   document.form["formf_" + num].value = txt;
}

////////////////////////// checkbox ////////////////////////////
function onAll() {
  for (var i = 0; i < document.getElementById("dsearch").elements["toplevel[]"].length + 1; i++) {
    if(document.getElementById("dsearch").elements[i].type == 'checkbox'){
      document.getElementById("dsearch").elements[i].checked = 1;
    }
  }
}
function offAll() {
  for (var i = 0; i < document.getElementById("dsearch").elements["toplevel[]"].length + 1; i++) {
    if(document.getElementById("dsearch").elements[i].type == 'checkbox'){
      document.getElementById("dsearch").elements[i].checked = 0;
    }
  }
}

////////////////////////// makeshop /////////////////////////////

function login() {
		
	if (document.getElementById("loginform").shopid.value.length<4) {
	  alert ("ショップIDは4文字以上で入力してください");
	  document.getElementById("loginform").shopid.focus();
	  return;
	}
	if (document.getElementById("loginform").shoppw.value.length<4) {
	  alert ("パスワードは4文字以上で入力してください");
	  document.getElementById("loginform").shoppw.focus();
	  return;
	}
	if (document.getElementById("loginform").newwin.checked == true){
	  window.open("","newwin","width=840,height=720,toolbar=no,scrollbars=yes,resizable=yes,status=no");
	  document.getElementById("loginform").target="newwin";
	}
	document.getElementById("loginform").submit();
}
	
function go_testshop() {

ope = window.open("","sample","width=840,height=720,toolbar=no,scrollbars=yes,resizable=yes,status=no");
fr=document.getElementById("loginform");
fr.target = "sample" ;
fr.shopid.value="can01";
fr.shoppw.value="pass";
fr.submit();
}

function saveData()
{
	theName  = "shopid";
	theValue = document.getElementById("loginform").shopid.value;
	theDay   = 7;
	setDay = new Date();
	setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
	expDay = setDay.toGMTString();
	document.cookie = theName + "="+escape(theValue)+";expires="+expDay;
}
function lodeData(){
	theData   = "";
	theName   = "shopid=";
	theCookie = document.cookie+";";
	start = theCookie.indexOf(theName);
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		theData = unescape(theCookie.substring(start+theName.length,end));
	}
	document.getElementById("loginform").shopid.value = theData;
}



/////////////////////////////////////////////////////////////////////////
