function set_opacity( elm, val ) {

	elm.style.opacity = val;
	elm.style.MozOpacity = val;
	elm.style.KhtmlOpacity = val;
	elm.style.filter = 'alpha(opacity=' + ( val * 100 ) + ')';

} //end function

function open_popup( src, w, h ) {
	
	var center_x =  document.body.clientWidth / 2;
	var center_y =  document.body.offsetHeight / 2;
	var left = parseInt( center_x - ( w / 2 ) - 8, 10 );
	var top =  parseInt( center_y - 40 - ( h / 2 ), 10 );
	//var top = 90;

	set_opacity( $('page_fade'), 0 );	
	$('page_fade').style.display = 'block';	

	$('popup_container').style.left = left + 'px';
	$('popup_container').style.top = top + 'px';
	$('popup_container').style.width = w + 'px';
	$('popup_container').style.height = h + 'px';
	
	//firefox mac bug
	if( is_mac && is_gecko && $('testimonials') ) $('testimonials').style.visibility = 'hidden';	

	new Ajax.Updater('popup_container_txt', src, { asynchronous: true });

	window.scrollTo( 0, 0 );

	if( is_ie ) { //ie sucks!
		var select_boxes = document.getElementsByTagName('select');
		for( var i=0; i<select_boxes.length; i++ ) select_boxes[i].style.visibility = 'hidden';
	}

	new Effect.Opacity( 'page_fade', { duration: .5, from: 0.0, to: 0.4 } );
	setTimeout( "$('popup_container').style.display = 'block'", 400 );

} //end function

function close_popup() {

	$('popup_container').style.display = 'none';	
	new Effect.Opacity( 'page_fade', { duration: .4, from: 0.4, to: 0 } );
	setTimeout( function() {
						 
		$('page_fade').style.display = 'none';

		if( is_ie ) { //ie sucks!
			var select_boxes = document.getElementsByTagName('select');
			for( var i=0; i<select_boxes.length; i++ ) select_boxes[i].style.visibility = 'visible';
		}

		//firefox mac bug
		if( is_mac && is_gecko && $('testimonials') ) $('testimonials').style.visibility = 'visible';	

	}, 400 );

} //end function