/*
*	swfUtils ver. 1.02
*	author: Radoslaw Krzepkowski , email: me@krzepa.com , www: http://krzepa.com
*/

function swfUtils_fixResizing( divID, minWidth, minHeight ) {
	
	var _div = document.getElementById( divID );

	_div.style.minWidth = minWidth + 'px';
	_div.style.minHeight = minHeight + 'px';	

	var _flash = _div.getElementsByTagName( 'embed' )[0];
	if( !_flash ) _flash = _div.getElementsByTagName( 'object' )[0];

	var ieFixVer = /Microsoft/.test( navigator.appName ) && ( parseInt( navigator.appVersion.split('MSIE ')[1] ) < 7 );
	var operaFixVer = /Opera/.test( navigator.appName );
	var safariFixVer = /AppleWebKit/.test( navigator.userAgent );

	var _body;
	
	if( document.compatMode == 'CSS1Compat' ) { 
		_body = document.body.parentNode;
		document.body.style.overflow = 'visible';
	} else {
		_body = document.body;
	}	

	var fixSWFResizing;
	
	if( ieFixVer || operaFixVer ) {
		
		fixSWFResizing = function( e ) {

			clearTimeout( arguments.callee.timID );

			if( e ) {
				arguments.callee.timID = setTimeout( arguments.callee , 200 );
				return;
			} 
			
			if( _body.clientHeight < minHeight ) {
				_div.style.height = minHeight + 'px';
				_body.style.overflowY = 'scroll';
			} else {
				_div.style.height = '100%';
				_body.style.overflowY = 'auto';
			}
			if( _body.clientWidth < minWidth ) {
				_div.style.width = minWidth + 'px';
				_body.style.overflowX = 'scroll';
			} else {
				_div.style.width = '100%';
				_body.style.overflowX = 'auto';
			}

		}
		
		window.attachEvent( 'onresize' , fixSWFResizing );
		
		fixSWFResizing();
		
	} else if( safariFixVer ) {
		
		fixSWFResizing = function( e ) {

			_flash.style.height = '100%';

			if( _body.scrollHeight > _body.clientHeight ) {
				
				_flash.style.height = _body.scrollHeight + 'px';
				
			}
			
			
		}
		
		addEventListener( 'resize' , fixSWFResizing );
		
		fixSWFResizing();
		
	}
	

}

function swfUtils_setFocus( swfID ) {

	var swf = document.getElementById( swfID );
	
	if( swf.focus ) {
		swf.focus();
	}
	
}


function swfUtils_callNoHttpProtocol() {
	
	var win;
	var str = arguments[0];
	
	if( str.indexOf( 'javascript:' ) == 0 ) {
		
		eval( str.substr(11) );
		
	} else {
		
		win = window.open( str , 'win' , '' );

		win.close();
		
	}

}

