function win(path,pic_width,pic_height, win_scroll, win_toolbar )
{
	pic_width  = pic_width || 600; 
	pic_height  = pic_height || 400; 
	win_toolbar  = win_toolbar || 'no'; 
	win_scroll  = win_scroll || 'no'; 
	rand_var = rand( 1, 10000 );
	var result=rand_var.toString();
	
var NewWin=window.open("",result,'width='+pic_width+',height='+pic_height+',resizable=yes,menubar='+win_toolbar+',toolbar='+win_toolbar+',scrollbars='+win_scroll+',status=no,location=no');
NewWin.document.open();
NewWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
NewWin.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><title>Галерея</title></head><body style="margin:0px;padding:0px">');
NewWin.document.write('<a href="javascript:self.close()"><img src="'+path+'" border=0></a>');
NewWin.document.write('</body></html>');
NewWin.document.close();
}

function site_win(url,pic_width,pic_height, newwin, win_scroll, win_toolbar ) 
{
	pic_width  = pic_width || 600; 
	pic_height  = pic_height || 400; 
	win_toolbar  = win_toolbar || 'no'; 
	win_scroll  = win_scroll || 'no'; 
	newwin = newwin || 0;

	if (newwin) {
		winname = (Math.floor(Math.random()*1000) ).toString();
	} 
	else 
		winname = 'default';

	var NewWin=window.open(url, winname,'width='+pic_width+',height='+pic_height+',resizable=yes,menubar='+win_toolbar+',toolbar='+win_toolbar+',scrollbars='+win_scroll+',status=no,location=no');
	
}

function rand( min, max ) {    // Generate a random integer
    // 
    // +   original by: Leslie Hoare
 
    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
