﻿//-----initialize-----//
// code
var q = "o_q_";
var r = "o_r_";
var w = "o_qw_";

// array
var brand    = new Array();
var category = new Array();
var type     = new Array();
var item     = new Array();

//-----quiksliver outlet-----//
// brand name
brand[q+0] = [ q+1,q+2,q+3 ];
// category name
category[q+1] = [ "Quiksilver",q+4,q+5,q+6,q+7,q+8,q+9,q+10,q+11,q+12,q+13 ];
category[q+2] = [ "QS CULTURE",q+14 ];
category[q+3] = [ "KIDS",q+15,q+16,q+17,q+18,q+19 ];
// type name
type[q+4]  = [ "TOPS",q+20,q+21,q+22,q+23,q+24 ];
type[q+5]  = [ "BOTTOMS",q+25,q+26 ];
type[q+6]  = [ "GOODS",q+27,q+28,q+29,q+30,q+31,q+32,q+33 ];
type[q+7]  = [ "SURF&BEACH",q+34,q+35,q+36,q+37,q+38,q+39 ];
type[q+8]  = [ "SNOW",q+40,q+41,q+42 ];
type[q+9]  = [ "EYEWEAR" ];
type[q+10] = [ "WATCH" ];
type[q+11] = [ "FOOTWEAR",q+43,q+44,q+45 ];
type[q+12] = [ "ATHLETIC" ];
type[q+13] = [ "COLABORATION" ];
type[q+14] = [ "QS CULTURE" ];
type[q+15] = [ "TOPS" ];
type[q+16] = [ "BOTTOMS" ];
type[q+17] = [ "GOODS" ];
type[q+18] = [ "SURF&BEACH" ];
type[q+19] = [ "SNOW" ];
// item name
item[q+20] = "OUTER";
item[q+21] = "SHIRTS";
item[q+22] = "SWEAT・PARKA";
item[q+23] = "CUT&SEW・KNIT";
item[q+24] = "T SHIRTS";
item[q+25] = "BOTTOMS";
item[q+26] = "DENIM";
item[q+27] = "BAG";
item[q+28] = "BELT";
item[q+29] = "HEAD WEAR";
item[q+30] = "WALLET";
item[q+31] = "HOME WEAR";
item[q+32] = "ACCESSORIES";
item[q+33] = "LIFE STYLE";
item[q+34] = "SWIM WEAR";
item[q+35] = "BOARDSHORTS";
item[q+36] = "RASH GUARD";
item[q+37] = "WETSUIT";
item[q+38] = "GOODS";
item[q+39] = "SURF BOARD";
item[q+40] = "JACKET";
item[q+41] = "PANTS";
item[q+42] = "GOODS";
item[q+43] = "SHOES";
item[q+44] = "SANDAL";
item[q+45] = "BOOTS";

//-----roxy outlet-----//
brand[r+0] = [ r+1,r+2 ];
// category name
category[r+1] = [ "ROXY",r+3,r+4,r+5,r+6,r+7,r+8,r+9,r+10,r+11,r+12 ] ;
category[r+2] = [ "KIDS",r+13,r+14,r+15,r+16,r+17 ] ;
// type name
type[r+3]  = [ "TOPS",r+18,r+19,r+20,r+21,r+22,r+23 ];
type[r+4]  = [ "BOTTOMS",r+24,r+25 ];
type[r+5]  = [ "GOODS",r+26,r+27,r+28,r+29,r+30,r+31,r+32, ];
type[r+6]  = [ "SURF&BEACH",r+33,r+34,r+35,r+36,r+37,r+38, ];
type[r+7]  = [ "SNOW",r+39,r+40,r+41, ];
type[r+8]  = [ "EYEWEAR" ];
type[r+9]  = [ "WATCH" ];
type[r+10] = [ "FOOTWEAR",r+42,r+43,r+44, ];
type[r+11] = [ "COLABORATION" ];
type[r+12] = [ "ATHLETIC" ];
type[r+13] = [ "TOPS" ];
type[r+14] = [ "BOTTOMS" ];
type[r+15] = [ "GOODS" ];
type[r+16] = [ "SURF&BEACH" ];
type[r+17] = [ "SNOW" ];
// item name
item[r+18] = "OUTER";
item[r+19] = "SHIRTS";
item[r+20] = "SWEAT・PARKA";
item[r+21] = "CUT&SEW・KNIT";
item[r+22] = "T SHIRTS";
item[r+23] = "ONE PIECE";
item[r+24] = "BOTTOMS";
item[r+25] = "DENIM";
item[r+26] = "BAG";
item[r+27] = "BELT";
item[r+28] = "HEAD WEAR";
item[r+29] = "WALLET";
item[r+30] = "HOME WEAR";
item[r+31] = "ACCESSORIES";
item[r+32] = "LIFE STYLE";
item[r+33] = "SWIM WEAR";
item[r+34] = "BOARDSHORTS";
item[r+35] = "RASH GUARD";
item[r+36] = "WETSUIT";
item[r+37] = "GOODS";
item[r+38] = "SURF BOARD";
item[r+39] = "JACKET";
item[r+40] = "PANTS";
item[r+41] = "GOODS";
item[r+42] = "SHOES";
item[r+43] = "SANDAL";
item[r+44] = "BOOTS";

