if (!document.getElementById && document.all) { 
	alert('not exists');
	document.getElementById = new Function('id', 'return document.all[id]') }

var allPopUps = new Array();

function browser_check() {
// ultimate browser sniffer
// portions copyright netscape communications

	this.agt = navigator.userAgent.toLowerCase();
	this.major = parseInt( navigator.appVersion );
	this.minor = parseFloat( navigator.appVersion );

// netscape detection
	this.ns =	(	( this.agt.indexOf( 'mozilla' ) != -1 ) &&	// mozilla YES
				( this.agt.indexOf( 'spoofer' ) == -1 ) &&	// spoofers NO
				( this.agt.indexOf( 'compatible' ) == -1) &&	// compatible (ie and so on) NO
				( this.agt.indexOf( 'opera' ) == -1 ) &&	// opera NO
				( this.agt.indexOf( 'webtv' ) == -1 ) );	// webtv NO

	this.ns2 =	( this.ns && ( this.major == 2 ) );			// netscape 2
	this.ns3 =	( this.ns && ( this.major == 3 ) );			// netscape 3
	this.ns4 =	( this.ns && ( this.major == 4 ) );			// netscape 4
	this.ns5 =	( this.ns && ( this.major == 5 ) );			// netscape 5
	this.ns6 =	( this.ns && ( this.major == 6 ) );			// netscape 6

	this.ie =	( this.agt.indexOf( 'msie' ) != -1);			// explorer
	this.ie3 =	( this.ie && ( this.major < 4 ) );			// explorer 3
	this.ie4 =	( this.ie && ( this.major == 4 ) &&			// explorer 4
				( ( this.agt.indexOf( 'msie 5.0' ) == -1 ) &&
				( this.agt.indexOf( 'msie 5.5' ) == -1 ) ) );
	this.ie5 =	( this.ie && 
			( this.major == 4 ) &&
				( this.agt.indexOf ('msie 5.0') != -1) );	// explorer 5
	this.ie55 =	( this.ie && 
			( this.major == 4 ) &&
				( this.agt.indexOf( 'msie 5.5' ) != -1 ) );	// explorer 5.5

	this.aol =	( this.agt.indexOf( 'aol' ) != -1 );			// aol browser
	this.aol3 =	( this.aol && this.ie3 );				// aol3
	this.aol4 =	( this.aol && this.ie4 );				// aol4
	this.aol5 =	( this.aol && this.ie5 );				// aol5

	this.opera =	( this.agt.indexOf( 'opera' ) != -1 );			// opera
	this.webtv =	( this.agt.indexOf( 'webtv' ) != -1 );			// webtv

	this.js;
	if		( this.ns2 || this.ie3 )					this.js = 1.0;
	else if		( this.ns3 || this.opera )					this.js = 1.1;
	else if		(	( this.ns4 && ( this.minor <= 4.05 ) ) || this.ie4 )	this.js = 1.2;
	else if		(	( this.ns4 && ( this.minor > 4.05 ) ) || this.ie5 )	this.js = 1.3;
	else if		( this.ns5 )							this.js = 1.4;
	else if		( this.ns && ( this.major > 5 ) )				this.js = 1.4;
	else if		( this.ie && ( this.major > 5 ) )				this.js = 1.3;
	else										this.js = 0.0;

	this.win =	(	( this.agt.indexOf( 'win' ) != -1 ) ||				// windows
				( this.agt.indexOf( '16bit' ) != -1 ) );
	this.win31 =	(	( this.agt.indexOf( 'windows 3.1' ) != -1 ) ||			// windows 3.1x
				( this.agt.indexOf( 'win16' ) != -1 ) ||
				( this.agt.indexOf( 'windows 16-bit' ) != -1 ) );
	this.win95 =	(	( this.agt.indexOf( 'win95' ) != -1 ) ||			// windows 95
				( this.agt.indexOf( 'windows 95' ) != -1 ) );
	this.win98 =	(	( this.agt.indexOf( 'win98' ) != -1 ) ||			// windows 98
				( this.agt.indexOf( 'windows 98' ) != -1 ) );
	this.winnt =	(	( this.agt.indexOf( 'winnt' ) != -1 ) ||			// windows nt
				( this.agt.indexOf( 'windows nt' ) != -1 ) );
	this.win2000 =	(	( this.agt.indexOf( 'winnt 5.0' ) != -1 ) ||			// windows 2000
				( this.agt.indexOf( 'windows nt 5.0' ) != -1 ) );
	this.win16 =	(	( this.agt.indexOf( 'win16' ) != -1 ) ||			// windows 16bit
				( this.agt.indexOf( '16bit' ) != -1 ) ||
				( this.agt.indexOf( 'windows 3.1' ) != -1 ) ||
				( this.agt.indexOf( 'windows 16-bit' ) != -1 ) );
	this.win32 =	(	this.win95 || this.winnt ||	this.win98 ||			// windows 32bit
			(	( this.major >= 4) &&
				( navigator.platform == 'Win32' ) ) ||
				( this.agt.indexOf( 'win32' ) != -1 ) ||
				( this.agt.indexOf( '32bit' ) != -1 ) );
	
	this.os2 =	(	( this.agt.indexOf('os/2')!=-1) ||				// os/2
				( navigator.appVersion.indexOf( 'OS/2' ) != -1 ) ||
				( this.agt.indexOf( 'ibm-webexplorer' ) != -1 ) );

	this.mac =		( this.agt.indexOf( 'mac' ) != -1 );				// mac
	this.mac68k =	( this.mac &&								// mac68k
			(	( this.agt.indexOf( '68k' ) != -1 ) ||
				( this.agt.indexOf( '68000' ) != -1 ) ) );
	this.macppc =	( this.mac &&								// mac powerpc
			(	( this.agt.indexOf( 'ppc' ) != -1 ) ||
				( this.agt.indexOf( 'powerpc' ) != -1 ) ) );

	this.linux =	( this.agt.indexOf( 'inux' ) != -1 );					// linux
	this.unix =	(	( this.agt.indexOf( 'inux' ) != -1 ) ||				// unix
				( this.agt.indexOf( 'sunos' ) != -1 ) ||
				( this.agt.indexOf( 'irix' ) != -1 ) ||
				( this.agt.indexOf( 'hp-ux' ) != -1 ) ||
				( this.agt.indexOf( 'aix' ) != -1 ) ||
				( this.agt.indexOf( 'sco' ) != -1 ) ||
				( this.agt.indexOf( 'unix' ) != -1 ) ||
				( this.agt.indexOf( 'ncr' ) != -1 ) ||
				( this.agt.indexOf( 'dec' ) != -1 ) ||
				( this.agt.indexOf( 'sinix' ) != -1 ) ||
				( this.agt.indexOf( 'bsd' ) != -1 ) );
	this.x11 =		( this.agt.indexOf( 'x11' ) != -1 );				// x11

	this.min =	( this.ns4 || this.ns5 || this.ie4 || this.ie5 || this.ie55);		// supported

	this.dom1 =	( this.ns5 );								// dom1 full support (mozilla)
	this.domns =	( this.ns4 );								// netscape 4 dom style
	this.domie =	( this.ie4 || this.ie5 || this.ie55 || this.aol4 || this.aol5 );	// iexplore 4 dom style

	this.lang =	( ( this.ns ) ? navigator.language : navigator.userLanguage ).substr( 0, 2 );	// check 4 language
	this.sublang =	( ( this.ns ) ? navigator.language : navigator.userLanguage ).substr( 3, 2 );
}

