var Loaded = 0;
var details_window = false;
var image_details_window = false;
	
function showFileDetails( id, width, height ) {
	
	if( image_details_window ) {
		image_details_window.close();
		image_details_window = false;
	}
	
	win_url = base_url + lang + '.php/0;details;file;file_id;' + id;
	win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
	win_width = width;
	win_height = height;
		
	win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
	win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
		
	curr_window = window;
	
	image_details_window = curr_window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");

}

function showImageDetails( id, width, height ) {
	
	if( image_details_window ) {
		image_details_window.close();
		image_details_window = false;
	}
	
	win_url = base_url + lang + '.php/0;details;image;image_id;' + id;
	win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
	win_width = width;
	win_height = height;
		
	win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
	win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
		
	curr_window = window;
	
	image_details_window = curr_window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");

}

function showDetails( id ) {
	
	if( details_window ) {
		details_window.close();
		details_window = false;
	}
		
	win_url = base_url + lang + '.php/' + id + ';details;main';
	win_rnd = ( Math.round( ( Math.random() * 999 ) + 1 ) );
	win_width = 500;
	win_height = 450;
		
	win_top = Math.round( ( screen.availHeight - win_height ) / 2 );
	win_left = Math.round( ( screen.availWidth - win_width ) / 2 );
		
	curr_window = window;
	
	details_window = curr_window.open(win_url, "w"+win_rnd, "top=" + win_top +  ",left=" + win_left + ",width="+win_width+",height="+win_height+",buttons=0,scrollbars=0,location=0,menubar=0,resizable=1,status=0,directories=0,toolbar=0");
}
	
function changePos() {
	
	if( Loaded ) {
	
		if( fadeTimeout ) {
			clearTimeout( fadeTimeout );
		}
	
		client_height = getClientY();
		client_width = getClientX();
	
		scroll_height = getScrollY();
		scroll_width = getScrollX();
	
		height = 180;
		width = 180;
	
		x = ( ( client_width - width  + scroll_width ) > 640 ) ? ( client_width - width  + scroll_width ) : 640;
	
		setVis( 'div_logo', false );
	
		setPos( 'div_logo', x , client_height - height + scroll_height );
	
		fade( 'div_logo', 0, 100, 10, 100, '' );
	
	}

}

window.onload 	= function() {
	Loaded = 1;
	changePos();
}

window.onresize = changePos;
window.onscroll = changePos;