function showPopup(url, width, height) {
	if (width == undefined) {
		width = 650;
	}
	if (height == undefined) {
		height = 600;
	}
	var mywindow = window.open(url,'_blank','scrollbars=yes,resizable=yes,width='+width+',height='+height);
	mywindow.focus();
}

function changeImg(target, img_src) {
	if (typeof(target) == 'object') {
		var obj = target;
	} else {
		var obj = document.getElementById(target);
	}
	obj.src = img_src;
}

function transit(end_station) {
	var start_station = "";
	var url = "";
	start_station = document.getElementById('start_station').value;
	if (start_station != '') {
		url = 'http://transit.map.yahoo.co.jp/search/result?to=' + encodeURI(end_station) + '&via=&shin=1&ex=1&al=1&hb=1&lb=1&sr=1&ym=200912&d=04&hh=12&m1=0&m2=8&type=1&ws=2&s=0&ost=0&ei=utf-8&x=0&y=0&from=' + encodeURI(start_station);
		window.open(url, "");
	}
	else {
		alert('駅名を入力してください');
	}
	CookieWrite('start_station', start_station, 30);
}

function CookieWrite(kword, kdata, kday)
{
  if(!navigator.cookieEnabled){    // クッキーが利用可能かどうか
    alert("クッキーへの書き込みができません");
    return;
  }
  sday = new Date();
  sday.setTime(sday.getTime() + (kday * 1000 * 60 * 60 * 24));
  s2day = sday.toGMTString();
  document.cookie = kword + "=" + escape(kdata) + ";expires=" + s2day;
}

function CookieRead(kword)
{
	var kdata = "";
  if(typeof(kword) == "undefined")　　// キーワードなし
    return "";        // 何もしないで戻る
  kword = kword + "=";
  kdata = "";
  scookie = document.cookie + ";";　　　　// クッキー情報を読み込む
  start = scookie.indexOf(kword);   　// キーワードを検索
  if (start != -1){    // キーワードと一致するものあり
    end = scookie.indexOf(";", start);    // 情報の末尾位置を検索
    kdata = unescape(scookie.substring(start + kword.length, end));  // データ取り出し
  }
  return kdata;
}
