function displayPage(req)
{
	if (req.readyState == 4) 
	{
        if (req.status == 200) 
        {
			var cont= req.responseText;
			var cc= document.getElementById('contcontainer');
			var ca= document.getElementById('contentarea');
			try{cc.removeChild(ca)}catch(e){}
			cc.innerHTML= cont;
                        Effect.Appear('contentarea');
		}
	}
}

function bookMarkPage()
{
       var url= getBaseURL()+getURLFrag()+'index1.html?page='+ currentPage;
       window.location=url;
       return false;
}

function getBaseURL()
{
	return self.location.protocol+"//"+self.location.host;
}

function getURLFrag()
{
    return '/';
}

function loadImage(path,obj)
{
	var big= document.getElementById('dispimg');
	big.src=path;
	removeCaption();
	var img= obj.getElementsByTagName('img')[0];
	try
	{
		addCaption(img.title);	
	}catch(e){}
	
	return false;
}

function loadLargeImage(path)
{
var url= getBaseURL()+getURLFrag()+ path;
 var load = window.open(url,'imagewin',',height=550,width=670,top=25,left=250,scrollbars=no,menubar=no,resizable=yes,toolbar=no,location=no,status=no');
load.focus();

return false;
}

function addCaption(text)
{
	if(text != null && text != 'undefined')
	{
		var cap= document.getElementById('caption');
		cap.appendChild(document.createTextNode(text));
	}
}

function removeCaption()
{
	var cap= document.getElementById('caption');
	try{
		cap.normalize();
		cap.removeChild(cap.firstChild);
	}catch(e){}
}

function getImageYPos(){
      var obj = document.getElementById('hib');
      var posX = obj.offsetLeft;var posY = obj.offsetTop;
      while(obj.parentNode)
      {
          posX=posX+obj.parentNode.offsetLeft;
          posY=posY+obj.parentNode.offsetTop;
          if(obj==document.getElementsByTagName('body')[0]){break}
          else{obj=obj.parentNode;}
      }
      return posY;
} 


function getNewHttpRequest(req)
{
    if (window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	return req;
}

function getURL(url,func, req){
   // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest)
    {
        req.onreadystatechange =func;
        req.open("GET",url, true);
        req.send(null);

    }
 	else if (window.ActiveXObject) // branch for IE/Windows ActiveX version
 	{
		req.onreadystatechange =func;
		req.open("GET", url, true);
		req.send();
    }
}
