function description_picture(id, width, height, alt, section)
{
    if(id == "" || id == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width-width)/2;
    wy = (screen.height-height)/2;

    wx = 0;
    wy = 0;

    wnd=window.open("/images/popup_description_picture.php?id="+id+"&width="+width+"&height="+height+"&alt="+alt+"&section="+section, "_blank", "width="+(width+50)+",height="+(height+120)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}

function guide_gallery_picture(id, width, height)
{
    if(id == "" || id == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width-width)/2;
    wy = (screen.height-height)/2;

    wx = 0;
    wy = 0;

    wnd=window.open("/guide/popup_gallery_picture.php?id="+id+"&width="+width+"&height="+height, "_blank", "width="+(width+60)+",height="+(height+135)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}

function picture(id, width, height)
{
    if(id == "" || id == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width-width)/2;
    wy = (screen.height-height)/2;

    wx = 0;
    wy = 0;

    wnd=window.open("/images/popup_description_picture.php?id="+id+"&width="+width+"&height="+height, "_blank", "width="+(width+50)+",height="+(height+70)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}

function school_lesson_picture(id, width, height)
{

    if(id == "" || id == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width-width)/2;
    wy = (screen.height-height)/2;

    wx = 0;
    wy = 0;

    wnd=window.open("/school/lesson_popup_picture.php?id="+id+"&width="+width+"&height="+height, "_blank", "width="+(width+50)+",height="+(height+70)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}

function std_popup_picture(url,width,height)
{
    if(url == "" || url == null) {
		return;
	}

	wx = (screen.width-300)/2;
    wy = (screen.height-300)/2;
    wnd=window.open("/images/popup_picture.php?url="+url, "_blank", "width="+(width+50)+",height="+(height+70)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}

function school_report_picture(url,width,height,workname,username)
{
    if(url == "" || url == null) {
		return;
	}

	wx = (screen.width-300)/2;
    wy = (screen.height-300)/2;
    wnd=window.open("/school/report_popup_picture.php?url="+url+"&username="+username+"&workname="+workname, "_blank", "width="+(width+50)+",height="+(height+70)+",status=no,resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}


function admin_popup_window(url, width, height) {

    if(url == "" || url == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width / 2) - (width / 2);
    wy = (screen.height / 2) - (height / 2);

    wnd=window.open(url, "_blank", "width="+(width+20)+",height="+(height+30)+",resizable=1,scrollbars=1,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);

}



function std_popup_window(url, width, height) {

    if(url == "" || url == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width / 2) - (width / 2);
    wy = (screen.height / 2) - (height / 2);

    wnd=window.open(url, "_blank", "width="+(width+20)+",height="+(height+30)+",resizable=1,scrollbars=1,toolbar=no,menubar=no,screenX="+wx+",screenY="+wy);

}



/* не стирать эту функцию - нужна везде где есть якоря!!! */
function goTo(where) {
	document.location.replace(where);
	return false;
}




function popup_image(url, w, h, nocache) {

	wWidth = w + 50;
	wHeight = h + 100;
	if (wWidth > screen.width) wWidth = screen.width - 100;
	if (wHeight > screen.height) wHeight = screen.height - 200;

	wnd=window.open("", "imgWin", 'width=' + wWidth + ',height=' + wHeight + ',resizable=1,scrollbars=1,toolbar=no,menubar=no');
	wnd.document.write('<html><head><title>Просмотр оригинального изображения</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251">');
	if ( nocache == 'nocache' ) {
		wnd.document.write('<meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Pragma" content="no-cache">');
	}
	wnd.document.write('<link rel="StyleSheet" type="text/css" href="/club.css" /></head><body>');
	wnd.document.write('<div align="center" class="mediumtext"><br /><a href="javascript:window.close();">');
	wnd.document.write('<img id="orImage" src="' + url + '" width="' + w + '" height="' + h + '" border="0" alt="" />');
	wnd.document.write('<br /><br />Закрыть окно</a>');
	wnd.document.write('</div>');
	wnd.document.write('</body></html>');
	wnd.document.close();
	wnd.focus();

}


function closePopupAndReloadOpener() {

	with (window) {
		opener.location.reload();
		opener.focus();
		close();
	}

}


function closePopupAndGoURL(sURL) {
	window.opener.location.href = sURL;
	window.opener.focus();
	window.close();
}



function setCheckboxes(the_form, do_check)
{
	var elts = document.forms[the_form].elements['items[]'];
	var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
	var do_check;

	if (elts_cnt) {
		for (var i = 0; i < elts_cnt; i++) {
			elts[i].checked = do_check;
		} // end for
	} else {
		elts.checked        = do_check;
	} // end if... else

	return true;
}
