// JavaScript Document

function OnLoadImage(ImgD,ImgW,ImgH)//不断判断
{       
	var image=new Image();     
	image.src=ImgD.src;
	bl=image.width/image.height;
	
	if (image.width>image.height){
		if(image.width>ImgW){
			ImgD.width=ImgW;       
			ImgD.height=ImgD.width/bl;
			if (ImgD.height>ImgH){
				ImgD.height=ImgH;
			}
		}
		else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
	}
	else if(image.width<image.height) {
		if(image.height>ImgH){           
			ImgD.height=ImgH;       
			ImgD.width=ImgD.height*bl;
			if (ImgD.width>ImgW){
				ImgD.width=ImgW;
			}
		}
		else{
			if (image.width>ImgW){
				ImgD.width=ImgW;
				ImgD.height=ImgD.width/bl;
				if (ImgD.height>ImgH){
					ImgD.height=ImgH;
				}
			}
			else {
				ImgD.width=image.width;
			}
		}
	}
	else if (image.width=image.height) {
		if (image.width>ImgW) {
			ImgD.width=ImgW;
			ImgD.height=ImgW;
		}
		else if (image.width<=ImgW)
		{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
	}
}

function CheckLoginForm(){
	with (document.all.loginForm) {
		if (userName.value=="") {
			alert('ID・パスワードを正しくご記入ください！');
			userName.focus();
			return false;
		}
		if (password.value=="") {
			alert('ID・パスワードを正しくご記入ください！');
			password.focus();
			return false;
		}
		return true;
	}
}

function KeyDown() { 
	if (event.keyCode == "13") { 
		CheckSearchFormOKGO();
	} 
} 

function CheckSearchFormOKGO() {
	with (document.all.searchFormOKGO) {
		if (searchKey.value=="") {
			alert('商品名また商品品番入力下');
			return false;
		}
		document.all.searchFormOKGO.action="/products.asp?searchKey=" + escape(searchKey.value);
	}
}

function ShowSemllClasses(idVal) {
	var nVal=eval("document.all.trs" + idVal + "Hid").value;
	if (eval("document.all.dYN" + idVal + "Hid").value=="0")	{
		for (i=1;i<=nVal;i++ ) {
			eval("document.all.tr" + idVal + i).style.display='';
		}
		eval("document.all.dYN" + idVal + "Hid").value="1";
	}
	else {
		for (i=1;i<=nVal;i++ ) {
			eval("document.all.tr" + idVal + i).style.display='none';
		}
		eval("document.all.dYN" + idVal + "Hid").value="0"
	}
}


 var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二");
 var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);
 var days = new Array("日","月", "火", "水","木", "金", "土");
 var classTemp;
 var today=new getToday();
 var year=today.year;
 var month=today.month;
 var newCal; 
 function getDays(month, year) {
  if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;
  else return daysInMonth[month];
 }
 function getToday() {
  this.now = new Date();
  this.year = this.now.getFullYear();
  this.month = this.now.getMonth();
  this.day = this.now.getDate();
 }
 function Calendar() {
  newCal = new Date(year,month,1);
  today = new getToday();   
  var day = -1;
  var startDay = newCal.getDay();
  var endDay=getDays(newCal.getMonth(), newCal.getFullYear());
  var daily = 0;
  if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
  {
   day = today.day;
  }
  var caltable = document.all.caltable.tBodies.calendar;
  var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());
  for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++)
   for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++)
   {
    var cell = caltable.rows[intWeek].cells[intDay];
    var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);         
    if ((intDay == startDay) && (0 == daily)){ daily = 1;}
    var daytemp=daily<10?("0"+daily):(daily);
    var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">";
    if(day==daily) cell.className="DayNow";
    else if(intDay==6) cell.className = "DaySat";
    else if (intDay==0) cell.className ="DaySun";
    else cell.className="Day";
    if ((daily > 0) && (daily <= intDaysInMonth))
    {
     cell.innerText = daily;
     daily++;
    } else
    {
     cell.className="CalendarTD";
     cell.innerText = "";
    }
  }
  document.all.year.value=year;
  document.all.month.value=month+1;
 }
 function subMonth()
 {
  if ((month-1)<0)
  {
   month=11;
   year=year-1;
  } else
  {
   month=month-1;
  }
  Calendar();
 }
 function addMonth()
 {
  if((month+1)>11)
  {
   month=0;
   year=year+1;
  } else
  {
   month=month+1;
  }
  Calendar();
 }
 function setDate() 
 {
  if (document.all.month.value<1||document.all.month.value>12)
  {
   alert("月、有効な範囲は1-12中間です.");
   return;
  }
  year=Math.ceil(document.all.year.value);
  month=Math.ceil(document.all.month.value-1);
  Calendar();
 }

