//カレンダー表示用メソッド
function printDate() {  
	youbi		= new Array("日","月","火","水","木","金","土");  
	myDate		= new Date();  
	theDate		= myDate.getDate();  
	theDay		= youbi[myDate.getDay()];  
	theFyear	= myDate.getFullYear();  
	theMonth	= myDate.getMonth() + 1;  
	document.write(theFyear + "年" + theMonth + "月" + theDate + "日" + "(" + theDay + ")");  
}  

//カレンダー表示用メソッド
function printDate2() {  
	youbi		= new Array("日","月","火","水","木","金","土");  
	myDate		= new Date();  
	theDate		= myDate.getDate();  
	theDay		= youbi[myDate.getDay()];  
	theFyear	= myDate.getFullYear();  
	theMonth	= myDate.getMonth() + 1;  
	document.write(theMonth + "月" + theDate + "日");  
}  

//お気に入りボタン表示メソッド
function checkAndWriteBt(){
	var apl = navigator.appName;
	var ver = navigator.appVersion;
	var ie = false;

	if(apl.indexOf("Microsoft") >= 0){
		ie = true;
	
	}
	
	if(ie){
		//ユーザ毎にURLとタイトルの指定が必要
		document.write("<input type=\"button\" name=\"submit\" value=\"お気に入りに!!\" onClick=\"JavaScript:window.external.AddFavorite('http://www.e-ootani.jp', '不動産情報　不動産のオオタ二');\">");
	}
}




