var Mac = navigator.appVersion.indexOf('Mac',0) != -1;
var Win = navigator.appVersion.indexOf('Win',0) != -1;
var IE  = getBrouwserName() == 'Explorer';
var NN  = getBrouwserName() == 'Netscape';
var Moz = navigator.userAgent.indexOf("Gecko") != -1;
var VER = parseInt(navigator.appVersion);
var MacIE5 = ((Mac && navigator.appVersion.indexOf('MSIE 5',0) != -1) || (Mac && IE && VER > 4));
var Vmajor = parseInt(navigator.appVersion);	
var Vminor = parseFloat(navigator.appVersion);	

var commonImagePath = '/common/img_menu/';
var documentRootPath = "";

var pdmObject = new Object();
pdmObject.stayId = null;
pdmObject.loaded = false;


// 大分類のメニュー
var pdmCategories = new Array();

pdmCategories[0] = new pdmCategory(0,"title1","title1","製品情報","");

pdmCategories[1] = new pdmCategory(1,"brand","menu_c101","ブランドから選ぶ","/select/brand/index.shtml");

pdmCategories[2] = new pdmCategory(2,"yoto","menu_c102","用途から選ぶ","/select/yoto/index.shtml");
pdmCategories[2].switchObject = new pdmDispSwitch(2,"yoto-switch","yoto-items")

pdmCategories[3] = new pdmCategory(3,"shiyo","menu_c103","仕様から選ぶ","/select/siyo/index.shtml");
pdmCategories[3].switchObject = new pdmDispSwitch(3,"shiyo-switch","shiyo-items")

pdmCategories[4] = new pdmCategory(4,"jushu","menu_c120","樹種から選ぶ","/select/material/index.shtml");

pdmCategories[5] = new pdmCategory(5,"kakaku","menu_c104","価格から選ぶ","/select/kakaku/index.shtml");

pdmCategories[6] = new pdmCategory(6,"campaign","menu_c110","キャンペーン製品情報","/product/campaign/index.shtml");

pdmCategories[7] = new pdmCategory(7,"kanren","menu_c113","関連商品","/product/kanren/index.shtml");

pdmCategories[8] = new pdmCategory(8,"title3","title3","事例紹介","");

pdmCategories[9] = new pdmCategory(9,"jirei","menu_c111","フローリング事例","/topics/jirei/index.shtml");

pdmCategories[10] = new pdmCategory(10,"title2","title2","トピックス","");

pdmCategories[11] = new pdmCategory(11,"tosou","menu_c109","塗装加工技術","/topics/tosou/index.shtml");

pdmCategories[12] = new pdmCategory(12,"column","menu_c118","オリジナル加工技術","/topics/original/index.shtml");

pdmCategories[13] = new pdmCategory(13,"title4","title4","古材情報","");

pdmCategories[14] = new pdmCategory(14,"antiquelumber","menu_c117","アンティークランバー事業部","javascript: ExchangeWin();");

pdmCategories[15] = new pdmCategory(15,"title5","title5","家具＆雑貨","");

pdmCategories[16] = new pdmCategory(16,"albero_pro_furniture","menu_c119","マジファニチャー","javascript: ExchangeWin2();");

pdmCategories[17] = new pdmCategory(17,"title6","title6","公式ブログ","");

pdmCategories[18] = new pdmCategory(18,"albero_news","menu_ban01","ALBERO NEWS","javascript: ExchangeWin3();");

// 小分類のメニュー
var pdmItems = new Array();
//   用途から選ぶ・・・
pdmItems[21] = new pdmItem(21,2,"menu_i201","住宅用","/select/yoto/index.shtml#house");
pdmItems[22] = new pdmItem(22,2,"menu_i202","土足、店舗用","/select/yoto/index.shtml#shop");
pdmItems[23] = new pdmItem(23,2,"menu_i203","床暖房対応","/select/yoto/index.shtml#floor");
pdmItems[24] = new pdmItem(24,2,"menu_i204","デッキ","/select/yoto/index.shtml#deck");

//   仕様から選ぶ・・・
pdmItems[31] = new pdmItem(31,3,"menu_i301","無垢フローリング","/select/siyo/index.shtml#muku");
pdmItems[32] = new pdmItem(32,3,"menu_i302","複合フローリング","/select/siyo/index.shtml#fukugo");
pdmItems[33] = new pdmItem(33,3,"menu_i303","パーケット","/select/siyo/index.shtml#parq");
pdmItems[34] = new pdmItem(34,3,"menu_i304","無垢三層構造","/select/siyo/index.shtml#muku3");
pdmItems[35] = new pdmItem(35,3,"menu_i305","直貼工法","/select/siyo/index.shtml#jika");
pdmItems[36] = new pdmItem(36,3,"menu_i306","釘打工法","/select/siyo/index.shtml#kugi");
pdmItems[37] = new pdmItem(37,3,"menu_i307","カラーヴァリエーション20色","/select/siyo/index.shtml#color");
pdmItems[38] = new pdmItem(38,3,"menu_i308","デザイン貼り対応","/select/siyo/index.shtml#design");
pdmItems[39] = new pdmItem(39,3,"menu_i309","防音","/select/siyo/index.shtml#bouon");
pdmItems[40] = new pdmItem(40,3,"menu_i310","壁材","/select/siyo/index.shtml#hekizai");


