function exist(image_url){
  var img = new Image();
  img.src = image_url;
  if(img.height > 0){
    return true;
  }
  return false;
}

function dimension(image_url){
  var img = new Image();
  img.src = image_url;
  if(img.height == 0){
    return null;
  }
  ret = new Array(2);
  ret[0] = img.height;
  ret[1] = img.width;
  return ret;
}

function load_no_photo(obj,size){
  if(!obj) return;

  if(size == 's'){
    src_path = "http://www.fujisan.co.jp/images/products/no_photo_s.jpg";
    pos = dimension(src_path);
    if(!pos) return;
  }else if(size == 't'){
    src_path = "http://www.fujisan.co.jp/images/products/no_photo_t.jpg";
    pos = dimension(src_path);
    if(!pos) return;
  }else{
    src_path = "http://www.fujisan.co.jp/images/products/no_photo.jpg";
    pos = dimension(src_path);
    if(!pos) return;
  }
  obj.src = src_path;
  obj.height = pos[0];
  obj.weight = pos[1];
}

function load_content_image(content_image_t_url){
  if(!exist(content_image_t_url)){
    content_image_t_url = no_photo('t');
  }
  document.getElementById("content_image_t").src = content_image_t_url;
  var content_image_t_dimension = dimension(content_image_t_url);
  if(content_image_t_dimension){
    document.getElementById("content_image_t").height = content_image_t_dimension[0];
    document.getElementById("content_image_t").width = content_image_t_dimension[1];
  }
}

