/*__________________________________________________________

   Define common variables and methods (rev007_JAL_BRANCH_6)

_____________________________________________________________*/


if (!document.getElementById) {
  document.getElementById = function(strID) {
    if (document.layers) return document[strID];
    if (document.all) return document.all[strID];
    return null;    // expect the unexpected
  }
}

// used in display_image.php
function changeText(spanId, value) {
  spanObj=document.getElementById(spanId);
  var hasInnerText =(document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
  if (hasInnerText) { // IE, Safari and Konqueror.;
    spanObj.innerText=value;
  } else if (spanObj.textContent) { // firefox
    spanObj.childNodes[0].nodeValue = value;
  }
}

// used in buy02.php
var detailid=0;
function resetThumbsBorders() {
  var i=0;
  while (thumbObj=document.getElementById("thumb"+i)) {
	// for (i=0; i <= <? echo $details_num ?>; i++) {
	  // thumbObj=document.getElementById("thumb"+i);
		thumbObj.style.borderColor="#999999";
		i++;
	}
}

// called by selectThumb()
function highlightThumb(thumbId) {
	resetThumbsBorders();
	thumbObj=document.getElementById(thumbId);
	thumbObj.style.borderColor="#ff0000";
}  

// used in buy02.php and display_image.php
function selectThumb(thumbId, imageName, imageFile) {
	MM_swapImage(imageName,'',imageFile);
	highlightThumb(thumbId);
}

function openWin(winUrl, winWidth, winHeight) {
  window.open(winUrl,"_blank","resizable=yes,menubar=no,directories=no,status=no,location=no,scrollbars=yes,width="+winWidth+",height="+winHeight);
}
/****************************************START--FOR LEFT NEVEGATION MENU********************************************/
function do_nothing(){
   
}
function show(id) {
  document.getElementById(id).style.display = '';//block
}
function hide(id) {
  document.getElementById(id).style.display = 'none';//block
}
function font(id, color){
  document.getElementById(id).style.color = color;
}
function img_change(img_id, img_src) {
  document[img_id].src = img_src;
}

function show_hide(id, img_id){
  if(document.getElementById(id).style.display=="none"){
    show(id);
    img_change(img_id,"img/ic_close.gif");
  }else{
    hide(id);
    img_change(img_id,"img/ic_open.gif");
  }
}
/****************************************END--FOR LEFT NEVEGATION MENU********************************************/

/****************************************START Buy02.php**********************************************************/
function check_color(fromObj) {
  if(fromObj.goodsColor.value==""){
    alert("プルダウン項目をお選びください。");
    return false;
  }else if(fromObj.goodsColor.value!=""){
  return true;
  }
  
}
/****************************************END Buy02.php**********************************************************/
