﻿var mousebackground;
var oshiraseflag = 1;
var NewstimerID = 0;
var currentNews = 0;
var subcarname = "";
var subcarmaker = "";
var currentBID = 0;
var currentMAKER = '';
var currentSEED = '';
var currentAjax = "topbody";
var Tooltip = Class.create();
var tool_tip_before = null;
Tooltip.prototype = {
  initialize: function(element, tool_tip) {
    var options = Object.extend({
      default_css: false,
      margin: "0px",
      padding: "5px",
      backgroundColor: "#d6d6fc",
      min_distance_x: 5,
      min_distance_y: 5,
      delta_x: 0,
      delta_y: 0,
      zindex: 1000
    }, arguments[2] || {});

    this.element      = $(element);
    this.options      = options;
    
    // use the supplied tooltip element or create our own div
    if($(tool_tip)) {
      this.tool_tip = $(tool_tip);
    } else {
      this.tool_tip = $(document.createElement("div")); 
      document.body.appendChild(this.tool_tip);
      this.tool_tip.addClassName("tooltip");
      this.tool_tip.appendChild(document.createTextNode(tool_tip));
    }

    // hide the tool-tip by default
    this.tool_tip.hide();

    this.eventMouseOver = this.showTooltip.bindAsEventListener(this);
    this.eventMouseOut   = this.hideTooltip.bindAsEventListener(this);
//    this.eventMouseMove  = this.moveTooltip.bindAsEventListener(this);

    this.registerEvents();
  },

  destroy: function() {
    Event.stopObserving(this.element, "mouseover", this.eventMouseOver);
    Event.stopObserving(this.element, "mouseout", this.eventMouseOut);
//    Event.stopObserving(this.element, "mousemove", this.eventMouseMove);
  },

  registerEvents: function() {
    Event.observe(this.element, "mouseover", this.eventMouseOver);
    Event.observe(this.element, "mouseout", this.eventMouseOut);
//    Event.observe(this.element, "mousemove", this.eventMouseMove);
  },

  moveTooltip: function(event){
	  Event.stop(event);
	  // get Mouse position
          var mouse_x = Event.pointerX(event);
	  var mouse_y = Event.pointerY(event);
	
	  // decide if wee need to switch sides for the tooltip
	  var dimensions = Element.getDimensions( this.tool_tip );
	  var element_width = dimensions.width;
	  var element_height = dimensions.height;
	  mouse_x1 = mouse_x - element_width - this.options.min_distance_x;
/*
	  if ( (element_width + mouse_x) >= ( this.getWindowWidth() - this.options.min_distance_x) ){ // too big for X
		  mouse_x = mouse_x - element_width;
		  // apply min_distance to make sure that the mouse is not on the tool-tip
		  mouse_x = mouse_x - this.options.min_distance_x;
	  } else {
		  mouse_x = mouse_x + this.options.min_distance_x;
	  }
*/
	  mouse_y1 = mouse_y - element_height - this.options.min_distance_y;
	  if ( mouse_y1 < this.getWindowScroll() + this.options.min_distance_y )
	  {
		  mouse_y1 = mouse_y + this.options.min_distance_y;
	  }
/*
	  if ( (element_height + mouse_y) >= ( this.getWindowHeight() - this.options.min_distance_y) ){ // too big for Y
		  mouse_y = mouse_y - element_height;
	    // apply min_distance to make sure that the mouse is not on the tool-tip
		  mouse_y = mouse_y - this.options.min_distance_y;
	  } else {
		  mouse_y = mouse_y + this.options.min_distance_y;
	  } 
*/
	  // now set the right styles
	  this.setStyles(mouse_x1, mouse_y1);
  },
	
		
  showTooltip: function(event) {
    Event.stop(event);
    if ( tool_tip_before )
    {
	  new Element.hide(tool_tip_before);
	  tool_tip_before = null;
    }

    this.moveTooltip(event);
    new Element.show(this.tool_tip);
    mousebackground = this.element.style.backgroundColor;
    this.element.style.backgroundColor='#CCCCFF';
    this.element.style.cursor='pointer';
    tool_tip_before = this.tool_tip;
  },
  
  setStyles: function(x, y){
    // set the right styles to position the tool tip
	Element.setStyle(this.tool_tip, { position:'absolute',
	top:y - this.options.delta_y + "px",
	left:x - this.options.delta_x + "px",
	zindex:this.options.zindex
	 });
	
  // apply default theme if wanted
	if (this.options.default_css){
  		Element.setStyle(this.tool_tip, { margin:this.options.margin,
        	  padding:this.options.padding,
        	  backgroundColor:this.options.backgroundColor,
        	  zindex:this.options.zindex
		  });	
	}	
  },

  hideTooltip: function(event){
    if ( tool_tip_before )
    {
	  this.element.style.backgroundColor=mousebackground;
	  new Element.hide(tool_tip_before);
	  tool_tip_before = null;
    }
  },

  getWindowScroll: function(){
    var scrollpos;
    scrollpos = document.documentElement.scrollTop || document.body.scrollTop;
    return scrollpos;
  },

  getWindowHeight: function(){
    var innerHeight;
    if (navigator.appVersion.indexOf('MSIE')>0) {
		  innerHeight = document.documentElement.clientHeight;
    } else {
		  innerHeight = window.innerHeight;
    }
    return innerHeight;	
  },
 
  getWindowWidth: function(){
    var innerWidth;
	  if (navigator.appVersion.indexOf('MSIE')>0) {
		  innerWidth = document.body.clientWidth;
    } else {
		  innerWidth = window.innerWidth;
    }
    return innerWidth;	
  }

}

