// 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() {
alert(document.getElementById('searchKey_zlh').value);
	alert(document.getElementById('searchType1').value);
	if (document.getElementById('searchKey_zlh').value=="") {
			alert('商品名また商品品番入力下');
			return false;
		}
		navigate('newProducts.asp?searchKey_zlh=' + document.getElementById('searchKey_zlh').value + '&searchType1=' + document.getElementById('searchType1').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"
	}
}
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("メールアドレスを正しくご記入ください!"); 
document.FORM1.email.focus();
document.FORM1.email.select();
return false; 
} 
document.FORM1.submit() 
}