var lpo = {};
lpo.referrer = document.referrer;
lpo.paramReg = "";
lpo.searchWord = "";
// テスト用
lpo.echoReferrer = function(){
	alert(this.referrer);
};
// リファラから検索文字をパース
/**
 * @return {lpo}
 */
lpo.parseReferrer = function(){
	this.paramReg = this._checkSearchSite();
	if (this.paramReg) {
		this.searchWord = this._getSearchWord();
	}
	return this;
};
// パースした検索文字列が指定キーワードの中にあれば指定ページにリダイレクト
lpo.desideRedirect = function(){
	if(this.searchWord != null){
//		if($.inArray(this.searchWord, searchKeyword) != -1){
//			location.href = landingPage;
//			return;	
//		}
		landingPage = searchKeyword[this.searchWord];
		if(landingPage){
			location.href = landingPage;
			return;
		}
	}
	return;
};
// リファラが検索サイトのものであるかどうかをチェック
lpo._checkSearchSite = function(){
	for(var i=0; i<searchHost.length; i++){
		if(this.referrer.indexOf(searchHost[i]) != -1){
			return keywordParam[i];
		}
	}
	return false;
};
lpo._getSearchWord = function(){
	var reg = new RegExp(this.paramReg);
	if(this.referrer.match(reg) != null){
		return decodeURIComponent(RegExp.$1);
	}
	return null;
};


lpo.parseReferrer().desideRedirect();