// Rollover

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == "imgover") {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;



<!--

function setLine(arrstation,arrcondition){

	var line1 = document.getElementById("station_p");
	var line2 = document.getElementById("station_s");
	for(i=0; i<arrstation.length; i++){
		line1.options[i] = new Option(arrstation[i]);
		line1.options[i].value = arrstation[i];
		line2.options[i] = new Option(arrstation[i]);
		line2.options[i].value = arrstation[i];
	}

	for(i=0; i<arrclass.length; i++){
		document.data.elements['class'].options[i] = new Option(arrclass[i]);
		document.data.elements['class'].value= arrclass[i];
	}
	document.data.elements['class'].selectedIndex = 0;

}


function setValue(idx){
	var item = document.getElementById("item");
	var type_f = document.getElementById("type_f");
	var type_t = document.getElementById("type_t");
	var land_f = document.getElementById("land_f");
	var land_t = document.getElementById("land_t");
	var building_f = document.getElementById("building_f");
	var building_t = document.getElementById("building_t");
	var condition1 = document.getElementById("condition1");
	var condition2 = document.getElementById("condition2");
	var condition3 = document.getElementById("condition3");

	i = idx;
	document.data.elements['class_j'].value= arrclass_j[i];

	// 配列選別
	arritem = eval('arritem'+idx);
	arrtype = eval('arrtype'+idx);
	arrland = eval('arrland'+idx);
	arrbuilding = eval('arrbuilding'+idx);
	arrcondition = eval('arrcondition'+idx);

	// 種目
	for(i=item.length; i>=0; i--){ item.options[i] = null; }
	for(i=0; i<arritem.length; i++){
		item.options[i] = new Option(arritem[i]);
		item.options[i].value = arritem[i];
	}

	// 間取り
	for(i=type_f.length; i>=0; i--){ type_f.options[i] = null; }
	for(i=type_t.length; i>=0; i--){ type_t.options[i] = null; }
	for(i=0; i<arrtype.length; i++){
		type_f.options[i] = new Option(arrtype[i]);
		type_t.options[i] = new Option(arrtype[i]);
		type_f.options[i].value = arrtype[i];
		type_t.options[i].value = arrtype[i];
	}

	// 土地
	for(i=land_f.length; i>=0; i--){ land_f.options[i] = null; }
	for(i=land_t.length; i>=0; i--){ land_t.options[i] = null; }
	for(i=0; i<arrland.length; i++){
		land_f.options[i] = new Option(arrland[i]);
		land_t.options[i] = new Option(arrland[i]);
		land_f.options[i].value = arrland[i];
		land_t.options[i].value = arrland[i];
	}

	// 建物
	for(i=building_f.length; i>=0; i--){ building_f.options[i] = null; }
	for(i=building_t.length; i>=0; i--){ building_t.options[i] = null; }
	for(i=0; i<arrbuilding.length; i++){
		building_f.options[i] = new Option(arrbuilding[i]);
		building_t.options[i] = new Option(arrbuilding[i]);
		building_f.options[i].value = arrbuilding[i];
		building_t.options[i].value = arrbuilding[i];
	}

	// 条件
	for(i=condition1.length; i>=0; i--){ condition1.options[i] = null; }
	for(i=condition2.length; i>=0; i--){ condition2.options[i] = null; }
	for(i=condition3.length; i>=0; i--){ condition3.options[i] = null; }
	for(i=0; i<arrcondition.length; i++){
		condition1.options[i] = new Option(arrcondition[i]);
		condition2.options[i] = new Option(arrcondition[i]);
		condition3.options[i] = new Option(arrcondition[i]);
		condition1.options[i].value = arrcondition[i];
		condition2.options[i].value = arrcondition[i];
		condition3.options[i].value = arrcondition[i];
	}


}



function InchgColor(tagName){
	tagName.style.backgroundColor ="#8EFFA8";
}

function OutchgColor(tagName,chk){
var theForm = document.data;

	tagName.style.backgroundColor ="#FFFFFF";

	switch(chk){
		case 1:
			if(theForm.elements['class'].selectedIndex == 0){
					theForm.elements['class'].style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;
		case 2:
			if(theForm.item.value == ""){
					theForm.item.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;
		case 3:
			if((theForm.station_p.value == "駅名を選択") || (theForm.station_p.value == "")){
					theForm.station_p.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;
		case 4:
			if((theForm.price_from.value == "") || (theForm.price_to.value == "")){
					theForm.price_from.style.backgroundColor ="#FFA4A4";
					theForm.price_to.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
				if(CheckLength(theForm.price_from.value,0) == false){
					theForm.price_from.style.backgroundColor ="#FFA4A4";
					theForm.price_to.style.backgroundColor ="#FFA4A4";
					return false;
				}else{
					if(CheckLength(theForm.price_to.value,0) == false){
					theForm.price_from.style.backgroundColor ="#FFA4A4";
					theForm.price_to.style.backgroundColor ="#FFA4A4";
					return false;
					}else{
					theForm.price_from.style.backgroundColor ="#FFFFFF";
					theForm.price_to.style.backgroundColor ="#FFFFFF";
					}
				}
			}
			break;
		case 5:
			if((theForm.move_year.value == "") || (theForm.move_month.value == "")){
					theForm.move_year.style.backgroundColor ="#FFA4A4";
					theForm.move_month.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
					theForm.move_year.style.backgroundColor ="#FFFFFF";
					theForm.move_month.style.backgroundColor ="#FFFFFF";
					return false;
			}
			break;
		case 6:
			if(theForm.reason.value == ""){
					theForm.reason.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;
		case 7:
			if(theForm.name.value == ""){
					theForm.name.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
				if(CheckLength(theForm.name.value,1) == false){
					theForm.name.style.backgroundColor ="#FFA4A4";
					return false;
				}
			}
			break;
		case 8:
			if(theForm.sex.value == "**"){
					theForm.sex.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;
		case 9:
			if(theForm.age.value == ""){
					theForm.age.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
			if(CheckLength(theForm.age.value,0) == false){
					theForm.age.style.backgroundColor ="#FFA4A4";
					return false;
				}
			}
			break;
		case 10:
			if(theForm.job.value == "**"){
					theForm.job.style.backgroundColor ="#FFA4A4";
					return false;
			}			
			break;
			
			
		case 11:
			if(theForm.persons.value == ""){
					theForm.persons.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
			if(CheckLength(theForm.persons.value,0) == false){
					theForm.persons.style.backgroundColor ="#FFA4A4";
					return false;
				}
			}
			break;
			
		case 12:
			if(theForm.replyto.value == theForm.replyto_con.value){
				if(theForm.replyto.value == ""){
					theForm.replyto.style.backgroundColor ="#FFA4A4";
					return false;
				}else{
					if(isEmail(theForm.replyto.value) == false){
						theForm.replyto.style.backgroundColor ="#FFA4A4";
						return false;
					}
				}
			}else{
					theForm.replyto.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;			
			
		case 13:
			if(theForm.tel.value == ""){
					theForm.tel.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
			if(CheckLength(theForm.tel.value,0) == false){
					theForm.tel.style.backgroundColor ="#FFA4A4";
					return false;
				}
			}
			break;
		case 14:
			if(theForm.postal_code.value == ""){
					theForm.postal_code.style.backgroundColor ="#FFA4A4";
					return false;
			}else{
			if(CheckLength(theForm.postal_code.value,0) == false){
					theForm.postal_code.style.backgroundColor ="#FFA4A4";
					return false;
				}
			}
			break;
		case 15:
			if(theForm.address.value == ""){
					theForm.address.style.backgroundColor ="#FFA4A4";
					return false;
			}
			break;

	}


}



function isEmail(checkString){
	var newstr = "";
	var at = false;
	var dot = false;

	if (checkString.indexOf("@") != -1) {
		at = true;
	} else if (checkString.indexOf(".") != -1) {
		dot = true;
	}
	for (var i = 0; i < checkString.length; i++) {
		ch = checkString.substring(i, i + 1)
		if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
			|| (ch == "@") || (ch == ".") || (ch == "_")
			|| (ch == "-") || (ch >= "0" && ch <= "9")) {
			newstr += ch;
			if (ch == "@") {
				at=true;
			}
			if (ch == ".") {
				dot=true;
			}
		}
	}
	if ((at == true) && (dot == true)) {
		return true;
	} else {
		return false;
	}
}

function CheckLength(str,flg) { 
    for (var i = 0; i < str.length; i++) { 
        var c = str.charCodeAt(i); 
        // Shift_JIS: 0x0 〜 0x80, 0xa0 , 0xa1 〜 0xdf , 0xfd 〜 0xff 
        // Unicode : 0x0 〜 0x80, 0xf8f0, 0xff61 〜 0xff9f, 0xf8f1 〜 0xf8f3 
        if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) { 
            if(!flg) return true; 
        } else { 
            if(flg) return true; 
        } 
    } 
    return false; 
} 


function checkItem(theForm)
{
var error = "";
var res = true;
	
	if(theForm.elements['class'].selectedIndex == 0){
			theForm.elements['class'].style.backgroundColor ="#FFA4A4";
			error = error + " 種別を選択してください。\n";
			res = false;
	}

	if(theForm.item.value == ""){
			theForm.item.style.backgroundColor ="#FFA4A4";
			error = error + " 種目を選択してください。\n";
			res = false;
	}

	if((theForm.station_p.value == "駅名を選択") || (theForm.station_p.value == "")){
			theForm.station_p.style.backgroundColor ="#FFA4A4";
			error = error + " 希望駅を１つ以上選択してください。\n";
			res = false;
	}
	

	if((theForm.price_from.value == "") || (theForm.price_to.value == "")){
			theForm.price_from.style.backgroundColor ="#FFA4A4";
			theForm.price_to.style.backgroundColor ="#FFA4A4";
			error = error + " 購入価格を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.price_from.value,0) == false){
			theForm.price_from.style.backgroundColor ="#FFA4A4";
			theForm.price_to.style.backgroundColor ="#FFA4A4";
			error = error + " 購入価格は半角で入力してください。\n";
			res = false;
		}else{
			if(CheckLength(theForm.price_to.value,0) == false){
				theForm.price_from.style.backgroundColor ="#FFA4A4";
				theForm.price_to.style.backgroundColor ="#FFA4A4";
				error = error + " 購入価格は半角で入力してください。\n";
				res = false;
			}
		}
	}

	if((theForm.move_year.value == "") || (theForm.move_month.value == "")){
			theForm.move_year.style.backgroundColor ="#FFA4A4";
			theForm.move_month.style.backgroundColor ="#FFA4A4";
			error = error + " 引越し希望時期を選択してください。\n";
			res = false;
	}

	if(theForm.reason.value == ""){
			theForm.reason.style.backgroundColor ="#FFA4A4";
			error = error + " 引越し理由を選択してください。\n";
			res = false;
	}

	if(theForm.name.value == ""){
			theForm.name.style.backgroundColor ="#FFA4A4";
			error = error + " 氏名を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.name.value,1) == false){
			theForm.name.style.backgroundColor ="#FFA4A4";
			error = error + " 氏名は全角で入力してください。\n";
			res = false;
		}
	}

	if(theForm.sex.value == "**"){
			theForm.sex.style.backgroundColor ="#FFA4A4";
			error = error + " 性別を選択してください。\n";
			res = false;
	}

	if(theForm.age.value == ""){
			theForm.age.style.backgroundColor ="#FFA4A4";
			error = error + " 年齢を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.age.value,0) == false){
			theForm.age.style.backgroundColor ="#FFA4A4";
			error = error + " 年齢は半角で入力してください。\n";
			res = false;
		}
	}

	if(theForm.job.value == "**"){
			theForm.job.style.backgroundColor ="#FFA4A4";
			error = error + " 職業を選択してください。\n";
			res = false;
	}


	if(theForm.persons.value == ""){
			theForm.persons.style.backgroundColor ="#FFA4A4";
			error = error + " 入居人数を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.persons.value,0) == false){
			theForm.persons.style.backgroundColor ="#FFA4A4";
			error = error + " 入居人数は半角で入力してください。\n";
			res = false;
		}
	}


	if(theForm.replyto.value == theForm.replyto_con.value){
		if(theForm.replyto.value == ""){
			theForm.replyto.style.backgroundColor ="#FFA4A4";
			error = error + " メールアドレスを入力してください。\n";
			res = false;
		}else{
			if(isEmail(theForm.replyto.value) == false){
				theForm.replyto.style.backgroundColor ="#FFA4A4";
				error = error + " メールアドレスが不正です。\n";
			res = false;
			}
		}
	}else{
			theForm.replyto.style.backgroundColor ="#FFA4A4";
			theForm.replyto_con.style.backgroundColor ="#FFA4A4";
			theForm.move_year.style.backgroundColor ="#FFA4A4";
			error = error + " メールアドレスが一致しません。\n";
			res = false;
	}


	if(theForm.mail_ph.value == theForm.mail_ph_con.value){
		if(theForm.mail_ph.value != ""){
			if(isEmail(theForm.mail_ph.value) == false){
				theForm.mail_ph.style.backgroundColor ="#FFA4A4";
				error = error + " メールアドレス(携帯等)が不正です。\n";
			res = false;
			}
		}
	}else{
			theForm.mail_ph.style.backgroundColor ="#FFA4A4";
			theForm.mail_ph_con.style.backgroundColor ="#FFA4A4";
			error = error + " メールアドレス(携帯等)が一致しません。\n";
			res = false;
	}


	if(theForm.tel.value == ""){
			theForm.tel.style.backgroundColor ="#FFA4A4";
			error = error + " 電話番号を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.tel.value,0) == false){
			theForm.tel.style.backgroundColor ="#FFA4A4";
			error = error + " 電話番号は半角で入力してください。\n";
			res = false;
		}
	}

	if(theForm.postal_code.value == ""){
			theForm.postal_code.style.backgroundColor ="#FFA4A4";
			error = error + " 郵便番号を入力してください。\n";
			res = false;
	}else{
		if(CheckLength(theForm.postal_code.value,0) == false){
			theForm.postal_code.style.backgroundColor ="#FFA4A4";
			error = error + " 郵便番号は半角で入力してください。\n";
			res = false;
		}
	}


	if(theForm.address.value == ""){
			theForm.address.style.backgroundColor ="#FFA4A4";
			error = error + " 住所を入力してください。\n";
			res = false;
	}


	if(theForm.privacy.checked == false){
			error = error + " 個人情報提供に同意してください。\n";
			res = false;
	}



	if(res == false){
		alert(error);
		return false;
	}else{
		return true;
	}

}

// -->