function show_card()
{
	var div = document.createElement('div');
	div.innerHTML = '<p>123</p>';
	document.getElementsByTagName('body')[0].appendChild(div);
}
show_card();

function open_window(page_url, page_name, window_width, window_height, scrollbar_value, is_center)
{

    var window_pos_x = 20;
    var window_pos_y = 20;

    if (is_center == 'yes')
    {
        window_pos_x = (screen.width / 2) - (window_width / 2);
        window_pos_y = (screen.height / 2) - ((window_height / 2) + 20);
    }

    popup_window = this.open(page_url, page_name, "toolbar=no,status=no,menubar=no,location=no,scrollbars=" + scrollbar_value + ",resizable=no,width=" + window_width + ",height=" + window_height + ",screenX=" + window_pos_x + ",screenY=" + window_pos_y + ",left=" + window_pos_x + ",top=" + window_pos_y);
    popup_window.focus();

}

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

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

    return true;
}

function checkBoxes (the_form) {
	var flag = 0;
	var elts = document.forms[the_form].elements['id[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
          if (elts[i].checked==true) { flag=1; }
        }
    } else {
        if (elts.checked==true) { flag=1; };
    }

	if (flag==1)
	{
		return true;
	}
	else {
		alert("Не отмечено ни одной записи!");
		return false;
	}

}

function openPrintWin(the_form) {
	var tgt = document.forms[the_form].target;
	var act = document.forms[the_form].action;	
	open_window('/notepad_print.php','noteprint','400','400','yes','yes');
	document.forms[the_form].target='noteprint';
	document.forms[the_form].action='/notepad_print.php';
	document.forms[the_form].submit();
	document.forms[the_form].target=tgt;
	document.forms[the_form].action=act;	
}

function recName(the_form, title) {
	var newWindowFeatures="dependent=1,Height=125,Width=250,top=200,left=300"; 
	var board=window.open("","InsertTable",newWindowFeatures); 
	board.document.open(); 
	board.document.write("<html><head><title>Присвойте имя новой записи в блокноте</title><link rel=stylesheet type=text/css href=/npcom.css><script language=JavaScript>	var opnr = window.opener.document.forms['"+the_form+"']; function setRTitle(the_form) { opnr.elements['title'].value = the_form.elements['recname'].value; opnr.submit(); window.close(); } </script></head><body>"); 
	board.document.write("<p align=center><b>Имя новой записи в блокноте:</b><br><form name=form2 action=/notepad/ onSubmit='setRTitle(this);'><input type=text name=recname size=25 value='"+title+"'><br><input type=submit value=Присвоить></form></p>"); 
	board.document.write("</body></html>");
	board.document.close();
	return false;
}

function sendEmail(obrBtnSend) {
    if (strrEmail = document.getElementById('inSendEmail').value) {
        JsHttpRequest.query(
            '/sendemail.php',
            {form: obrBtnSend.form},
            function(responseJS, responseText) {
                if (responseJS) alert(responseJS.message);
                document.getElementById('debug').innerHTML = responseText;
            },
            false
        );
    } else {
        alert('E-mail адрес не указан.');
    }
}

