/*************************************************************** 
*                           Create popup                       *
****************************************************************/
		function createPopup(url, w, h) {
			var x = screen.availWidth;
			var y = screen.availHeight;
			var width = w;
			var height = h;
			var top = y/2-height/2;
			var left = x/2-width/2;
			pwin = window.open(url, "mypopup", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,top="+top+",left="+left+",width="+width+", height="+height);
    }
	
/*************************************************************** 
*                           Create popup for image              *
****************************************************************/
		function createPopupImg(url, w, h) {
			var x = screen.availWidth;
			var y = screen.availHeight;
			var width = w;
			var height = h;
			var top = y/2-height/2;
			var left = x/2-width/2;
			pwin = window.open(url, "mypopup", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top="+top+",left="+left+",width="+width+", height="+height);
    }
/*************************************************************** 
*                           Scroll content div                 *
****************************************************************/
/*-------------------------------------------------------------*
*														 Get offset top                    *
*--------------------------------------------------------------*/
    function getOffsetTop(el) {
      res = 0;
      while (el != document.body ) {
        res += el.offsetTop;
        el = el.offsetParent;
      }
      return res; 
    }
/*-------------------------------------------------------------*
*														 Get offset left                    *
*--------------------------------------------------------------*/
    function getOffsetLeft(el) {
      res = 0;
      while (el != document.body) {
        res += el.offsetLeft;
        el = el.offsetParent;
      }
      return res;
    }
/*-------------------------------------------------------------*
*														 Update height                     *
*--------------------------------------------------------------*/
    function updateheight() {
      if (document.getElementById) {
        if (document.getElementById("contentdiv")) {
          document.getElementById("contentdiv").style.position = "absolute";
          var h = getOffsetTop(document.getElementById("bottomlimiter")) - 90;
          if(h < 0){
          	h = 1;
          	document.getElementById("bottomlimiter").style.visibility = "hidden";
          } else {
          	document.getElementById("bottomlimiter").style.visibility = "visible";
          }
          document.getElementById("contentdiv").style.height = h + "px";
          document.getElementById("contentdiv").style.position = "static";
        }
      }
      window.onresize = updateheight;
    }
/*************************************************************** 
*                           Add bookmark                       *
****************************************************************/
function bookmark(anchor){
     if(window.external) {
         anchor.setAttribute('title', document.title);
         window.external.AddFavorite(location.href, anchor.getAttribute('title'));
     }
     return false;
}
