/*--------------------------------------------------------------------------*/
/*  $id Selector
/*--------------------------------------------------------------------------*/
/* getElementById : $id("id") */
function $id()	{
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}



/*--------------------------------------------------------------------------*/
/*  add event
/*--------------------------------------------------------------------------*/
function addEvent( obj, type, fn )
{
	if (obj.addEventListener)	/* Dom Standard */
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)	/* MS Script */
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}
/*
addEvent	(window, "load", function()	{
					
			}
);
*/



/*--------------------------------------------------------------------------*/
/*   °Ë»ö
/*--------------------------------------------------------------------------*/
function fnSelectDesign() {
	this.GoodsSetting = function() {
		this.Obj = document.getElementById(this.DivName);
		this.ObjSelect = this.Obj.getElementsByTagName("select")[0];
		this.ObjOption = this.ObjSelect.getElementsByTagName("option");
		this.ObjOptionNum = this.ObjOption.length;
		
	
		this.ObjSelectValue = this.ObjSelect.item(this.ObjSelect.selectedIndex).firstChild.nodeValue;
		
		this.SelectTi = document.createElement('div');
		this.SelectTi.className = "dnshopDesignSelect01";
		this.SelectTi.style.width = this.SelectWidth + "px";
		this.SelectTi.style.height = this.SelectHeight + "px";
		this.SelectTi.style.lineHeight = this.SelectHeight - 2 + "px";
		if ( navigator.appName.indexOf("Explorer") != -1 ) {
			this.SelectTi.style.top ="0px";
			this.SelectTi.style.left ="0px";
		} else {
			this.SelectTi.style.top ="0px";
			this.SelectTi.style.left ="0px";
		}
		
		if ( navigator.userAgent.indexOf("Chrome") != -1 ) {
			this.SelectTi.style.top ="0px";
			this.SelectTi.style.left ="0px";
		}

		this.Obj.appendChild(this.SelectTi);
		
		this.SelectTiLink = document.createElement('a');
		this.SelectTiLink.href = "#";
		this.SelectTiLink.fnName = this.fnName;
		this.SelectTiLink.onclick = function() { eval(this.fnName + ".SelectClick(this)"); return false; }
		this.SelectTiLink.appendChild(document.createTextNode(this.ObjSelectValue));
		this.SelectTi.appendChild(this.SelectTiLink);
		
		this.SelectCo = document.createElement('div');
		this.SelectCo.className = "dnshopDesignSelect02";
		this.SelectCo.style.width = this.SelectWidth + "px";
		this.SelectCo.fnName = this.fnName;
		this.SelectCo.onmouseout = function() { eval(this.fnName + ".SelectClose(this)"); }
		this.SelectCo.onmouseover = function() { eval(this.fnName + ".SelectOepn(this)"); }
		if ( navigator.appName.indexOf("Explorer") != -1 ) {
			this.SelectCo.style.top ="0px";
			this.SelectCo.style.left ="0px";
		} else {
			this.SelectCo.style.top ="0px";
			this.SelectCo.style.left ="0px";
		}
		
		if ( navigator.userAgent.indexOf("Chrome") != -1 ) {
			this.SelectCo.style.top ="0px";
			this.SelectCo.style.left ="0px";
		}
		this.Obj.appendChild(this.SelectCo);
		
		this.SelectCoUl = document.createElement('ul');
		this.SelectCoUl.style.width = this.SelectWidth + "px";
		this.SelectCo.appendChild(this.SelectCoUl);
		
		for ( var i=0; i<this.ObjOptionNum; i++ ) {
			this.SelectCoLi = document.createElement('li');
			this.SelectCoUl.appendChild(this.SelectCoLi);
			
			this.SelectCoLiLink = document.createElement('a');
			this.SelectCoLiLink.href = "#";
			this.SelectCoLiLink.fnName = this.fnName;
			this.SelectCoLiLink.i = i;
			this.SelectCoLiLink.onclick = function() { eval(this.fnName + ".SelectIndexClick(this," + this.i + ")"); return false; }
			this.SelectCoLiLink.appendChild(document.createTextNode(this.ObjOption.item(i).firstChild.nodeValue));
			this.SelectCoLi.appendChild(this.SelectCoLiLink);

		}
		
		this.ObjSelect.style.display = "none";
	}
	
	this.SelectClick = function(val) {
		this.SC_Div = val.parentNode.parentNode;
		this.SCTarget = this.SC_Div.getElementsByTagName("div")[1];
		this.SCTarget.style.display = "block";
		this.SelectTiLink.style.display = "block";
	}
	this.SelectIndexClick = function(val,valnum) {
		this.SCI_Div = val.parentNode.parentNode.parentNode.parentNode;
		this.SelectTargetIndex = this.SCI_Div.getElementsByTagName("div")[0].getElementsByTagName("a")[0];
		this.SCI_Div.getElementsByTagName("select")[0].selectedIndex = valnum;
		this.SCI_Div.getElementsByTagName("div")[1].style.display = "none";
		this.SelectTargetIndex.innerHTML = this.SCI_Div.getElementsByTagName("select")[0].getElementsByTagName("option")[valnum].firstChild.nodeValue;
		this.SelectTiLink.style.display = "block";
	}
	this.SelectOepn = function(val) {
		val.style.display = "block";
		this.SelectTiLink.style.display = "block";
	}
	this.SelectClose = function(val) {
		val.style.display = "none";
		this.SelectTiLink.style.display = "block";
	}
}