function oshiraseset()
{
	var bottomAccordion = new accordion('vertical_container');
	// Open first one
	bottomAccordion.activate($$('#vertical_container .accordion_toggle')[0]);
}

function oshiraseopen()
{
	new Ajax.Updater('OSHIRASE','oshirase.asp',{'method' : 'get', 'onComplete' : function(request) { oshiraseset();}});
	oshiraseflag = 1;
}

function oshiraseclose()
{
	new Ajax.Updater('OSHIRASE','oshiraseclose.asp',{'method' : 'get'});
	oshiraseflag = 0;
}

function zoompicture(sid,pid)
{
	new Ajax.Updater('Picture','detailpicture.asp',{'method' : 'get','parameters' : 'SID=' + sid + '&PID=' + pid});
}

function m_in(t)
{
	mousebackground = t.style.backgroundColor;
	t.style.backgroundColor='#CCCCFF';
	t.style.cursor='pointer';
}
function m_out(t)
{
	t.style.backgroundColor=mousebackground;
}
function m_out2(t)
{
	t.style.backgroundColor=mousebackground;
}
function categoriesearchsub(bid,pg)
{
	new Ajax.Updater('TitleImage','popupmenu.asp',{'method' : 'get','parameters' : 'BID=' + bid });

	currentBID = bid;
	new Ajax.Updater('CenterBody','listbycategorie.asp',{'method' : 'get','parameters' : 'BID=' + bid + '&PG=' + pg + '&carname=' + subcarname, 'onComplete' : function(request) { ToolTipSet('sale',30);} });
	historyset("cate" + bid );
	window.scrollTo(0,0);
}
function categoriesearch(t,s)
{
	categoriesearchsub(t,0);
	new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'BID=' + t + "&BN=" + s});
}
function makersearchsub(maker)
{
	currentMAKER = maker;
	new Ajax.Updater('CenterBody','listbycategorie.asp',{'method' : 'get','parameters' : 'manufacturers_id=' + maker + '&carname=' + subcarname, 'onComplete' : function(request) { ToolTipSet('sale',30);}});
	historyset("maker" + maker );
	window.scrollTo(0,0);
}
function makersearch(t)
{
	maker = t.options[t.selectedIndex].value;
	makersearchsub(maker);
	new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'manufacturers_id=' + maker});
}
function seedsearchsub(seed)
{
	currentSEED = seed;
	new Ajax.Updater('CenterBody','listbycategorie.asp',{'method' : 'get','parameters' : 'SEED=' + seed + '&carname=' + subcarname, 'onComplete' : function(request) { ToolTipSet('sale',30);}});
	historyset("seed" + seed );
	window.scrollTo(0,0);
}
function seedsearch(t)
{
	seed = t.form.SEED.value;
	seedsearchsub(seed);
	if (seed.length == 0 )
	{
		new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'TB=1'});
	}
	else
	{
		new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'SEED=' + seed});
	}
}
function tokubaisearch()
{
	new Ajax.Updater('CenterBody','listbycategorie.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('sale',30);}});
	new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'TB=1'});
	historyset("tokubai" );
	window.scrollTo(0,0);
}
function reviewlistshow()
{
	new Ajax.Updater('CenterBody','reviewlist.asp',{'method' : 'get'});
	historyset("reviewlist" );
	window.scrollTo(0,0);
}
function logincheck(t)
{
	lmdate = new Date();

	tmd = lmdate.getTime();
	id = t.form.email.value;
	pw = t.form.pass.value;
	new Ajax.Updater('LoginBox','login.asp',{'method' : 'post','parameters' : 'email=' + id + '&pass=' + pw});
	historyset("account");
	window.scrollTo(0,0);
}
function gmailcheck(t)
{
	lmdate = new Date();

	tmd = lmdate.getTime();
	param = 'cmd=' + tmd;
	for (i=0; i<t.form.GMAIL.length; i++ )
	{
		if ( t.form.GMAIL[i].checked == true )
		{
			param += '&GMAIL=' + t.form.GMAIL[i].value;
			break;
		}
	}
	new Ajax.Updater('CenterBody','account.asp',{'method' : 'get', 'parameters' : param });
	historyset("account");
}
function accountShow()
{
	lmdate = new Date();

	tmd = lmdate.getTime();
	new Ajax.Updater('CenterBody','account.asp',{'method' : 'get', 'parameters' : 'cmd=' + tmd });
	historyset("account");
	window.scrollTo(0,0);
}
function ShopMail(t)
{
	var cmd;
	var email;
	var naiyou;

	if ( t )
	{
		cmd = t.form.send.value;
		email = t.form.email.value;
		naiyou = t.form.naiyou.value;
	}
	new Ajax.Updater('CenterBody','mailto.asp',{'method' : 'get', 'parameters' : 'cmd=' + cmd + '&email=' + email + '&naiyou=' + naiyou });
	window.scrollTo(0,0);
}
function forumShow()
{
	lmdate = new Date();

	tmd = lmdate.getTime();
	new Ajax.Updater('CenterBody','forum1.asp',{'method' : 'get', 'parameters' : 'cmd=' + tmd });
	historyset("forum");
	window.scrollTo(0,0);
}
function forum0write(t,bid)
{
	txt = t.form.subject.value;
	new Ajax.Updater('CenterBody','forum1admin.asp',{'method' : 'post', 'parameters' : 'bid=' + bid + '&txt=' + txt });
}
function forum1write(t,bid)
{
	txt = t.form.subject.value;
	jun = t.form.jun.value;
	ttl = t.form.ttl.value;
	for (i=0; i<t.form.ippan.length; i++ )
	{
		if ( t.form.ippan[i].checked == true )
		{
			ipn = t.form.ippan[i].value;
			break;
		}
	}
	for (i=0; i<t.form.del.length; i++ )
	{
		if ( t.form.del[i].checked == true )
		{
			del = t.form.del[i].value;
			break;
		}
	}
	for (i=0; i<t.form.gazou.length; i++ )
	{
		if ( t.form.gazou[i].checked == true )
		{
			gazou = t.form.gazou[i].value;
			break;
		}
	}
	new Ajax.Updater('CenterBody','forum1admin.asp',{'method' : 'post', 'parameters' : 'bid=' + bid + '&jun=' + jun + '&ippan=' + ipn + '&del=' + del  + '&gzu=' + gazou + '&ttl=' + ttl + '&txt=' + txt });
}
function forum2write(t,bid,thrid,r,tmp,prid)
{
	sbj = t.form.subject.value;
	hnd = t.form.handle.value;
	kiji = t.form.kiji.value;
	if ( t.form.bbskey )
	{
		key = t.form.bbskey.value;
	}
	else
	{
		key = '0';
	}

	if ( sbj.length == 0 || kiji.length == 0 )
	{
		alert("タイトルと記事の両方を入力してください");
	}
	else
	{
		new Ajax.Updater('CenterBody','forum2.asp',{'method' : 'post', 'parameters' : 'bid=' + bid + '&thrid=' + thrid + '&prid=' + prid + '&key=' + key + '&r=' + r + '&sbj=' + sbj + '&tmp=' + tmp + '&hnd=' + hnd + '&kiji=' + kiji });
	}
}
function logout()
{
	new Ajax.Updater('CurrentList','white.html',{method: 'get'});
	new Ajax.Updater('LoginBox','login.asp',{'method' : 'get','parameters' : 'cmd=logout'});
	topbodyShow()
}
function cartCheck()
{
	lmdate = new Date();

	new Ajax.Updater('TitleImage','white.html',{'method' : 'get'});
	tmd = lmdate.getTime();
	new Ajax.Updater('CenterBody','cartcheck.asp',{'method' : 'post', 'parameters' : 'cmd=' + tmd});
	historyset("cart");
	window.scrollTo(0,0);
}
function regiCheck()
{
	lmdate = new Date();

	new Ajax.Updater('TitleImage','white.html',{'method' : 'get'});
	tmd = lmdate.getTime();
	new Ajax.Updater('CenterBody','registor.asp',{'method' : 'post', 'parameters' : 'cmd=' + tmd});
	historyset("reg0");
	window.scrollTo(0,0);
}
function showDetail(id)
{
	new Ajax.Updater('CenterBody','detail.asp',{'method' : 'post', 'parameters' : 'SID=' + id + '&DS=1'});
	historyset("detail" + id);
	window.scrollTo(0,0);
}
function showDetailbyList(id,bid)
{
	new Ajax.Updater('CenterBody','detail.asp',{'method' : 'post', 'parameters' : 'SID=' + id + '&DS=1'});
	new Ajax.Updater('TitleImage','samecategorie.asp',{'method' : 'post', 'parameters' : 'BID=' + bid, 'onComplete' : function(request) { ToolTipSet('rank',5);} });
	historyset("detail" + id);
	window.scrollTo(0,0);
}
function showDetailbyTokubai(id,bid)
{
	new Ajax.Updater('CenterBody','detail.asp',{'method' : 'post', 'parameters' : 'SID=' + id + '&DS=1'});
	new Ajax.Updater('TitleImage','tokubaiRankScroll.asp',{'method' : 'get', 'parameters' : 'BID=' + bid, 'onComplete' : function(request) { ToolTipSet('rank',5);} });
	historyset("detail" + id);
	window.scrollTo(0,0);
}
function scrollRanking(bid,pg)
{
	new Ajax.Updater('TitleImage','samecategorie.asp',{'method' : 'post', 'parameters' : 'BID=' + bid + '&PG=' + pg, 'onComplete' : function(request) { ToolTipSet('rank',5);} });
}
function topcart()
{
	new Ajax.Updater('TopCart','topcartcheck.asp',{'method' : 'get'});
}
function addcart(t)
{
	sid = t.form.SID.value;
	suu = t.form.suryo.value;
	sen = '';
	if ( t.form.sentaku )
	{
		sen = t.form.sentaku.value;
		for(i = 0; i < t.form.sentaku.length; i ++)
		{
			if ( t.form.sentaku[i].checked )
			{
				sen = t.form.sentaku[i].value;
				break;
			}
		}
	}

	if ( t.form.KOBETU )
	{
		KOBETU = t.form.KOBETU.value;
	}
	else
	{
		KOBETU = '';
	}

	new Ajax.Updater('CenterBody','cartcheck.asp',{'method' : 'post','parameters' : 'SID=' + sid + '&SUU=' + suu + '&SEN=' + sen + '&KOBETU=' + KOBETU, 'onComplete' : function(request) { topcart();} });
	historyset("cart");
	window.scrollTo(0,0);
}
function calccart(t)
{
	var param = 'cmd=';
	var chkno = 0, chkon = 0;
	var suuno = 0;
	var sidno = 0;

	lmdate = new Date();

	param += lmdate.getTime();
	param += '&reculc=' + t.form.amount.value;
	for ( i=0; i<t.form.elements.length; i++ )
	{
		if ( t.form.elements[i].name.substring(0,7) === 'chkkesi' )
		{
			if ( t.form.elements[i].checked )
			{
				chkon = 1;
			}
			else
			{
				chkon = 0;
			}

			param += '&chkkesi' + chkno + '=' + chkon;
			chkno++;
		}
		if ( t.form.elements[i].name.substring(0,6) === 'chksuu' )
		{
			param += '&chksuu' + suuno + '=' + t.form.elements[i].value;
			suuno++;
		}
		if ( t.form.elements[i].name.substring(0,6) === 'chksid' )
		{
			param += '&chksid' + sidno + '=' + t.form.elements[i].value;
			sidno++;
		}
	}
	new Ajax.Updater('CenterBody','cartcheck.asp',{'method' : 'post','parameters' : param, 'onComplete' : function(request) { topcart();} });
}
function goreg1(t)
{
	var param = 'cmd=', i;

	lmdate = new Date();

	param += lmdate.getTime();
	for (i=0; i<t.form.SIHARAI.length; i++ )
	{
		if ( t.form.SIHARAI[i].checked == true )
		{
			param += '&SIHARAI=' + t.form.SIHARAI[i].value;
			break;
		}
	}

	if ( t.form.USEPOINT.checked )
	{
		param += '&USEPOINT=' + t.form.USEPOINT.value;
	}
	else
	{
		param += '&USEPOINT=0';
	}

	param += '&NAMAE=' + t.form.NAMAE.value;
	param += '&FURIGANA=' + t.form.FURIGANA.value;
	param += '&YUBIN=' + t.form.YUBIN.value;
	param += '&KENID=' + t.form.KENID.options[t.form.KENID.selectedIndex].value;
	param += '&JUSHO=' + t.form.JUSHO.value;
	param += '&JUSHOKANA=' + t.form.JUSHOKANA.value;
	param += '&EMAIL=' + t.form.EMAIL.value;
	param += '&PASSWORD=' + t.form.PASSWORD.value;
	param += '&PASSWORD2=' + t.form.PASSWORD2.value;
	param += '&TEL=' + t.form.TEL.value;
	param += '&FAX=' + t.form.FAX.value;
	param += '&TOIAWASE=' + t.form.TOIAWASE.value;
	param += '&TODOKEBI=' + t.form.TODOKEBI.value;
	param += '&TODOKEJI=' + t.form.TODOKEJI.options[t.form.TODOKEJI.selectedIndex].value;
	for (i=0; i<t.form.RENRAKU.length; i++ )
	{
		if ( t.form.RENRAKU[i].checked == true )
		{
			param += '&RENRAKU=' + t.form.RENRAKU[i].value;
			break;
		}
	}
	for (i=0; i<t.form.GMAIL.length; i++ )
	{
		if ( t.form.GMAIL[i].checked == true )
		{
			param += '&GMAIL=' + t.form.GMAIL[i].value;
			break;
		}
	}

	param += '&NAMAE2=' + t.form.NAMAE2.value;
	param += '&FURIGANA2=' + t.form.FURIGANA2.value;
	param += '&YUBIN2=' + t.form.YUBIN2.value;
	param += '&KENID2=' + t.form.KENID2.options[t.form.KENID2.selectedIndex].value;
	param += '&JUSHO2=' + t.form.JUSHO2.value;
	param += '&JUSHOKANA2=' + t.form.JUSHOKANA2.value;
	param += '&TEL2=' + t.form.TEL2.value;
	if ( t.form.COUPON )
	{
		param += '&COUPON=' + t.form.COUPON.value;
	}

	new Ajax.Updater('CenterBody','registor1.asp',{'method' : 'post','parameters' : param });
	window.scrollTo(0,0);
}