pdmCategories[2].items = new Array(pdmItems[21],pdmItems[22],pdmItems[23],pdmItems[24]);
pdmCategories[3].items = new Array(pdmItems[31],pdmItems[32],pdmItems[33],pdmItems[34],pdmItems[35],pdmItems[36],pdmItems[37],pdmItems[38],pdmItems[39],pdmItems[40]);


// 外部リンク用
function ExchangeWin3() {
win=window.open("/blog/","albero_blog","toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,width=900,height=800");
}

function ExchangeWin2() {
win=window.open("/albero_pro_furniture/index.html","albero_pro_furniture","toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,width=900,height=800");
}

function ExchangeWin() {
win=window.open("/antiquelumber/index.shtml","antiquelumber","toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,width=900,height=800");
}

function pdmObjInit(_stayObj) {
 if (_stayObj){
  if(_stayObj.indexOf('Item') != -1){
   pdmItemSwitch_lock(eval(_stayObj).parent);
  }
  pdmItemSwitch_lock(eval(_stayObj));
 }
  if(_stayObj.indexOf('Categories') != -1){
    if(eval(_stayObj).switchObject){
      eval(_stayObj).switchObject.visible=true;
    }
  }
 with (document) {
  write ('<div id="siteMenu">');
  write ('<table width="150" summary="*" border="0" cellpadding="0" cellspacing="0">');
  write ('<tr align="left" valign="top"><td nowrap>');
  for (i=0; i<pdmCategories.length; i++) pdmCategories[i].sourseOut();
  write ('</td></tr></table></div>');
 }
 pdmObject.loaded = true;
}

function pdmCategory(_id,_categoryId,_name,_alt,_url) {
 this.type = "category";
 this.id = _id;
 this.categoryId = _categoryId;
 this.name = _name;
 this.alt = _alt;
 this.href = documentRootPath + _url
 this.img = new imageClip(commonImagePath, _name);
 this.defaultImage = this.img.up;
 this.items = null;
 this.switchObject = null;
}

function pdmItem(_id,_parentId,_name,_alt,_url) {
 this.type = "item";
 this.id = _id;
 this.parent = pdmCategories[_parentId];
 this.name = _name;
 this.href = documentRootPath + _url
 this.alt = _alt;
 this.img = new imageClip(commonImagePath, _name);
 this.defaultImage = this.img.up;
 this.locked = false;
}

function pdmDispSwitch(_id,_name,_targetId) {
 this.id = _id;
 this.name = _name;
 this.targetId = _targetId;
 this.visible = false;
}

function imageClip(_path, _label) {
 this.up    = (new Image()).src = _path + _label + ".gif";
 this.over  = (new Image()).src = _path + _label + "o.gif";
 this.stay  = (new Image()).src = _path + _label + "s.gif";
}

function pdmDispSwitch_click(_obj) {
 if (!pdmObject.loaded) return;
 setDisplay(_obj.targetId);
 if (!_obj.visible) {
  swapImage(_obj.name, commonImagePath + "menu_a104c.gif");//クリック矢印四角
  _obj.visible = true;
 } else {
  swapImage(_obj.name, commonImagePath + "menu_a102c.gif");//クリック矢印四角
  _obj.visible = false;
 }
}

function pdmItemSwitch_lock(_obj) {
 pdmObject.stayId = _obj;
 _obj.locked = true;
 _obj.defaultImage = _obj.img.stay;
}

function pdmDispSwitch_over(_obj) {
 if (!pdmObject.loaded) return;
setBackgroundColorToId(_obj.targetId, "#FFFFFF")
 if (_obj.visible) {
  swapImage(_obj.name, commonImagePath + "menu_a104o.gif");//クリック矢印四角
 } else {
  swapImage(_obj.name, commonImagePath + "menu_a102o.gif");//クリック矢印四角
 }
}
function pdmDispSwitch_up(_obj) {
 if (!pdmObject.loaded) return;
 setBackgroundColorToId(_obj.targetId, "#FFFFFF")
 if (_obj.visible) {
  swapImage(_obj.name, commonImagePath + "menu_a104u.gif");//クリック矢印
 } else {
  swapImage(_obj.name, commonImagePath + "menu_a102u.gif");//クリック矢印四角
 }
}

