// JavaScript Document

function my_getbyid(id)
{
   itm = null;
   if (document.getElementById)
   {
      itm = document.getElementById(id);
   }
   else if (document.all)
   {
      itm = document.all[id];
   }
   else if (document.layers)
   {
      itm = document.layers[id];
   }
   
   return itm;
}

function show_div(whichLayer)
{
	obj_style = my_getbyid(whichLayer).style;
	obj_style.display = "block"
	
}

function hide_div(whichLayer)
{
	obj_style = my_getbyid(whichLayer).style;
	obj_style.display = "none"
}




function xmlhttp_post(url)
{

  var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.Open("post",url,false);
  xmlhttp.Send();
  return xmlhttp.responseText;
  
}





function OpenWindow(url,width,height){

	// 在一个自动居中的新窗口中显示页面

	// url 要访问的页面地址

	// width 新窗口宽度

	// height 新窗口高度

	window.open(url,'','left='+(screen.width-width)/2+',top='+(screen.height-height)/2+',width='+width+',height='+height+',scrollbars=yes');

}



function OpenWindow1(url,width,height,id){

    var url1;
	url1=url+"?kahao="+my_getbyid(id).value;
	window.open(url1,'','left='+(screen.width-width)/2+',top='+(screen.height-height)/2+',width='+width+',height='+height+',scrollbars=yes');

}

function OpenWindow2(url,width,height){

	// 在一个自动居中的新窗口中显示页面

	// url 要访问的页面地址

	// width 新窗口宽度

	// height 新窗口高度

	window.open(url,'','left=0,top=0,width='+screen.width+',height='+screen.height+',scrollbars=yes');

}


function Choose_product(productid,productname,price){

  window.opener.document.myform.productid.value=productid;
  window.opener.document.myform.productname.value=productname;
  window.opener.document.myform.price.value=price;
  self.close();
  
}

function isemail (s)
{
        // Writen by david, we can delete the before code
        if (s.length > 50)
        {
                window.alert("E-mail");
                return false;
        }

         var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT|cn|CN)$"
         var re = new RegExp(regu);
         if (s.search(re) != -1) {
                 return true;
         } else {
                 window.alert ("E-mail")
                 return false;
         }
}

function btn_contact()
{
  my_getbyid("contact99").innerHTML="<input type=\"submit\" name=\"submit\" value=\"内容確認へ\">  <input type=\"reset\" name=\"submit2\" value=\"リセット\">"
}