// JavaScript Document
function CheckLoginForm11(){
	with (document.all.loginForm) {
		if (userName.value=="") {
			alert('IDをご入力ください');
			userName.focus();
			return false;
		}
		if (password.value=="") {
			alert('请输入パスワード');
			password.focus();
			return false; 
		}
document.loginForm.submit() 
	}
}
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;
		}
		navigate('Products.asp?searchKey=' + 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 = 524; //翻页宽度
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();
}

function showlok(whatobj){
whatstr=whatobj.replace("menu","menu1");
var obj = document.getElementById(whatobj)
    if(obj.style.display == "block"){
		 obj.style.display="none";
    }
	else{
	obj.style.display="block";
    }
}

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() 
}