var _width = 0;
var _height = 0;

var is = new browser_check();



// Set Netscape up to run the "captureMousePosition" function whenever
// the mouse is moved. For Internet Explorer and Netscape 6, you can capture
// the movement a little easier.
if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position
        // reflects the position from the top/left of the screen the
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no
        // matter if the user has scrolled or not.
        if (document.body)
        {
	        xMousePos = window.event.x+document.body.scrollLeft;
	        yMousePos = window.event.y+document.body.scrollTop;
	        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
	        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
        }
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}



function showHide(elm) {
	if(elm.style.display=='none') {
		elm.style.display='block';
	} else {
		elm.style.display='none';
	}
}

function showHideById(elm_id) {
	elm = document.getElementById(elm_id);
	showHide(elm);
}

function get_scr_res() {
	_width = ( is.ns ) ? window.innerWidth + 4 : document.body.offsetWidth;
	_height = ( is.ns ) ? window.innerHeight + 4 : document.body.offsetHeight;
	if ( is.ns5 ) {
		_width -= 4;
		_height -= 4;
	}
}

function hide_all() {
	for (a = 0; a < allPopUps.length; a++) {
		hide_obj(allPopUps[a]);
	}
}

var hide_timer;

function show(myobj, sticky) {

	clearTimeout(hide_timer);
	hide_all();

	// Mozilla:
	if ( is.dom1 ) {
		document.getElementById( myobj ).style.visibility = 'visible';
		if (!sticky) {
			document.getElementById( myobj ).style.left= xMousePos + 'px';
			document.getElementById( myobj ).style.top = yMousePos + 'px';
		}
	}
	// Explorer:
	else if ( is.domie ) { 
		if (document.all[ myobj ] != null) {
			document.all[ myobj ].style.visibility = 'visible';
			if (!sticky) {
				document.all[ myobj ].style.left = xMousePos + 'px';
				document.all[ myobj ].style.top = yMousePos + 'px';
			}
		}
    }
	// Netscape:
	else if ( is.domns ) {
		document.layers[ myobj ].visibility = 'show';
		if (!sticky) {
			document.layers[ myobj ].left = xMousePos + 'px';
			document.layers[ myobj ].top = yMousePos + 'px';
		}
	}
	
	if (!sticky) {
		hide(myobj);
	}
}

