/*______________________________________

  equipmentoutline.js #080409
  
  Script written by Mahiro Komura <mahirok@mizuyari.jp>
  http://mizuyari.jp/
______________________________________*/

var equipmentOutline;
mizuyari.addCSS("/shared/styles/components/mizuyari.css");
mizuyari.addOnLoadEvent(mizGlobal_equipmentOutlineAppInit);

function mizGlobal_equipmentOutlineAppInit() {
 var floor = getUrlParam( location.search, "f", null );
 if( ! document.getElementById ) return;
 if(floor != null) {
  equipmentOutline = new equipmentOutlineApp("equipmentOutline", floor + "f");
 } else {
  equipmentOutline = new equipmentOutlineApp("equipmentOutline");
 }
}

function equipmentOutlineApp (self, floor) {
 this.self = 'window.' + self;
 this.items  = null;
 this.ready = true;
 this.activeItemSetId = null;
 if (!floor) floor = "1f";
 this.modifyActiveItemSet(floor); 
}

equipmentOutlineApp.prototype = {

modifyActiveItemSet : function(itemSetId) {
 if (this.activeItemSetId != null) {
  mizuyari.removeClass(miz$('floor-' + this.activeItemSetId),'active');
  mizuyari.removeClass(miz$('lm-' + this.activeItemSetId),'active');
 }
 this.activeItemSetId = itemSetId;
  mizuyari.addClass(miz$('floor-' + this.activeItemSetId),'active');
  mizuyari.addClass(miz$('lm-' + this.activeItemSetId),'active');
}

}

function getUrlParam( url, name, value ) {
 var pos_s = url.indexOf( name + "=" );
 if( pos_s < 0 ) return value;
 var url = url.substring( pos_s + name.length + 1 );
 var pos_e = url.indexOf( '&' );
 if( pos_e < 0 ) return decodeURIComponent( url );
 return decodeURIComponent( url.substring( 0, pos_e ));
}
// via: http://yamachan-cs.blogspot.com/2007/01/js-url.html