function buttonOver()
{
 var obj = window.event.srcElement;
 obj.runtimeStyle.cssText = "background-color:#FFFFFF";
// obj.className="Hover";
}
function buttonOut()
{
 var obj = window.event.srcElement;
 window.setTimeout(function(){obj.runtimeStyle.cssText = "";},300);
}

var Speed_1 = 10; //速度(毫秒)
var Space_1 = 20; //每次移动(px)
var PageWidth_1 = 151 * 3; //翻页宽度
var interval_1 = 7000; //翻页间隔
var fill_1 = 0; //整体移位
var MoveLock_1 = false;
var MoveTimeObj_1;
var MoveWay_1="right";
var Comp_1 = 0;
var AutoPlayObj_1=null;
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay_1(){clearInterval(AutoPlayObj_1);AutoPlayObj_1=setInterval('ISL_GoDown_1();ISL_StopDown_1();',interval_1)}
function ISL_GoUp_1(){if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="left";MoveTimeObj_1=setInterval('ISL_ScrUp_1();',Speed_1);}
function ISL_StopUp_1(){if(MoveWay_1 == "right"){return};clearInterval(MoveTimeObj_1);if((GetObj('ISL_Cont_1').scrollLeft-fill_1)%PageWidth_1!=0){Comp_1=fill_1-(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1);CompScr_1()}else{MoveLock_1=false}
AutoPlay_1()}
function ISL_ScrUp_1(){if(GetObj('ISL_Cont_1').scrollLeft<=0){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft+GetObj('List1_1').offsetWidth}
GetObj('ISL_Cont_1').scrollLeft-=Space_1}
function ISL_GoDown_1(){clearInterval(MoveTimeObj_1);if(MoveLock_1)return;clearInterval(AutoPlayObj_1);MoveLock_1=true;MoveWay_1="right";ISL_ScrDown_1();MoveTimeObj_1=setInterval('ISL_ScrDown_1()',Speed_1)}
function ISL_StopDown_1(){if(MoveWay_1 == "left"){return};clearInterval(MoveTimeObj_1);if(GetObj('ISL_Cont_1').scrollLeft%PageWidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){Comp_1=PageWidth_1-GetObj('ISL_Cont_1').scrollLeft%PageWidth_1+fill_1;CompScr_1()}else{MoveLock_1=false}
AutoPlay_1()}
function ISL_ScrDown_1(){if(GetObj('ISL_Cont_1').scrollLeft>=GetObj('List1_1').scrollWidth){GetObj('ISL_Cont_1').scrollLeft=GetObj('ISL_Cont_1').scrollLeft-GetObj('List1_1').scrollWidth}
GetObj('ISL_Cont_1').scrollLeft+=Space_1}
function CompScr_1(){if(Comp_1==0){MoveLock_1=false;return}
var num,TempSpeed=Speed_1,TempSpace=Space_1;if(Math.abs(Comp_1)<PageWidth_1/2){TempSpace=Math.round(Math.abs(Comp_1/Space_1));if(TempSpace<1){TempSpace=1}}
if(Comp_1<0){if(Comp_1<-TempSpace){Comp_1+=TempSpace;num=TempSpace}else{num=-Comp_1;Comp_1=0}
GetObj('ISL_Cont_1').scrollLeft-=num;setTimeout('CompScr_1()',TempSpeed)}else{if(Comp_1>TempSpace){Comp_1-=TempSpace;num=TempSpace}else{num=Comp_1;Comp_1=0}
GetObj('ISL_Cont_1').scrollLeft+=num;setTimeout('CompScr_1()',TempSpeed)}}
function picrun_ini(){
GetObj("List2_1").innerHTML=GetObj("List1_1").innerHTML;
GetObj('ISL_Cont_1').scrollLeft=fill_1>=0?fill_1:GetObj('List1_1').scrollWidth-Math.abs(fill_1);
GetObj("ISL_Cont_1").onmouseover=function(){clearInterval(AutoPlayObj_1)}
GetObj("ISL_Cont_1").onmouseout=function(){AutoPlay_1()}
AutoPlay_1();
}
var Speed_1xx = 10; //速度(毫秒)
var Space_1xx = 20; //每次移动(px)
var PageWidth_1xx = 151 * 3; //翻页宽度
var interval_1xx = 7000; //翻页间隔
var fill_1xx = 0; //整体移位
var MoveLock_1xx = false;
var MoveTimeObj_1xx;
var MoveWay_1xx="right";
var Comp_1xx = 0;
var AutoPlayObj_1xx=null;
function GetObjxx(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay_1xx(){clearInterval(AutoPlayObj_1xx);AutoPlayObj_1xx=setInterval('ISL_GoDown_1xx();ISL_StopDown_1xx();',interval_1xx)}
function ISL_GoUp_1xx(){if(MoveLock_1xx)return;clearInterval(AutoPlayObj_1xx);MoveLock_1xx=true;MoveWay_1xx="left";MoveTimeObj_1xx=setInterval('ISL_ScrUp_1xx();',Speed_1xx);}
function ISL_StopUp_1xx(){if(MoveWay_1xx == "right"){return};clearInterval(MoveTimeObj_1xx);if((GetObjxx('ISL_Cont_1xx').scrollLeft-fill_1xx)%PageWidth_1xx!=0){Comp_1xx=fill_1xx-(GetObjxx('ISL_Cont_1xx').scrollLeft%PageWidth_1xx);CompScr_1xx()}else{MoveLock_1xx=false}
AutoPlay_1xx()}
function ISL_ScrUp_1xx(){if(GetObjxx('ISL_Cont_1xx').scrollLeft<=0){GetObjxx('ISL_Cont_1xx').scrollLeft=GetObjxx('ISL_Cont_1xx').scrollLeft+GetObjxx('List1_1xx').offsetWidth}
GetObjxx('ISL_Cont_1xx').scrollLeft-=Space_1xx}
function ISL_GoDown_1xx(){clearInterval(MoveTimeObj_1xx);if(MoveLock_1xx)return;clearInterval(AutoPlayObj_1xx);MoveLock_1xx=true;MoveWay_1xx="right";ISL_ScrDown_1xx();MoveTimeObj_1xx=setInterval('ISL_ScrDown_1xx()',Speed_1xx)}
function ISL_StopDown_1xx(){if(MoveWay_1xx == "left"){return};clearInterval(MoveTimeObj_1xx);if(GetObjxx('ISL_Cont_1xx').scrollLeft%PageWidth_1xx-(fill_1xx>=0?fill_1xx:fill_1xx+1)!=0){Comp_1xx=PageWidth_1xx-GetObjxx('ISL_Cont_1xx').scrollLeft%PageWidth_1xx+fill_1xx;CompScr_1xx()}else{MoveLock_1xx=false}
AutoPlay_1xx()}
function ISL_ScrDown_1xx(){if(GetObjxx('ISL_Cont_1xx').scrollLeft>=GetObjxx('List1_1xx').scrollWidth){GetObjxx('ISL_Cont_1xx').scrollLeft=GetObjxx('ISL_Cont_1xx').scrollLeft-GetObjxx('List1_1xx').scrollWidth}
GetObjxx('ISL_Cont_1xx').scrollLeft+=Space_1xx}
function CompScr_1xx(){if(Comp_1xx==0){MoveLock_1xx=false;return}
var numxx,numxx=Speed_1xx,TempSpace=Space_1xx;if(Math.abs(Comp_1xx)<PageWidth_1xx/2){TempSpace=Math.round(Math.abs(Comp_1xx/Space_1xx));if(TempSpace<1){TempSpace=1}}
if(Comp_1xx<0){if(Comp_1xx<-TempSpace){Comp_1xx+=TempSpace;numxx=TempSpace}else{numxx=-Comp_1xx;Comp_1xx=0}
GetObjxx('ISL_Cont_1xx').scrollLeft-=numxx;setTimeout('CompScr_1xx()',numxx)}else{if(Comp_1xx>TempSpace){Comp_1xx-=TempSpace;numxx=TempSpace}else{numxx=Comp_1xx;Comp_1xx=0}
GetObjxx('ISL_Cont_1xx').scrollLeft+=numxx;setTimeout('CompScr_1xx()',numxx)}}
function picrun_inixx(){
GetObjxx("List2_1xx").innerHTML=GetObjxx("List1_1xx").innerHTML;
GetObjxx('ISL_Cont_1xx').scrollLeft=fill_1xx>=0?fill_1xx:GetObjxx('List1_1xx').scrollWidth-Math.abs(fill_1xx);
GetObjxx("ISL_Cont_1xx").onmouseover=function(){clearInterval(AutoPlayObj_1xx)}
GetObjxx("ISL_Cont_1xx").onmouseout=function(){AutoPlay_1xx()}
AutoPlay_1xx();
}
var Speed_1yy = 10; //速度(毫秒)
var Space_1yy = 20; //每次移动(px)
var PageWidth_1yy = 151 * 3; //翻页宽度
var interval_1yy = 7000; //翻页间隔
var fill_1yy = 0; //整体移位
var MoveLock_1yy = false;
var MoveTimeObj_1yy;
var MoveWay_1yy="right";
var Comp_1yy = 0;
var AutoPlayObj_1yy=null;
function GetObjyy(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay_1yy(){clearInterval(AutoPlayObj_1yy);AutoPlayObj_1yy=setInterval('ISL_GoDown_1yy();ISL_StopDown_1yy();',interval_1yy)}
function ISL_GoUp_1yy(){if(MoveLock_1yy)return;clearInterval(AutoPlayObj_1yy);MoveLock_1yy=true;MoveWay_1yy="left";MoveTimeObj_1yy=setInterval('ISL_ScrUp_1yy();',Speed_1yy);}
function ISL_StopUp_1yy(){if(MoveWay_1yy == "right"){return};clearInterval(MoveTimeObj_1yy);if((GetObjyy('ISL_Cont_1yy').scrollLeft-fill_1yy)%PageWidth_1yy!=0){Comp_1yy=fill_1yy-(GetObjyy('ISL_Cont_1yy').scrollLeft%PageWidth_1yy);CompScr_1yy()}else{MoveLock_1yy=false}
AutoPlay_1yy()}
function ISL_ScrUp_1yy(){if(GetObjyy('ISL_Cont_1yy').scrollLeft<=0){GetObjyy('ISL_Cont_1yy').scrollLeft=GetObjyy('ISL_Cont_1yy').scrollLeft+GetObjyy('List1_1yy').offsetWidth}
GetObjyy('ISL_Cont_1yy').scrollLeft-=Space_1yy}
function ISL_GoDown_1yy(){clearInterval(MoveTimeObj_1yy);if(MoveLock_1yy)return;clearInterval(AutoPlayObj_1yy);MoveLock_1yy=true;MoveWay_1yy="right";ISL_ScrDown_1yy();MoveTimeObj_1yy=setInterval('ISL_ScrDown_1yy()',Speed_1yy)}
function ISL_StopDown_1yy(){if(MoveWay_1yy == "left"){return};clearInterval(MoveTimeObj_1yy);if(GetObjyy('ISL_Cont_1yy').scrollLeft%PageWidth_1yy-(fill_1yy>=0?fill_1yy:fill_1yy+1)!=0){Comp_1yy=PageWidth_1yy-GetObjyy('ISL_Cont_1yy').scrollLeft%PageWidth_1yy+fill_1yy;CompScr_1yy()}else{MoveLock_1yy=false}
AutoPlay_1yy()}
function ISL_ScrDown_1yy(){if(GetObjyy('ISL_Cont_1yy').scrollLeft>=GetObjyy('List1_1yy').scrollWidth){GetObjyy('ISL_Cont_1yy').scrollLeft=GetObjyy('ISL_Cont_1yy').scrollLeft-GetObjyy('List1_1yy').scrollWidth}
GetObjyy('ISL_Cont_1yy').scrollLeft+=Space_1yy}
function CompScr_1yy(){if(Comp_1yy==0){MoveLock_1yy=false;return}
var numyy,numyy=Speed_1yy,TempSpace=Space_1yy;if(Math.abs(Comp_1yy)<PageWidth_1yy/2){TempSpace=Math.round(Math.abs(Comp_1yy/Space_1yy));if(TempSpace<1){TempSpace=1}}
if(Comp_1yy<0){if(Comp_1yy<-TempSpace){Comp_1yy+=TempSpace;numyy=TempSpace}else{numyy=-Comp_1yy;Comp_1yy=0}
GetObjyy('ISL_Cont_1yy').scrollLeft-=numyy;setTimeout('CompScr_1yy()',numyy)}else{if(Comp_1yy>TempSpace){Comp_1yy-=TempSpace;numyy=TempSpace}else{numyy=Comp_1yy;Comp_1yy=0}
GetObjyy('ISL_Cont_1yy').scrollLeft+=numyy;setTimeout('CompScr_1yy()',numyy)}}
function picrun_iniyy(){
GetObjyy("List2_1yy").innerHTML=GetObjyy("List1_1yy").innerHTML;
GetObjyy('ISL_Cont_1yy').scrollLeft=fill_1yy>=0?fill_1yy:GetObjyy('List1_1yy').scrollWidth-Math.abs(fill_1yy);
GetObjyy("ISL_Cont_1yy").onmouseover=function(){clearInterval(AutoPlayObj_1yy)}
GetObjyy("ISL_Cont_1yy").onmouseout=function(){AutoPlay_1yy()}
AutoPlay_1yy();
}
function showlok(whatobj){
whatstr=whatobj.replace("menu","menu1");
whatstr1=whatobj.replace("menu","menu2");
var obj = document.getElementById(whatobj)
str = document.getElementById(whatstr)
str1 = document.getElementById(whatstr1)
    if(obj.style.display == "block"){
		 obj.style.display="none";
		 str.style.display="none";
		 str1.style.display="block";
    }
	else{
	obj.style.display="block";
	str.style.display="block";
	str1.style.display="none";
    }
}

function CheckForm1()
{
if (document.FORM1.shouHuoRen.value.length==0)
{
alert("荷受人空になることはない!");
document.FORM1.shouHuoRen.focus();
return false;
}
if (document.FORM1.shouHuoRenT.value.length==0)
{
alert("振込み者氏名空になることはない!");
document.FORM1.shouHuoRenT.focus();
return false;
}
if (document.FORM1.tell.value.length==0)
{
alert("お届け先電話番号空になることはない!");
document.FORM1.tell.focus();
return false;
}
if (document.FORM1.address.value.length==0)
{
alert("お届け先ご住所空になることはない!");
document.FORM1.address.focus();
return false;
}
if (document.FORM1.youBian.value.length==0)
{
alert("お届け先郵便番号空になることはない!");
document.FORM1.youBian.focus();
return false;
}
if (document.FORM1.email.value =="")
{
alert("メールアドレス空になることはない!");
document.FORM1.email.focus();
document.FORM1.email.select();
return false;
}
var str1 = document.FORM1.email.value
if(str1.indexOf("@") == -1 || str1.indexOf(".") == -1){ 
alert("Eメール正しくない!"); 
document.FORM1.email.focus();
document.FORM1.email.select();
return false; 
} 
document.FORM1.submit() 
}

function CheckForm()
{
if (document.FORM1.tsName.value.length==0)
{
alert("欄すべてご記入下さい!");
document.FORM1.tsName.focus();
return false;
}
var str1 = document.FORM1.email.value
if(str1.indexOf("@") == -1 || str1.indexOf(".") == -1){ 
alert("メールアドレスを正しくご記入ください!"); 
document.FORM1.email.focus();
document.FORM1.email.select();
return false; 
}
if (document.FORM1.tsTitle.value.length==0)
{
alert("欄すべてご記入下さい!");
document.FORM1.tsTitle.focus();
return false;
}
if (document.FORM1.tsContent.value.length==0)
{
alert("欄すべてご記入下さい!");
document.FORM1.tsContent.focus();
return false;
}
document.FORM1.submit() 
}