function hide(myobj) {
	hide_timer = setTimeout( 'hide_obj("' + myobj + '")', 1000 );
}

function hide_obj(myobj) {
	// Mozilla:
	if ( is.dom1 ) document.getElementById( myobj ).style.visibility = 'hidden';
	// Explorer:
	else if ( is.domie ) { 
		if (document.all[ myobj ] != null) 
			document.all[ myobj ].style.visibility = 'hidden';
	}
	// Netscape:
	else if ( is.domns ) document.layers[ myobj ].visibility = 'hide';
}

var popup_offset = 0;
function move_popups_to_pos() {
	offset = 335 + popup_offset;
	get_scr_res();
	left = _width / 2 > 430 ? _width / 2 : 430;
	//window.status=left;
	left_str = left + 'px';
	width_str = '250px';

	for (a = 0; a < allPopUps.length; a++) {
		if (showPopUp[a] == false) {
			continue;
		}
		
		// Mozilla:
		if ( is.dom1 ) {
			offset_str = (offset - 5) + 'px';
			document.getElementById( allPopUps[a] ).style.top = offset_str;
			document.getElementById( allPopUps[a] ).style.left = left_str;
			document.getElementById( allPopUps[a] ).style.width = width_str;
		}
		// Explorer:
		else if ( is.domie ) { 
			offset_str = offset + 'px';
			if (document.all[ allPopUps[a] ] != null) {
				document.all[ allPopUps[a] ].style.top = offset_str;
				document.all[ allPopUps[a] ].style.left = left_str;
				document.all[ allPopUps[a] ].style.width = width_str;
			}
		}
		// Netscape:
		else if ( is.domns ) {
			offset_str = offset + 'px';
			document.all[ allPopUps[a] ].top = offset_str;
			document.all[ allPopUps[a] ].left = left_str;
			document.all[ allPopUps[a] ].width = width_str;
		}

		offset += 12;
	}
}

var img_deselect_out = new Image();
var img_deselect_over = new Image();
var img_select_out = new Image();
var img_select_over = new Image();
function preload_images() {
	img_deselect_out.src = '/blh/dev/images/design/check_ff.gif';
	img_deselect_over.src = '/blh/dev/images/design/check_fo.gif';
	img_select_out.src = '/blh/dev/images/design/check_of.gif';
	img_select_over.src = '/blh/dev/images/design/check_oo.gif';
}