function goreg0(t)
{
	var param = 'cmd=', i;

	lmdate = new Date();

	new Ajax.Updater('TitleImage','white.html',{'method' : 'get'});
	param += lmdate.getTime();
	new Ajax.Updater('CenterBody','registor.asp',{'method' : 'get','parameters' : param });
	historyset("reg0");
	window.scrollTo(0,0);
}

function reviewwrite(t)
{
	var param = 'cmd=', i;

	lmdate = new Date();

	param += lmdate.getTime();
	param += '&RK=' + t.form.RK.options[t.form.RK.selectedIndex].value;
	param += '&HN=' + t.form.HN.value;
	param += '&KJ=' + t.form.KJ.value;

	new Ajax.Updater('Review','reviewput.asp',{'method' : 'post','parameters' : param });
}

function topbodyShowSub()
{
	new Ajax.Updater('TitleImage','imageset.asp',{'method' : 'get'});
	if ( oshiraseflag == 1 )
	{
		oshiraseopen();
	}
	else
	{
		oshiraseclose();
	}
	new Ajax.Updater('SINCHAKU','sinchaku.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('sin',30);}});
	new Ajax.Updater('TOKUBAI','tokubai.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('tokubai',5);}});
}

function topbodyShow()
{
	new Ajax.Updater('CenterBody','topbody.asp',{'method' : 'get', 'onComplete' : function(request) { topbodyShowSub();} });
	window.scrollTo(0,0);
}

function StarttopbodyShowSub()
{
	if ( oshiraseflag == 1 )
	{
		oshiraseopen();
	}
	else
	{
		oshiraseclose();
	}
	new Ajax.Updater('SINCHAKU','sinchaku.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('sin',30);}});
	new Ajax.Updater('TOKUBAI','tokubai.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('tokubai',5);}});
}

function StarttopbodyShow()
{
	new Ajax.Updater('CenterBody','topbody.asp',{'method' : 'get', 'onComplete' : function(request) { StarttopbodyShowSub();} });
	window.scrollTo(0,0);
}

function sinchakuScroll(c,divid,bid)
{
	target = 'shinchakuSc' + divid;
	new Ajax.Updater(target,'sinchakuScroll.asp',{'method' : 'get','parameters' : 'cmd=' + c + '&bid=' + bid, 'onComplete' : function(request) { ToolTipSet('sin' + bid + '_',5);} });
}

function tokubaiScroll(c,bid)
{
	new Ajax.Updater('TOKUBAI','tokubaiScroll.asp',{'method' : 'get','parameters' : 'cmd=' + c + '&bid=' + bid, 'onComplete' : function(request) { ToolTipSet('tokubai',5);} });
}

function tokubaiRankScroll(c,bid)
{
	new Ajax.Updater('TitleImage','tokubaiRankScroll.asp',{'method' : 'get','parameters' : 'cmd=' + c + '&bid=' + bid, 'onComplete' : function(request) { ToolTipSet('rank',5);}  });
}
function salejunleScroll(c,divid,bid)
{
	target = 'shinchakuSc' + divid;
	new Ajax.Updater(target,'salejunleScroll.asp',{'method' : 'get','parameters' : 'cmd=' + c + '&bid=' + bid, 'onComplete' : function(request) { ToolTipSet('sale' + bid + '_',5);} });
}

function jushoset(o)
{
	var	i;

	kenid = o.responseXML.getElementsByTagName('kenid');
	kennm = o.responseXML.getElementsByTagName('kennm');
	shinm = o.responseXML.getElementsByTagName('shinm');
	shikn = o.responseXML.getElementsByTagName('shikn');
	$('JUSHO').value = shinm[0].firstChild.nodeValue;
	$('JUSHOKANA').value = shikn[0].firstChild.nodeValue;
	kenidno = kenid[0].firstChild.nodeValue;

	for ( i=0; i< $('KENID').length; i++ )
	{
		if ( $('KENID').options[i].value == kenidno )
		{
			$('KENID').selectedIndex = i;
			break;
		}
	}
}

function yubin2adrs(t)
{
	yb = t.value;
	var ajax = new Ajax.Request('yubin.asp', { method:'put', parameters: 'yb=' + yb, onComplete: function(respons) { jushoset(respons);} });
}

function jushoset2(o)
{
	var	i;

	kenid = o.responseXML.getElementsByTagName('kenid');
	kennm = o.responseXML.getElementsByTagName('kennm');
	shinm = o.responseXML.getElementsByTagName('shinm');
	shikn = o.responseXML.getElementsByTagName('shikn');
	$('JUSHO2').value = shinm[0].firstChild.nodeValue;
	$('JUSHOKANA2').value = shikn[0].firstChild.nodeValue;
	kenidno = kenid[0].firstChild.nodeValue;

	for ( i=0; i< $('KENID2').length; i++ )
	{
		if ( $('KENID2').options[i].value == kenidno )
		{
			$('KENID2').selectedIndex = i;
			break;
		}
	}
}

function yubin2adrs2(t)
{
	yb = t.value;
	var ajax = new Ajax.Request('yubin.asp', { method:'put', parameters: 'yb=' + yb, onComplete: function(respons) { jushoset2(respons);} });
}

function historyset(src)
{
	if ( currentAjax != src )
	{
		currentAjax = src;
		document.getElementById("historyframe").src = "pagehistory.asp?src=" + src;
	}
}

function historycheck()
{
	var frame = document.getElementById('historyframe');
	var hash = frame.contentWindow.document.location.href;

	if ( pos = hash.indexOf("=") )
	{
		hash = hash.substring(pos+1);
	}

	if ( currentAjax != hash )
	{
		currentAjax = hash;

		if ( hash == "topbody" )
		{
			topbodyShow();
		}
		else if ( hash.substring(0,6) == "detail" )
		{
			id = hash.substring(6);
			showDetail(id);
		}
		else if ( hash.substring(0,4) == "cate" )
		{
			id = hash.substring(4);
			categoriesearchsub(id,0);
		}
		else if ( hash.substring(0,5) == "maker" )
		{
			id = hash.substring(5);
			makersearchsub(id);
		}
		else if ( hash.substring(0,4) == "seed" )
		{
			id = hash.substring(4);
			seedsearchsub(id);
		}
		else if ( hash == "account" )
		{
			accountShow();
		}
		else if ( hash == "cart" )
		{
			cartCheck();
		}
		else if ( hash == "reg0" )
		{
			goreg0();
		}
		else if ( hash == "tokubai" )
		{
			tokubaisearch();
		}
		else if ( hash == "reviewlist" )
		{
			revirelistshow();
		}
		else if ( hash == "forum" )
		{
			forumShow();
		}
		else if ( hash == "sale" )
		{
			saleShow();
		}
	}
}

function changepicture(jid,sid,pno)
{
	new Ajax.Updater('picture1','pictures.asp',{'method' : 'get','parameters' : 'JID=' + jid + '&SID=' + sid + '&PNO=' + pno});
}

function saleShow()
{
	new Ajax.Updater('TitleImage','imageset.asp',{'method' : 'get'});
	new Ajax.Updater('CurrentList','currentlist.asp',{'method' : 'get','parameters' : 'TB=1'});
	new Ajax.Updater('CenterBody','salejunle.asp',{'method' : 'get', 'onComplete' : function(request) { ToolTipSet('sale',30);} });
	historyset("sale");
	window.scrollTo(0,0);
}

function ToolTipSet(t,m,b)
{
	var icc = 0;
	var pict;
	var pos1, pos2, pos3;
	var jid, sid;

	while ( icc < m )
	{
		if ( document.getElementById('picture_' + t + icc) )
		{
			new Tooltip('picture_' + t + icc , 'tooltip_' + t + icc);
		}
		else
		{
			break;
		}

		icc++;
	}
}
function remindpass(t)
{
	email = t.form.email.value;
	new Ajax.Updater('CenterBody','remind.asp',{'method' : 'post','parameters' : 'email=' + email + '&CHECK=1'});
}
function toiawasesend(t)
{
	email = t.form.email.value;
	sid = t.form.sid.value;
	kno = t.form.kno.value;
	hno = t.form.hno.value;
	hnm = t.form.hnm.value;
	quest = t.form.quest.value;
	new Ajax.Updater('toiawasebox','toiawase.asp',{'method' : 'post','parameters' : 'email=' + email + '&sid=' + sid + '&kno=' + kno + '&hno=' + hno + '&hnm=' + hnm + '&quest=' + quest });
}
function popupselect(jid,sid,pno)
{
	bigf = document.getElementById('popupbig');
	bigf.innerHTML = '<img src="/pict/SH' + jid + '-' + sid + '-' + pno + '.jpg" />';
}
function addbuttonenable()
{
	btn = document.getElementById('cartbutton');
	btn.disabled = false;
}

var scrollmenut;
var scrollmenuzbg = 0;
function scrollmenuup(t,z)
{
	if ( scrollmenuzbg > 0 )
	{
		scrollmenut.style.top = "18px";
		scrollmenut.style.height = "14px";
		scrollmenut.style.backgroundImage = 'url(gif/scrollmenubg.gif)';
	}

	scrollmenut = t;
	scrollmenuzbg = z ;
	t.style.top = 0;
	t.style.height = "32px";
	t.style.cursor='pointer';
	t.style.backgroundImage = 'url(gif/scrollmenubg2.gif)';
}

function MessageboxHide()
{
	if ( NewstimerID > 0 )
	{
		clearTimeout(NewstimerID);
		msgid = document.getElementById("messagebox");
		msgid.style.display = "none";
	}
}

function addCheckList(sid,hnm)
{
	var scrollpos;
	var innerHeight;
	var innerWidth;

	new Ajax.Updater('messagebox','addchecklist.asp',{'method' : 'post','parameters' : 'sid=' + sid + '&hnm=' + hnm });

	scrollpos = document.documentElement.scrollTop || document.body.scrollTop;
	if (navigator.appVersion.indexOf('MSIE')>0) {
		innerHeight = document.documentElement.clientHeight;
	} else {
		innerHeight = window.innerHeight;
	}
	if (navigator.appVersion.indexOf('MSIE')>0) {
		innerWidth = document.body.clientWidth;
	} else {
		innerWidth = window.innerWidth;
	}
	msgid = document.getElementById("messagebox");

	toppos = innerHeight / 2 + scrollpos;
	leftpos = innerWidth / 2 - 400;
	if (leftpos < 0) {
		leftpos = 0;
	}
	msgid.style.top = toppos + "px";
	msgid.style.left = leftpos + "px";
	msgid.style.display = "block";
	if ( NewstimerID > 0 )
	{
		clearTimeout(NewstimerID);
	}
	NewstimerID = setTimeout('MessageboxHide()',1500);
}
function showCheckList(c,sid)
{
	new Ajax.Updater('TitleImage','checklistshow.asp',{'method' : 'post','parameters' : 'cmd=' + c + '&sid=' + sid, 'onComplete' : function(request) { ToolTipSet('rank',30);} });
}

