/**
 * PopupImage
 */
function popimag(imgurl,wsize,hsize,alttext){
	var width  = wsize + 50 ;
	var height = hsize + 70 ;
	if (width  < 100) width  = 100 ;
	if (height < 100) height = 100 ;
	var win1 = window.open('','popimagwin','fullscreen=no,height='+ height + ',width=' + width) ;
	var text = '' ;
	
	text += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' ;
	text += '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">\n ';
	text += '<head>\n';
	text += '<meta http-equiv="content-type" content="text/html; charset=EUC-JP" />\n';
	text += '<meta http-equiv="content-language" content="ja" />\n';
	text += '<meta http-equiv="Pragma" content="no-cache" />\n';
	text += '<meta http-equiv="Content-Script-Type" content="text/javascript" />\n';
	text += '<meta http-equiv="Content-Style-Type" content="text/css" />\n';
	text += '<title>IMAGE</title>\n';
	text += '</head>\n';
	text += '<body style="margin: 5px; font-size: 12px;">\n' ;
	text += '<div style="background-color: #ffffff">\n' ;
	text += '<div style="width: '+ wsize +'; text-align: right; border-bottom: 1px solid #cccccc; margin-bottom: 3px; padding-bottom: 3px;">\n' ;
	text += '<a href="javascript:window.close();" style="text-align: right;"><img src="/img/close_e.gif" border="0" alt="close" /></a>\n' ;
	text += '</div>\n' ;
	text += '<div>\n' ;
	text += '<img src="' + imgurl + '" alt="' + alttext + '" style="border: 1px solid #cccccc; padding: 2px;"/>\n' ;
	text += '</div>\n' ;
	text += '</div>\n' ;
	text += '</body>\n' ;
	text += '</html>\n' ;
	win1.focus() ;
	win1.document.write(text) ;
	win1.document.close() ;
}
//20090701
function bgimgturnv(obj){
  var sty = obj.style ;
  if (sty.backgroundPosition.indexOf("top") != -1){
    sty.backgroundPosition = "bottom left" ;
  }
  else{
    sty.backgroundPosition = "top left" ;
  }
}
//20090602
function imgturnv(obj,height){
  var sty = obj.style ;
  var gap = "-" + height + "px" ;
  
  if (sty.backgroundImage != ""){
    if (sty.backgroundPosition.indexOf("top") != -1){
      sty.backgroundPosition = "bottom left" ;
    }
    else{
      sty.backgroundPosition = "top left" ;
    }
  }
  else{
    for(i=0;i<obj.childNodes.length;i++){
      if (obj.childNodes[i].nodeName == "IMG"){
        var img = obj.childNodes[i] ;
        img.style.top = (img.style.top == "0px") ? gap : "0px" ;
      }
    }
  }
}
//20090511
function switchfontsize(size){
	document.cookie = "FSC=" + size + "; path=/" ;
	document.location.reload() ;
}
//20091001
function inpfocusbg(obj,bg){
	obj.style.backgroundColor = bg ;
}
function inpfocusbd(obj,bd){
	obj.style.borderColor = bd ;
}
function inpfocusbb(obj,bg,bd){
	obj.style.borderColor = bd ;
	obj.style.backgroundColor = bg ;
}
function inpfocusfg(obj,bg,bd,fg){
	obj.style.color = fg ;
	obj.style.borderColor = bd ;
	obj.style.backgroundColor = bg ;
}
//
window.onunload = function(){
  if (pos.src){
    pos.src.className = "hidebox" ;
    pos.func = 0 ;
    pos.src  = 0 ;
  }
}
window.document.onmousemove = getMousePosition ;
var pos = new Object() ;
pos.vscroll   = 0 ;
pos.hscroll   = 0 ;
pos.window_x  = 0 ;
pos.window_y  = 0 ;
pos.object_x  = 0 ;
pos.object_y  = 0 ;
pos.offset_x  = 0 ;
pos.offset_y  = 0 ;
pos.imgwidth  = 0 ;
pos.imgheight = 0 ;
pos.imgxsize  = 0 ;
pos.imgysize  = 0 ;
pos.func      = 0 ;
pos.src       = 0 ;
pos.obj       = 0 ;
function getMousePosition(evt){
  if (window.createPopup){
    if (typeof document.documentElement.style.msInterpolationMode != "undefined"){
      var scrollx = document.documentElement.scrollLeft ;
      var scrolly = document.documentElement.scrollTop ;
    }
    else{
      var scrollx = document.documentElement.scrollLeft || document.body.scrollLeft ;
      var scrolly = document.documentElement.scrollTop  || document.body.scrollTop ;
    }
    pos.hscroll  = parseInt(scrollx) ;
    pos.vscroll  = parseInt(scrolly) ;
    pos.window_x = event.x + parseInt(scrollx) ;
    pos.window_y = event.y + parseInt(scrolly) ;
  }
  else{
    var scrollx = document.documentElement.scrollLeft || document.body.scrollLeft ;
    var scrolly = document.documentElement.scrollTop  || document.body.scrollTop ;
    pos.hscroll  = parseInt(scrollx) ;
    pos.vscroll  = parseInt(scrolly) ;
    pos.window_x = evt.pageX ;
    pos.window_y = evt.pageY ;
  }
  if (document.all){
    pos.object_x = event.offsetX ;
    pos.object_y = event.offsetY ;
  }
  else{
    pos.object_x = evt.layerX ;
    pos.object_y = evt.layerY ;
  }
  if (typeof(pos.func) == 'function' && pos.src) pos.func() ;
}
function nopyankimg(){
}
function movyankimg(){
  var top  = pos.window_y + pos.offset_y ;
  var left = pos.window_x + pos.offset_x ;
  pos.src.style.top  = top  + "px" ;
  pos.src.style.left = left + "px" ;
}
function yankimg(id,func,x,y){
  var obj = document.getElementById(id) ;
  if (obj){
    if (func != 0){
     if (pos.src){
        pos.src.className = "hidebox" ;
        pos.func = 0 ;
        pos.src  = 0 ;
      }
      var top  = pos.window_y + y ;
      var left = pos.window_x + x ;
      obj.className  = "viewbox" ;
      obj.style.top  = top  + "px" ;
      obj.style.left = left + "px" ;
      pos.offset_x = x ;
      pos.offset_y = y ;
      pos.func = func ;
      pos.src  = obj ;
    }
    else{
      obj.className = "hidebox" ;
      pos.func = 0 ;
      pos.src  = 0 ;
    }
  }
}
function movxmagimg(){
  var dspx = parseInt(pos.obj.style.width.replace("/[px]/","")) ;
  var dspy = parseInt(pos.obj.style.height.replace("/[px]/","")) ;
  var imgx = pos.imgwidth ;
  var imgy = pos.imgheight ;
  var maxx = parseInt(imgx - dspx) ;
  var maxy = parseInt(imgy - dspy) ;
  var hafx = parseInt(dspx / 2) ;
  var hafy = parseInt(dspy / 2) ;
  var vx   = parseInt(pos.object_x * (imgx / pos.imgxsize) - hafx) ;
  var vy   = parseInt(pos.object_y * (imgy / pos.imgysize) - hafy) ;
  if (vx <    0) vx = 0 ;
  if (vy <    0) vy = 0 ;
  if (vx > maxx) vx = maxx ;
  if (vy > maxy) vy = maxy ;
  vx = vx * -1 ;
  vy = vy * -1 ;
  pos.obj.style.backgroundPosition = vx + "px " + vy + "px" ;
}
function xmagimg(img,box,func,width,height,xsize,ysize){
  var obj = document.getElementById(box) ;
  if (obj){
    if (func){
      pos.imgwidth  = width ;
      pos.imgheight = height ;
      pos.imgxsize  = xsize ;
      pos.imgysize  = ysize ;
      pos.src  = img ;
      pos.obj  = obj ;
      pos.func = func ;
      pos.obj.style.backgroundImage = "url(" + pos.src.src + ")" ;
    }
    else{
      pos.func = 0 ;
      pos.src  = 0 ;
      pos.obj  = 0 ;
    }
  }
}
//200911
function trim(str){
	return str.replace(/^\s+|\s+$/g,"") ;
}
function getcookieval(name){
  if (document.cookie != ""){
    var cookies = document.cookie.split(";") ;
    for(i=0;i<cookies.length;i++){
      var kv = cookies[i].split("=") ;
      if (trim(kv[0]) == name) return(unescape(trim(kv[1]))) ;
    }
  }
  return("") ;
}
function pickupitem(item,jump,mesg){
  var obj = document.getElementById('NUMITEM'+item) ;
  var num = (obj) ? parseInt(trim(obj.value)) : 1 ;
  if (num < 0 || num > 10) num = 0 ;
  
  var lst = 0 ;
  var val = 0 ;
  for(i=0;i<150 && val==0;i++){
    var str = '000' + i ;
    var sno = str.substring(str.length-3,str.length) ;
    var obj = document.getElementById('SELITEM' + item + sno) ;
    if (obj){
      lst = 1 ;
      if (obj.checked) val = obj.value ;
    }
  }
  if ((lst == 1 && val == 0) || num == 0){
    alert(mesg) ;
  }
  else{
    var save = item + ":" + val + ":" + num ;
    var cval = getcookieval("SHOPPINGCART") ;
    cval = (cval != "") ? cval + "," + save : save ;
    document.cookie = "SHOPPINGCART=" + cval + "; path=/" ;
    document.cookie = "SHOPPINGPAGE=" + document.location.href + "; path=/" ;
    if (jump == ""){
      document.location.reload() ;
    }
    else{
      document.location.href = jump ;
    }
  }
}
function formbackaction(idnam,val){
  var obj = document.getElementById(idnam) ;
  if (obj){
    obj.value = val ;
  }
}
//201003
function pctime(id){
 var obj = document.getElementById(id) ;
 if (obj) obj.value = parseInt(new Date() / 1000) ;
 return true ;
}