function over(img) {
	if (img.src == img_deselect_out.src) {
		img.src = img_deselect_over.src;
	} else if (img.src == img_select_out.src) {
		img.src = img_select_over.src;
	}
}

function out(img) {
	if (img.src == img_deselect_over.src) {
		img.src = img_deselect_out.src;
	} else if (img.src == img_select_over.src) {
		img.src = img_select_out.src;
	}
}

function desel_radio(input, all_images) {
	for (a = 0; a < all_images.length; a++) {
		all_images[a].src = img_deselect_out.src;
	}
	input.value = -1;
}

function radio(img, value, input, all_images) {
	for (a = 0; a < all_images.length; a++) {
		all_images[a].src = img_deselect_out.src;
	}
	img.src = img_select_out.src;
	input.value = value;
}

function checkbox(img, input, checked) {
	if (checked == 0) {
		input.value = '1';
	} else if (checked == 1) {
		input.value = '0';
	}
	
//	alert(img.src + ' (pre): ' + input.value);
	
	if (input.value == '1') {
		input.value = '0';
		img.src = img_deselect_out.src;
	} else {
		input.value = '1';
		img.src = img_select_out.src;
	}
//	alert(img.src + ' (post): ' + input.value);
}

function my_onResize() {
	move_popups_to_pos();
}

function popup_img(img_name, width, height, caption, alt) {
	popup('/blh/dev/includes/minisites/popup_img.php?img=' + img_name + '&width=' + width + '&height=' + height + '&caption=' +caption + '&alt=' + alt, 'img_detail', width, height);
}

function popup(url, name, width, height) {
	//child = window.open(url,name,'none,scrollbars=no,width=1,height=1');
	var top  = (screen.height-height)/2;
	var left = (screen.width-width)/2;
	child = window.open(url,name,'none,scrollbars=no,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left);
//	child.moveTo((screen.width-width)/2, (screen.height-height)/2);
//	child.resizeTo(width, height);
//	child.focus();
}

function popup_scrollbar(url, name, width, height) {
	//child = window.open(url,name,'none,scrollbars=no,width=1,height=1');
	var top  = (screen.height-height)/2;
	var left = (screen.width-width)/2;
	child = window.open(url,name,'none,scrollbars=yes,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left);
//	child.moveTo((screen.width-width)/2, (screen.height-height)/2);
//	child.resizeTo(width, height);
//	child.focus();
}

function highlight_node(node_prefix, node_number, has_children)
{
//	alert(node_prefix + node_number);
	var node = document.getElementById(node_prefix + node_number);
	node.style.background = '#f47c1f';
	
	if (has_children) {
		var child = document.getElementById('ch_' + node_prefix + node_number);
		child.style.border = '1px solid #f47c1f';
	}
}

function fade_node(node_prefix, node_number, has_children, node_level)
{
	var node = document.getElementById(node_prefix + node_number);
	
	if (has_children) {
		if (node_level == 1) {
			node.style.background = '#333333';
		}
		if (node_level == 2) node.style.background = '#a8a6a7';
		if (node_level == 3) node.style.background = '#d7d7d7';
		
		if (node_level == -1) node.style.background = '#eeeeee';
		
		var child = document.getElementById('ch_' + node_prefix + node_number);
		child.style.border = '1px solid #dddddd';
	} else {
		if (node_level == -1) node.style.background = '#ffffff';
		else node.style.background = '#eeeeee';
	}
}

function changeArrow(){
		for (var i=0; i<changeArrow.arguments.length; i+=3) {
			if (document[changeArrow.arguments[i]] != null)
			{
				var str=document[changeArrow.arguments[i]].src;
				if (str.indexOf(changeArrow.arguments[i+2]) != -1) document[changeArrow.arguments[i]].src = changeArrow.arguments[i+1];
				if (str.indexOf(changeArrow.arguments[i+1]) != -1) document[changeArrow.arguments[i]].src = changeArrow.arguments[i+2];
			}
			
	}
}