// ######### DHTML library #########

// browser sniffer
var ns6 = false;
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var opera = (window.opera)? true:false;
var mac = 	((navigator.appVersion.indexOf('Mac') != -1) || (navigator.appVersion.indexOf('PowerPC') != -1))? true:false;
if (ns4 == ie4 && opera == false) {
	ns6 = true;
	ie4 = ns4 = false;
}
var safari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false;

// initialise & return a layer object
function d_init_layer(name) {
	if (ie4) return eval(_proxy_jslib_proxify_js((name+'.style'), 0, 0) );
	if (ns6) return eval(_proxy_jslib_proxify_js(('document.getElementById("'+name+'").style'), 0, 0) );
}

// switch object visibility on
function d_show_object(obj) {
	obj.visibility = 'visible';
}

// switch object visibility off
function d_hide_object(obj) {
	obj.visibility = 'hidden';
}

// move object to a certain coordinate
function d_move_object(obj,x,y) {
	obj.left = x + 'px';
	 _proxy_jslib_assign('', obj, 'top', '=', ( y + 'px'));
}

// write layer content (lay is layer name)
function d_write_layer(lay,txt) {
	if (ie4) {
		 _proxy_jslib_assign('',  _proxy_jslib_handle(document.all, (lay), 0, 0), 'innerHTML', '=', ( txt));
	}
	if (ns6) {
		over =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)([lay]);
		range = document.createRange();
		range.setStartBefore(over);
		domfrag = range.createContextualFragment(txt);
		while (over.hasChildNodes()) {
			over.removeChild(over.lastChild);
		}
		over.appendChild(domfrag);
	}
}

// create new layer
function d_make_layer(lay,classn,x,y,w,h,bgcolor,visible,z) {
	if(document.createElement){ 
		var el = document.createElement("DIV"); 
		if (lay != '') {
			el.id = lay;
		}
		if (classn != '') {
			el.className = classn;
		}
		{var _proxy_jslib_with_objs= [] ;with(_proxy_jslib_with_objs[_proxy_jslib_with_objs.length]= (el.style)){
			position = 'absolute';
			left = x + 'px';
			 top= _proxy_jslib_with_assign_rval(_proxy_jslib_with_objs, '', 'top', '=', ( y + 'px'), top);
			if (w != null) {
				width = w + 'px';
			}
			if (h != null) {
				height = h + 'px';
			}
			if (bgcolor != null) {
				backgroundColor = bgcolor;
			}
			if (visible) {
				visibility = 'visible';
			} else {
				visibility = 'hidden';
			}
			if (z != null) {
				zIndex = z;
			}
		}; _proxy_jslib_with_objs.length-- ;} 
		 _proxy_jslib_handle(document, 'body', '', 0, 0).appendChild(el); 
	}
}


// ######### DHTML library auxiliary functions #########

// layer opacity function
function d_change_opac(opacity, id) {
	var object =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
} 

// return the height of a layer in pixels - needs layer name
function d_layer_height(lay) {
	if(ie4 && !opera) return eval(_proxy_jslib_proxify_js((lay+'.clientHeight'), 0, 0) );
	if(ns6) return eval(_proxy_jslib_proxify_js(('document.getElementById("'+lay+'").offsetHeight'), 0, 0) );
	if(opera) return eval(_proxy_jslib_proxify_js((lay+'.style.pixelHeight'), 0, 0) );
}

// browser window width
function get_winwidth() {
	if (ie4 && !opera) {
		return  _proxy_jslib_handle(document, 'body', '', 0, 0).offsetWidth;
	} else {
		return window.innerWidth;
	}
}

// browser window height
function get_winheight() {
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if(  _proxy_jslib_handle(document, 'body', '', 0, 0) && (  _proxy_jslib_handle(document, 'body', '', 0, 0).clientWidth ||  _proxy_jslib_handle(document, 'body', '', 0, 0).clientHeight ) ) {
		//IE 4 compatible
		myHeight =  _proxy_jslib_handle(document, 'body', '', 0, 0).clientHeight;
	}
	return myHeight;
}

// vertical scroll position
function get_scroll_y() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if(  _proxy_jslib_handle(document, 'body', '', 0, 0) && (  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollLeft ||  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop ) ) {
    //DOM compliant
    scrOfY =  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}


// ######### mouse event handler #########

// save mouse coordinates whenever the mouse moves
var mouse_x = 0;
var mouse_y = 0;
function save_mouse_coords(e) {
   if(e) {
      if( typeof( e.pageX ) == 'number' )
      {
         mouse_x = e.pageX;
         mouse_y = e.pageY;
      }
      else
      {
         mouse_x = e.clientX;
         mouse_y = e.clientY;
      }
   } else {
      e = window.event;
      mouse_x = e.clientX;
      mouse_y = e.clientY;
      if( document.documentElement
 && ( document.documentElement.scrollTop
 || document.documentElement.scrollLeft ) )
      {
         mouse_x += document.documentElement.scrollLeft;
         mouse_y += document.documentElement.scrollTop;
      } 
      else if ( _proxy_jslib_handle(document, 'body', '', 0, 0) && (  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop ||  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollLeft ) ) {
         mouse_x +=  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollLeft;
         mouse_y +=  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop;
      }
	}
}


 ;
_proxy_jslib_flush_write_buffers() ;