function pdm_up(_obj) {
 if (!pdmObject.loaded) return;
 if (!_obj.locked) swapImage(_obj.name, _obj.img.up);
}
function pdm_over(_obj) {
 if (!pdmObject.loaded) return;
 if (!_obj.locked) swapImage(_obj.name, _obj.img.over);
}

function pdmDispSwitch_sourseOut() {
 with (document) {
  write ('<a href="#" onclick="pdmDispSwitch_click(pdmCategories[' + this.id + '].switchObject); return false;" onkeypress="pdmDispSwitch_click(pdmCategories[' + this.id + '].switchObject); return false;" onmouseover="pdmDispSwitch_over(pdmCategories[' + this.id + '].switchObject);" onmouseout="pdmDispSwitch_up(pdmCategories[' + this.id + '].switchObject);" onfocus="pdmDispSwitch_over(pdmCategories[' + this.id + '].switchObject);" onblur="pdmDispSwitch_up(pdmCategories[' + this.id + '].switchObject);">');
  write ('<img src="' + commonImagePath + 'menu_a102u.gif" alt="" name="' + this.name + '" width="19" border="0">');
  write ('</a><br>');
 }
 if (pdmObject.stayId != null && pdmObject.stayId.type == "item") {
  if (pdmObject.stayId.parent.categoryId + "-items" == this.targetId) {
   this.visible = true;
  }
 }
 tempTimer = setTimeout("setDisplay('"+this.targetId+"',"+this.visible+")",0);
}
pdmDispSwitch.prototype.sourseOut = pdmDispSwitch_sourseOut;

function pdmItem_sourseOut() {
 with (document) {
  write ('<a href="'+ this.href +'" onmouseover="pdm_over(pdmItems[' + this.id + ']);" onmouseout="pdm_up(pdmItems[' + this.id + ']);" onfocus="pdm_over(pdmItems[' + this.id + ']);" onblur="pdm_up(pdmItems[' + this.id + ']);">');
  write ('<img src="' + this.defaultImage + '" alt="' + this.alt + '" width="150" border="0" name="' + this.name + '"></a><br>');
 }
}
pdmItem.prototype.sourseOut = pdmItem_sourseOut;

function pdmCategory_sourseOut() {
 with (document) {
  write('<div id="category-' + this.categoryId + '" class="pdm-category">');
	
	if(this.href!=""){
    write ('<a href="' + this.href + '" onmouseover="pdm_over(pdmCategories[' + this.id + ']);" onmouseout="pdm_up(pdmCategories[' + this.id + ']);" onfocus="pdm_over(pdmCategories[' + this.id + ']);" onblur="pdm_up(pdmCategories[' + this.id + ']);">');
    write ('<img src="' + this.defaultImage + '" alt="' + this.alt + '"border="0" name="' + this.name + '">');
    write ('</a>');
	} else {
		write ('<img src="' + this.defaultImage + '" alt="' + this.alt + '"border="0" name="' + this.name + '">');
	}
	
  if (this.switchObject && (document.all || document.getElementById) && document.styleSheets) {
    this.switchObject.sourseOut();
  } else {
   write('');
  }
  if (this.items != null) {
   write('<div id="' + this.categoryId + '-items" class="pdm-Items">');
   write('');
   for (j=0; j<this.items.length; j++) this.items[j].sourseOut();
   write('');
   write('</div>');
  }
  write('</div>');
  write('<img src="' + commonImagePath + 'dot.gif" alt="" width="150" height="1"><br>');
 }
}
pdmCategory.prototype.sourseOut = pdmCategory_sourseOut;

function getBrouwserName() {
var ap = navigator.appName;
var ua = navigator.userAgent;
if (ap.indexOf("Microsoft Internet Explorer",0) != -1) return "Explorer";
if (ap.indexOf("Netscape",0) != -1) return "Netscape";
if (ap.indexOf("Opera",0) != -1) return "Opera";
if (ap.indexOf("iCab",0) != -1) return "iCab";
return "";
}

function preloadImg(imgName) {
 if (document.images) (new Image()).src = imgName;
}

function preloadimgApp(imgArray) {
 for (i=0; i<imgArray.length; i++) {
  preloadImg(imgArray[i]);
 }
}

function setObj(id) {
 if (document.all) {
  return document.all(id);
 } else if (document.getElementById) {
  return document.getElementById(id);
 } else if (document.layers) {
  return document.layers[id];
 }
 return false;
}

function setBackgroundColorToId(target,color) {
 var obj = setObj(target);
 if ((document.getElementById || document.all) && obj.style) {
  obj.style.backgroundColor = color;
 }
}

function swapImage(target,src) {
 document.images[target].src = src;
}

function setDisplay(target, str) {
 var obj = setObj(target);
 if ((document.getElementById || document.all) && obj.style) {
  if (str == null) str = ( obj.style.display == 'none' || obj.style.display == '') ? 1 : 0;
  obj.style.display = (str > 0) ? 'block' : 'none';
 }
}


