var ie = ( navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1 ) ? 1 : 0;

function wopen( url, target, w, h, asize, title, res ) 	{
	if( !url ) {
		event.cancelBubble = true;
		event.returnValue = false;
		return;
	}
	if( !target ) target = '_blank';
	if( !w ) w = 500;
	if( !h ) h = 400
	if( !title ) title = '';

	w = parseInt( w, 10 );
	h = parseInt( h, 10 );
	if( asize ) asize = true;
	else asize = false;

	var aw = screen.availWidth;
	var ah = screen.availHeight;
	if( w > aw ) w = aw;
	if( h > ah ) h = ah;

	if( res )r = 0; else r = 1;

	var left = Math.round( ( aw - w ) / 2 );
	var top = Math.round( ( ah - h ) / 2 );

	var wd = window.open( url, target, 'channelmode= 0, directories=0, fullscreen=0, height='+h+'px, width='+w+'px, location=0, menubar=0, resizable='+r+', scrollbars=1, status=0, toolbar=0, top='+top+'px, left='+left+'px' );
	if ( !asize ) { return; }

	if( url.indexOf( window.location.host ) != -1 || url.indexOf( 'http://' ) == -1  ) wd.attachEvent( "onload", function() {resize_new_win( wd, asize, title )	} );
}

//#########################################################

function go( url ) {
	if ( url ) {
		top.location.href = url;
	}
}

//#########################################################

function winfull( url, target ) {
	if ( !url ) { return false; }

	if ( !target ) { target = '_blank'; }
    var wd = window.open( url, target, 'fullscreen=1, scrollbars=1, toolbar=0' );
}

//##########################################################

function pop( url, w, h, mod ) {
	if( !url ) return;
	var last = url.lastIndexOf( "/" );
	url = url.substring( 0, last );
	last = url.lastIndexOf( "/" );
	url = url.substring( last+1, last+10 );
	
	go( HOME + "?cid=4&id=1&block="+url )
}

