/**
 * freewordのURL
 * @param action
 * @return
 */
function findNames(action) {
	//ユーザが検索したい文言。
    //var name =  document.getElementById("s.q").value;
    //現在のURLを取得
    var url = document.location.href;
    //[http:]/[]/[mansion.home-plaza.jp]/[shutoken]/で割る
    var url_splt = url.split("/");
    //[mansion.home-plaza.jp]を[mansion][home-plaza][jp]で割る
    var url_splt2 = url_splt[2].split(".");
    //種別を取得
    var type_chk = url_splt2[0];
    var param ="";
   
    //パラメータに種別を設定
    if ("mansion" == type_chk){
    	param = "navi1ǁ^新築マンション$ǁ新築マンション";
    }
    else if ("house" == type_chk){
    	param = "navi1ǁ^新築一戸建て$ǁ新築一戸建て";
    }
    else if ("land" == type_chk){
    	param = "navi1ǁ^土地$ǁ土地";
    }
   
    document.getElementById("s.b").value = param;
    //種別の後ろにフリーワードを設定
   // document.getElementById("s.q").value = name;
    
    //新たな画面を開く
    document.free.method = "get";
	document.free.action = "http://www.home-plaza.jp/homeplaza/search/";
	document.free.target="_blank";
	document.free.submit();
}

function findNames_M(action) {

    var name =  document.getElementById("names,searchBoxText");

       document.free.method ="post";
       document.free.action = action;
       document.free.target="_blank";
       document.free.submit();
}


/*
 * ご質問・ご意見ポップアップ入力画面
 * */

function openPop(thisUrl) {
	
	
	// 現在のURLを獲得する
	var url = window.location.href;
	  document.getElementById('url').value = url;
 	// post　方式でパラメータを渡す
	  myWin = window.open("","quesPop",'width=475, height=600, menubar=no, toolbar=no, scrollbars=no');
	  document.question.method = "post";
	  document.question.target = "quesPop";
	  document.question.action = thisUrl;
	  document.question.submit();
	  
}

/*
 * ご質問・ご意見ポップアップ完了画面
 * ：post 方式でデータを送信する
 * */
function openPop2(thisUrl) {
	
	//ご質問・ご意見のところにデフォルトで入っていいる値を削除。
	if(document.getElementById('textarea_box').value == "例）○○ってどういう意味ですか？○○な物件を探しているのですが○○の情報はないですか？など、ご自由にお書きください。")
	{
		document.getElementById('textarea_box').value = "";
	}
	
	//　ご意見・ご質問内容の必須チェック
	if(document.getElementById('textarea_box').value == "")
	{
		alert("内容を入力してください。");
		return;
	}
	// メールアドレスの必須チェック
	if(document.getElementById('addres_text').value == "")
	{
		alert("メールアドレスを入力してください。");
		return;
	}
	
	//　メールアドレス形式の有効性をチェック
	var mail;
	mail = document.getElementById('addres_text').value;	//変数に設定する
	var e_mail = mail.split("@");
	if(!mail.match(/.*@.*\..*/i)){  	//メールアドレスが不正である場合
		alert("メールアドレスが不正です。もう一度確認して下さい。");
		return;
	} else if(!(/^[_0-9a-zA-Z-.#$%&!?''~^]+$/.test(e_mail[0]))){
		alert("メールアドレスが不正です。もう一度確認して下さい。");
		return;
	}
	//空白チェックうを入れる
	//空白を除去する
	var domein = trim(e_mail[1]);
	//「@」以後に最初にくる文字を取得する
	var domein_chk = domein.substr(0,1);
	//最初の文字が「.」もしくは空白の場合エラーメッセージを表示する
	if(domein_chk == '.' || domein_chk == ''){
		alert("メールアドレスが不正です。もう一度確認して下さい。");
		return;
	}
	
	document.question.method = "post";
	document.question.target = "_self";
	document.question.action = thisUrl;
	document.question.submit();
	//var url = window.location.href;
	//window.open(thisUrl,'ngoe_form','width=475, height=565, menubar=no, toolbar=no, scrollbars=no');
}

/**  
 *　空白を無くす処理
 *  ^ : 文字列スタート  
    \s* : 任意の空白文字数, \s：空白, *：任意の数  
    | : OR
    $ : 文字列のエンド  
    g : 全ての文字列を検査し変換する  
    '' :　変換する文字列 
 */  
function trim(domein) {  
    return domein.replace(/(^\s*)|(\s*$)/g, "");  
} 


$(document).ready(function() {
	$('form input.help, form textarea.help').formtips({
       tippedClass: 'tipped'
    });
});
//鬮倥＆謠・∴
$(function() {
    $('.rankingBox').flatHeights();
    $('#attention,#pickup').flatHeights();
    $('#attention,#pickup2').flatHeights();
    $('#articleMoney,#articleOtoku').flatHeights();
});










