
<!--HPB_SCRIPT_SITEMENU_11
//
//  JavaScript
//
//  Licensed Materials - Property of IBM
//
//  5724I83
//
//  (C) Copyright IBM Corp. 1995, 2006 All Rights Reserved.
//
var hpb=new Object();
	hpb.ContentLoader=function(url, divId, onload) {
	this.url = url;
	this.divId=divId;
	this.request=null;
	this.onload=onload;
	this.onerror=this.defaultError;
	this.loadSiteMenu(url);
}
hpb.ContentLoader.prototype={
	loadSiteMenu:function(url){
		if(window.ActiveXObject) {
			// IE
			try {
				this.request = new ActiveXObject ("Msxml2.XMLHTTP");
			} catch(e) {
				this.request = new ActiveXObject ("Microsoft.XMLHTTP");
			}
		} else 
		if(window.XMLHttpRequest) {
			// non-IE
			this.request = new XMLHttpRequest();
		}
		if(this.request) {
			try{
				var loader=this;
				this.request.onreadystatechange=function(){
					loader.onReadyState.call(loader);
				}
				this.request.open('GET',url+"?cache="+(new Date()).getTime(), true);
				this.request.send(null);
			}catch( err) {
				this.onerror.call(this);
			}
		}
	},
	onReadyState:function(){
		var request = this.request;
		var readyState = request.readyState;
		if(readyState==4){
			var httpStatus=request.status;
			if(httpStatus==200 || httpStatus == 0) {
				this.onload.call(this);
			}else{
				this.onerror.call(this);
			}
		}
	},
	
	defaultError:function() {
		alert("サイト共通メニューの読み込みに失敗しました。\nメニューID : "+this.divId);
	}
}	
  
function getMenu(){
	document.getElementById(this.divId).innerHTML = this.request.responseText;
}

function getHpbSiteMenu(menuURL, divId) {
	var loader=new hpb.ContentLoader(menuURL, divId, getMenu);
	
}
//-->

