var imgs = new Array();
if(document.images) {
	imgs[0] = new Image();  imgs[0].src = "http://pmj.co.jp/images/btn_s.gif";
	imgs[1] = new Image();  imgs[1].src = "http://pmj.co.jp/images/btn_s_o.gif";
	imgs[2] = new Image();  imgs[2].src = "http://pmj.co.jp/images/btn_m.gif";
	imgs[3] = new Image();  imgs[3].src = "http://pmj.co.jp/images/btn_m_o.gif";
	imgs[4] = new Image();  imgs[4].src = "http://pmj.co.jp/images/btn_l.gif";
	imgs[5] = new Image();  imgs[5].src = "http://pmj.co.jp/images/btn_l_o.gif";
}


function chgimg(id, imgname) {
	if(document.images) {
		if(imgs[imgname]) {
			document.images[id].src = imgs[imgname].src;
		}
		else {
			document.images[id].src = imgname;
		}
	}
}



function chg_location(id, imgname, path) {
	if(document.images) {
			document.images[id].src = path;
	}
	imgs[imgname].src = path;
}

function style_switch(value){
  writeCookie('fontSize', value, 8760);
	
	if(value == 'small'){	
		chg_location('letter_s', 0, 'http://pmj.co.jp/images/btn_s_o.gif');
		chg_location('letter_m', 2, 'http://pmj.co.jp/images/btn_m.gif');
		chg_location('letter_l', 4, 'http://pmj.co.jp/images/btn_l.gif');
		document.getElementById("small").disabled  = false;
		document.getElementById("medium").disabled = true;
		document.getElementById("large").disabled  = true;
	}
	
	if(value == 'medium'){	
		chg_location('letter_s', 0, 'http://pmj.co.jp/images/btn_s.gif');
		chg_location('letter_m', 2, 'http://pmj.co.jp/images/btn_m_o.gif');
		chg_location('letter_l', 4, 'http://pmj.co.jp/images/btn_l.gif');
		document.getElementById("small").disabled  = true;
		document.getElementById("medium").disabled = false;
		document.getElementById("large").disabled  = true;
	}
	
	if(value == 'large'){
		chg_location('letter_s', 0, 'http://pmj.co.jp/images/btn_s.gif');
		chg_location('letter_m', 2, 'http://pmj.co.jp/images/btn_m.gif');
		chg_location('letter_l', 4, 'http://pmj.co.jp/images/btn_l_o.gif');
		document.getElementById("small").disabled  = true;
		document.getElementById("medium").disabled = true;
		document.getElementById("large").disabled  = false;
	}
	
}


function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; path=/; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}



function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
//	cookieValue2 = document.cookie;
//	alert(cookieValue2);
  return cookieValue;
}
