function red(){

var idDid = window.location.search.indexOf("dealerid") !=-1;
var idDid0 = window.location.search.indexOf("dealerid=0") !=-1;
var idn102 = window.location.search.indexOf("dealerid=102") != -1;
var idn103 = window.location.search.indexOf("dealerid=103") != -1;
var idn30051 = window.location.search.indexOf("dealerid=30051") != -1;


var se =  new Array("google" , "search.yahoo");

var ref = document.referrer;
var loc = window.location.pathname;


//alert(loc);

//検索エンジンからのアクセスで、dealeridが0,102,103,30051以外だったっら、dealerid=0でreplace();

if (idn102 || idn103 || idn30051) {

} else {

	for (var i = 0; i < se.length; i++){
		if (ref.indexOf(se[i]) != -1){
		//alert("検索エンジンからきている");

			if (idDid){
			//alert("dealeridが含まれている");


				if (idDid0){
				//alert("dealeridはゼロなので、なにもしない");


				} else {
				//alert("dealeridはゼロ以外なので、dealerid=0をつけてreplace");

						var nloc = loc + "?dealerid=0";
						//alert("dealerid=0に移動します。");
						window.location.href=nloc;
						return;
				}
			}
		}
	}
}

}

red();


/*******************************************************/
/*  2009/05/28 resize時にはchangeBoxSizeを呼ばないように修正
/*
/*******************************************************/


<!-- min-max width for ie6 -->
function ieXLiquidWidth() {
   var doc = document;
   if(doc.body.clientWidth < 982){
      return "1050px";
   }else if(doc.body.clientWidth > 2000){
      return "1500px";
   }else{
      return "auto";
   }
}


/*******************************************************/
/*  2009/05/30 window open
/*
/*******************************************************/

var NewSubWin = window;

function openNewWin(winUrl,winName,winOption) {
   if ((NewSubWin == window) || NewSubWin.closed) {
      NewSubWin = open(winUrl,winName,winOption);
   } else {
      NewSubWin.focus();
      NewSubWin = open(winUrl,winName,winOption);
   }
   return(false);
}


/*******************************************************/
/*  select CSS
/*
/*******************************************************/
var ua = navigator.userAgent;
var SF = ua.indexOf('Safari')>=0;
if(SF){
	document.write('<link rel="stylesheet" href="/commonnew/css/safari.css" type="text/css" />');
}

/*******************************************************/
/*  未入力チェック
/*
/*******************************************************/
function KeywordInputChk(){
	var txt = document.form_left_search.q;
	if (txt.value == "" || txt.value == "キーワードを入力"){
		window.alert("キーワードを入力してください");
		txt.focus();
		return false;
	}
	else{
		return true;
	}
}


/*******************************************************/
/*  レイヤー制御
/*
/*******************************************************/
//レイヤーの表示
//入力：obj（レイヤーのID）
function showLayer(obj){

	var e = document.getElementById(obj); if(!e) return 0;

	if(e.style){
		e.style.display='block';
	} 
	else {
		return 0;
	}
	return 1;
}

//レイヤーの非表示
//入力：obj（レイヤーのID）
function hideLayer(obj){
	var e = document.getElementById(obj); if(!e) return 0;

	if(e.style){
		e.style.display='none';
	} 
	else {
		return 0;
	}
	return 1;
}



function showpr(pr){
	var id;
	if (pr == "show"){
		showLayer("pr");
		id = setTimeout("hideLayer('pr')",10000);
	}
	else if(pr == "hide"){
		hideLayer("pr");
	}
}


function menujump(linkLoc){
	if(linkLoc !="") {
		window.location.href=linkLoc;
	}
}

/*******************************************************/
/*  Cookie処理
/*
/*******************************************************/

//Cookie取得
/* Cookie の読み込み
     引数 key : 求める値のキー
     戻り値　 : 値（ない時は空文字""）*/
function ReadCookie(key) {
     var sCookie = document.cookie;    // Cookie文字列
     var aData = sCookie.split(";");       // ";"で区切って"キー=値"の配列にする
     var oExp = new RegExp(" ", "g");   // すべての半角スペースを表す正規表現
     key = key.replace(oExp, "");          // 引数keyから半角スペースを除去

     var i = 0;
     while (aData[i]) {                           /* 語句ごとの処理 : マッチする要素を探す */
          var aWord = aData[i].split("=");                         // さらに"="で区切る
          aWord[0] = aWord[0].replace(oExp, "");              // 半角スペース除去
          if (key == aWord[0]) return unescape(aWord[1]); // マッチしたら値を返す
          if (++i >= aData.length) break;                          // 要素数を超えたら抜ける
     }
     return "";                                   // 見つからない時は空文字を返す
}


/* Cookie への書き出し
     引数 key　 : データキー （半角英数 _ のみ）
     引数 value : データの値（日本語可）
     引数 days  : データを保持する日数（ 0 の時は有効期限は省略）*/
function WriteCookie(key, value, days) {
     var str = key + "=" + escape(value) + ";";         // 書き出す値１ : key=value
     if (days != 0) {                                                 /* 日数 0 の時は省略 */
          var dt = new Date();                                   // 現在の日時
          dt.setDate(dt.getDate() + days);                   // days日後の日時
          str += "expires=" + dt.toGMTString() + ";"; // 書き出す値２ : 有効期限
     }
     document.cookie = str;                                   // Cookie に書き出し
}


var win;

function MemberUpdateInfo(){
//Cookie参照
var USERUPDATE = ReadCookie('userupdate');
var MemberUpdateInfo = ReadCookie('MemberUpdateInfo');
var NA = ReadCookie('NA');


	if (NA !=""){
	//ログインしていること

		if(USERUPDATE == 0){


			if (MemberUpdateInfo) {
			//
				//alert("MemberUpdateInfoあり");
			

			} else {
			//MemberUpdateInfoがないこと

				//alert("MemberUpdateInfoなし");

				win = window.open("/ebj/user/update_info.asp" , "MemberUpdateInfoWindow");



			}


		} else {

		}

	} else {

	}

return true;
}



  //--ウインドウ有無確認関数
    function win_closed(winVar) {
 
      var ua = navigator.userAgent
      if( !!winVar )
          if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 )
               && ua.indexOf('Win')!=-1 ) 
               return winVar.closed
          else return typeof winVar.document  != 'object'
      else return true
    }




window.onload = function(){

	if (win_closed(win)){
	MemberUpdateInfo();
	}
}