//-----quiksilver women outlet-----//
brand[w+0] = [];

/*
 * initialize category block
 */
function clearCategory()
{

  // length of category block 
  if (document.getElementById('category')) {
    var length = document.getElementById('category').length;
    // set null
    for (d = length; d >= 1; d--) {
      document.getElementById('category').options[d] = null;
    }
  }
}

/*
 * initialize type block
 */
function clearType()
{
  // length of type block 
  if (document.getElementById('type')) {
    var length = document.getElementById('type').length;
    // set null
    for (d = length; d >= 1; d--) {
      document.getElementById('type').options[d] = null;
    }
  }
}

/*
 * initialize item block
 */
function clearItem()
{
  // length of item block 
  if (document.getElementById('item')) {
    var length = document.getElementById('item').length;
    // set null
    for (d = length; d >= 1; d--) {
      document.getElementById('item').options[d] = null;
    }
  }
}

/*
 * create category block
 */
function getCategory(obj)
{
  clearCategory();
  clearType();
  clearItem();

  // get brand code 
  if(obj != undefined)
    var id = obj.options[obj.selectedIndex].value;
  else
    var id = q+0;

  // create data
  if(brand[id] != undefined)
  {
    if (document.getElementById('category')) {
      for (i = 0; i < brand[id].length; i++) {
        var code = brand[id][i];
        document.getElementById('category').options[i + 1] = new Option(category[code][0], code);
      }
      if (document.getElementById('category').options[1]) {
        document.getElementById('category').options[1].selected = true; // category option[1] be selected as default
        var sid = document.getElementById('category').options[1].value;
        // type block action
        getType(null, sid);
      }
    }
  }
}

/*
 * create type block
 */
function getType(obj,sid)
{
  clearType();
  clearItem();
  if(obj != undefined)
    var id = obj.options[obj.selectedIndex].value;
  else if(sid)
    var id = sid;
  else
    var id = q+1;
   // create data
  if(category[id] != undefined)
  {
    if (document.getElementById('type')) {
      for (i = 1; i < category[id].length; i++) {
        var code = category[id][i];
        document.getElementById('type').options[i] = new Option(type[code][0], code);
        
      }
      if (document.getElementById('type').options[1]) {
        document.getElementById('type').options[1].selected = true; // type option[1] be selected as default
        var sid = document.getElementById('type').options[1].value;
        // item block action
        getItems(null, sid);
      }
    }
  }
}

/*
 * create item block
 */
function getItems(obj,sid)
{
  clearItem();
  if(obj != undefined)
    var id = obj.options[obj.selectedIndex].value;
  else if(sid)
    var id = sid;
  else
    var id = q+4;
   // create data
  if (type[id] != undefined) {
    if (document.getElementById('item')) {
      for (i = 1; i < type[id].length; i++) {
        var code = type[id][i];
        document.getElementById('item').options[i] = new Option(item[code], code);
        
      }
      if (document.getElementById('item').options[1]) 
        document.getElementById('item').options[1].selected = true; // type option[1] be selected as default
    }
    if(document.getElementById('item').options[1])
      document.getElementById('item').options[1].selected = true; // type option[1] be selected as default
  }
}




