// JavaScript Document


//*************************************
//オンマウス時のメニュー画像の切り替え
//*************************************
function swapImage(btnObj,sURL)
{
	btnObj.src = sURL;
}

//*************************************
//オンマウス時のメニュー画像の切り替え
//*************************************
function swapImagePNG(btnObj,sURL)
{
	btnObj.src = sURL;
	IEPNGFIX.fix(btnObj, sURL);
}

//*************************************
//FLASH再生
//*************************************
function CreateControl(DivID, CLSID, ObjectID,WIDTH, HEIGHT, URL, AUTOSTART)
{
document.write('<object classid="' + CLSID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="' + ObjectID + '" width="' + WIDTH + '" height="' + HEIGHT +'"  align="">');
document.write('<param name=movie value="' + URL + '">');
document.write('<param name=autoStart value=' + AUTOSTART + '/>');
document.write('<param name=quality value=height />');
document.write('<embed src="' + URL + '" quality="height" width="' + WIDTH + ' px" height="' + HEIGHT +' px" name=' + ObjectID + ' vspace="0" hspace="0" align="middle" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
document.write('</object>');
}


//*************************************
//商品数　disabled
//*************************************
function count_disabled(pForm)
{
	address = "a" + pForm.address.value;
	if( address.indexOf('横浜') > 0 || address.indexOf('よこはま') > 0 || address.indexOf('ヨコハマ') > 0 ){
		pForm.count[0].disabled = false;
		
		document.getElementById("count10").style.color = "#404040";
		
	} else {
		
		if (pForm.count[0].checked == true)
			pForm.count[0].checked = false;
		
		pForm.count[0].disabled = true;
		
		document.getElementById("count10").style.color = "#999999";
	}
}

function test()
{
	alert("OK");
}

//*************************************
//商品数　disabled
//*************************************
function count_disabledB(pForm)
{
	alert("エラー0");
	form	= document.form;
	address = "a" + form.address.value;
	
	alert("エラー1");
	regobj1	= new RegExp(("横浜"),"g");
	regobj2	= new RegExp(("よこはま"),"g");
	regobj3	= new RegExp(("ヨコハマ"),"g");
	
	if ( address.match(regobj1) != null ) {
		len1	= address.match(regobj1).length;
	} else {
		len1	= 0;
	}
	
	if ( address.match(regobj2) != null ) {
		len2	= address.match(regobj2).length;
	} else {
		len2	= 0;
	}
	
	if ( address.match(regobj3) != null ) {
		len3	= address.match(regobj3).length;
	} else {
		len3	= 0;
	}
	alert("エラー2");
	if( len1 > 0 || len2 > 0 || len3 > 0 ){
		
		form.count[0].disabled = false;
		alert("エラー3");
		document.getElementById("count10").style.color = "#404040";
		alert("エラー4");
		
	} else {
		
		if (form.count[0].checked == true)
			form.count[0].checked = false;
		
		form.count[0].disabled = true;
		
		document.getElementById("count10").style.color = "#999999";
	}
}

//*************************************
//簡単買取フォームチェック
//*************************************
function order_form_check(pForm)
{

	if (pForm.name.value == '') {
		alert('お名前を入力してください');
		return;
	} else if (pForm.address.value == '') {
		alert('ご住所を入力してください');
		return;
	} else if (pForm.tel.value == '') {
		alert('電話番号を入力してください');
		return;
	} else if (pForm.mail.value == '') {
		alert('メールアドレスを入力してください');
		return;
	} else if (pForm.mail2.value == '') {
		alert('メールアドレス(確認)を入力してください');
		return;
	} else if (pForm.mail.value != pForm.mail2.value) {
		alert('メールアドレスとメールアドレス(確認)が不一致です');
		return;
	//} else if (pForm.comment.value == '') {
	//	alert('お問合せ内容を入力してください');
	//	return;
	}

	//お売り頂ける商品の選択チェック(ラジオボタン)
	goods1 = document.getElementById("goods1").checked;
	goods2 = document.getElementById("goods2").checked;
	goods3 = document.getElementById("goods3").checked;
	goods4 = document.getElementById("goods4").checked;
	goods5 = document.getElementById("goods5").checked;
	goods6 = document.getElementById("goods6").checked;
	
	if (goods1 == false && goods2 == false && goods3 == false && goods4 == false && goods5 == false && goods6 == false){
		alert('お売り頂ける商品を選択してください');
		return;
	}
	
	//お売り頂ける商品数の選択チェック(ラジオボタン)
	rLen = pForm.count.length;
	count_checked = false;
	for (i=0; i<rLen; i++){

		if (pForm.count[i].checked == true){
			count_checked = true;
			break;
		}
	}
	
	if (count_checked == false){
		alert('お売り頂ける商品数を選択してください');
		return;
	}
	//商品数がそれ以上の場合は商品数入力をチェック
	if (i==4 && pForm.count_self.value == ''){
		alert('おおよその商品数を入力してください');
		return;		
	}
	
	//希望の日時
	if (pForm.month.value == '' || pForm.day.value == '' || pForm.hour.value == '' ) {
		alert('ご希望の日時(第一希望)を入力してください');
		return;
	}
		
	
	if (confirm('この内容で送信します') == true) {
		pForm.mode.value = '送信';
		pForm.submit();
		return;
	}

}


//*************************************
//お問合せフォームチェック
//*************************************
function contact_form_check(pForm)
{

	if (pForm.name.value == '') {
		alert('お名前を入力してください');
		return;
	} else if (pForm.mail.value == '') {
		alert('メールアドレスを入力してください');
		return;
	} else if (pForm.mail2.value == '') {
		alert('メールアドレス(確認)を入力してください');
		return;
	} else if (pForm.mail.value != pForm.mail2.value) {
		alert('メールアドレスとメールアドレス(確認)が不一致です');
		return;
	} else if (pForm.comment.value == '') {
		alert('お問合せ内容を入力してください');
		return;
	}
		
	
	if (confirm('この内容で送信します') == true) {
		pForm.mode.value = '送信';
		pForm.submit();
		return;
	}

}


//*************************************
//オープンウィンドウ
//*************************************
function openWindow(url,pWidth,pHeight){
	option = 'width=' + pWidth + ',height=' + pHeight;
	option = option + ',scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=no'
	window.open(url,"_blank",option);
}

//*************************************
//オープンウィンドウ2
//*************************************
function openWindow2(url,pWidth){
	
	url		= url;
	move 	= 'top=' + 0 + ',left=' + screen.width;
	option 	= 'width=' + pWidth + ',height=' + screen.height;
	
	option = option + move + ',scrollbars=yes,resizable=0,menubar=0,toolbar=0,location=0,directories=0,status=0,titlebar=0'
	o_colWindow = window.open(url,null,option,"dependent=yes", true);
	
	return;
}

//*************************************
//簡単買取フォームチェック
//*************************************
function order_print(pForm)
{

	if (pForm.kana.value == '') {
		alert('フリガナを入力してください');
		return;
	} else if (pForm.name.value == '') {
		alert('お名前を入力してください');
		return;
	} else if (pForm.address.value == '') {
		alert('ご住所を入力してください');
		return;
	} else if (pForm.tel.value == '') {
		alert('電話番号を入力してください');
		return;
	} else if (pForm.mail.value == '') {
		alert('メールアドレスを入力してください');
		return;
	} else if (pForm.bank.value == '') {
		alert('銀行名を入力してください');
		return;
	} else if (pForm.shiten.value == '') {
		alert('支店名を入力してください');
		return;
	} else if (pForm.koza_no.value == '') {
		alert('口座番号を入力してください');
		return;
	} else if (isNaN(pForm.koza_no.value)) {
		alert('口座番号は数値を入力してください');
		return;
	} else if (pForm.koza_name.value == '') {
		alert('口座名義を入力してください');
		return;
	}
		
	
	if (confirm('この内容でよろしいですか。よろしければ印刷画面へ進みます。') == true) {
		pForm.mode.value = '送信';
		pForm.submit();
		return;
	}

}
