function NewWindow(page, name, w, h, location, scroll) {
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',location='+location+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
        win = window.open(page, name, winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    	}
var nam;
var nam_1=null;//=window.close,canClose = window.opener;
function dok(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=no,resizable=yes");
	nam.focus();
}
function dok_yes(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	nam.focus();
}
function dok_yes_yes(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=yes,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	nam.focus();
}
function tops(h,w){
	if (navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else {
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
}

function openwindow(fname)
{
window.open(fname, 'newWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbars=0, Resizable=0, Copyhistory=1, Width=400, Height=270')
}

function wrapTag(txtarea, lft, rgt) {
	lft = unescape(lft);
	rgt = unescape(rgt);
	if (document.all) {
		WrapIE(lft, rgt);
	}
	else if (document.getElementById) {
		wrapMoz(txtarea, lft, rgt);
	}
}
// IE only - wraps selected text with lft and rgt
function WrapIE(lft, rgt) {
	strSelection = document.selection.createRange().text;
	if (strSelection!="") {
		document.selection.createRange().text = lft + strSelection + rgt;
	}
}
// Moz only - wraps selected text with lft and rgt
function wrapMoz(txtarea, lft, rgt) {
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd==1 || selEnd==2) selEnd=selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + lft + s2 + rgt + s3;
}
function setText_li(form_){
	form_.value=form_.value+'\n<ul>\n<li>\n<li>\n</ul>';
}

var timeout;
var div_show='';
function hideAll(){
	if(document.getElementById(div_show)){
		document.getElementById(div_show).style.display='none';
		document.getElementById(div_show).style.zIndex=1;
	}
}
function show(menu){
	hideAll();
	div_show=menu; 
	if(document.getElementById(menu)){
		document.getElementById(menu).style.display='block';
		document.getElementById(div_show).style.zIndex=100;
	}
}
function w_check_date(obv){
    if (obv.length == 0)return true;
	isplit = obv.indexOf('-');
	if (isplit == -1 || isplit == obv.length)return false;
    sDay = obv.substring(0, isplit);
	monthSplit = isplit + 1;
	isplit = obv.indexOf('-', monthSplit);
	if (isplit == -1 ||  (isplit + 1 )  == obv.length)return false;
    sMonth = obv.substring((sDay.length + 1), isplit);
	sYear = obv.substring(isplit + 1);
	
	if(!w_check_range(sYear,2000,9999))return false;
	if(!w_check_range(sMonth,1,12))return false;
	if(!w_check_day(sYear,sMonth,sDay))return false;
	return true;
}

function conf_func(a){
	return confirm('Подтвердите удаление:\n'+a);
}
var ii=0;
function set_iframe(a){
	window.frames['if_sel_'+ii].location.href=a;
	if(++ii==4)ii=0;
}

function check_it(num_,id_){
	if(num_!=1)document.getElementById("check_"+id_+"_1").checked=false;
	if(num_!=2)document.getElementById("check_"+id_+"_2").checked=false;
	if(num_!=3)document.getElementById("check_"+id_+"_3").checked=false;
}

function ChangeImg() {
 if(document.images) {
  eval("document."+ChangeImg.arguments[0]+
  ".src=('"+ChangeImg.arguments[1]+"')");
 }
}

function preload() {
  if (document.images) {
    var imgsrc = preload.arguments;
    arr=new Array(imgsrc.length);
    for (var j=0; j<imgsrc.length; j++) {
      arr[j] = new Image;
      arr[j].src = imgsrc[j];
    }
  }
}

var dhtml_objects = new Array()
function create_object_array() {
var div_tags
var span_tags
var css_tags
if (document.getElementById) {
div_tags = document.getElementsByTagName("div")
for (var counter = 0; counter < div_tags.length; counter++) {
current_object = div_tags[counter]
object_css = current_object.style
object_id = current_object.id
if (object_id) {
	dhtml_objects[object_id] = new dhtml_object(current_object,
	                object_css,
	                object_id)
}
}
span_tags = document.getElementsByTagName("span")
for (var counter = 0; counter < span_tags.length; counter++) {
current_object = span_tags[counter]
object_css = current_object.style
object_id = current_object.id
if (object_id) {
dhtml_objects[object_id] = new dhtml_object(current_object,
                 object_css,
                 object_id)
}
}
}
else if (document.all) {
div_tags = document.all.tags("div")
for (var counter = 0; counter < div_tags.length; counter++) {
current_object = div_tags[counter]
object_css = current_object.style
object_id = current_object.id
if (object_id) {
dhtml_objects[object_id] = new dhtml_object(current_object,
                 object_css,
                 object_id)
}
}
span_tags = document.all.tags("span")
for (var counter = 0; counter < span_tags.length; counter++) {
current_object = span_tags[counter]
object_css = current_object.style
object_id = current_object.id
if (object_id) {
dhtml_objects[object_id] = new dhtml_object(current_object,
                 object_css,
                 object_id)
}
}
}
else if (document.layers) {
css_tags = document.layers
for (var counter = 0; counter < css_tags.length; counter++) {
current_object = css_tags[counter]
object_css = current_object
object_id = current_object.id
if (object_id) {
dhtml_objects[object_id] = new dhtml_object(current_object,
                 object_css,
                 object_id)
}
}
}
}
function dhtml_object (obj, css, id) {
this.obj = obj
this.css = css
this.id = id
this.get_left = get_left
this.get_right = get_right
this.get_top = get_top
this.get_bottom = get_bottom
this.get_width = get_width
this.get_height = get_height
this.get_visibility = get_visibility
this.get_zIndex = get_zIndex
this.move_to = move_to
this.move_by = move_by
this.set_left = set_left
this.set_top = set_top
this.set_width = set_width
this.set_height = set_height
this.set_visibility = set_visibility
this.set_zIndex = set_zIndex
this.move_above = move_above
this.move_below = move_below
this.set_backgroundColor = set_backgroundColor
this.set_backgroundImage = set_backgroundImage
this.set_html = set_html
this.get_clip_top = get_clip_top
this.get_clip_right = get_clip_right
this.get_clip_bottom = get_clip_bottom
this.get_clip_left = get_clip_left
this.get_clip_width = get_clip_width
this.get_clip_height = get_clip_height
this.resize_clip_to = resize_clip_to
this.resize_clip_by = resize_clip_by
}
function get_left() {
return parseInt(this.css.left)
}
function get_right() {
return this.left() + this.width()
}
function get_top() {
return parseInt(this.css.top)
}
function get_bottom() {
return this.top() + this.height()
}
function get_width() {
if (!document.layers) {
if (this.css.width) {
return parseInt(this.css.width)
}
else {
return parseInt(this.obj.offsetWidth)
}
}
else {
return parseInt(this.obj.document.width)
}
}
function get_height() {
if (!document.layers) {
if (this.css.height) {
return parseInt(this.css.height)
}
else {
return parseInt(this.obj.offsetHeight)
}
}
else {
return parseInt(this.obj.document.height)
}
}
function get_visibility() {
if (!document.layers) {
if (this.css.visibility) {
return this.css.visibility
}
}
else {
if (this.css.visibility == "show") {
return "visible"
}
if (this.css.visibility == "hide") {
return "hidden"
}
}
return "inherit"
}
function get_zIndex() {
return this.css.zIndex
}
function move_to (new_left, new_top) {
this.css.left = new_left
this.css.top = new_top
}
function move_by (delta_left, delta_top) {
this.css.left = this.left() + parseInt(delta_left)
this.css.top = this.top() + parseInt(delta_top)
}
function set_left (new_left) {
this.css.left = new_left
}
function set_top (new_top) {
this.css.top = new_top
}
function set_width (new_width) {
if (!document.layers) {
this.css.width = new_width
}
}
function set_height (new_height) {
if (!document.layers) {
this.css.height = new_height
}
}
function set_visibility (new_visibility) {
if (!document.layers) {
this.css.visibility = new_visibility
}
else {
if (new_visibility == "visible") {
this.css.visibility = "show"
}
else if (new_visibility == "hidden") {
this.css.visibility = "hide"
}
else {
this.css.visibility = "inherit"
}
}
}
function set_zIndex(new_zindex) {
if (new_zindex > 0) {
this.css.zIndex = new_zindex
}
else {
this.css.zIndex = 0
}
}
function move_above(reference_object) {
this.css.zIndex = reference_object.css.zIndex + 1
}
function move_below(reference_object) {
reference_zindex = reference_object.css.zIndex
if (reference_zindex > 0) {
this.css.zIndex = reference_zindex - 1
}
else {
reference_object.css.zIndex = 1
this.css.zIndex = 0
}
}
function set_backgroundColor(new_color) {
if (!document.layers) {
this.css.backgroundColor = new_color
}
else {
this.css.bgColor = new_color
}
}
function set_backgroundImage(new_image) {
if (!document.layers) {
this.css.backgroundImage = "url(" + new_image + ")"
}
else {
this.css.background.src = new_image
}
}
function set_html(new_html) {
if (!document.layers) {
this.obj.innerHTML = new_html
}
else {
this.obj.document.open()
this.obj.document.write(new_html)
this.obj.document.close()
}
}
function get_clip_top() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.top
}
else {
return this.css.clip.top
}
}
var current_clip
function clip_object(top, right, bottom, left) {
this.top = top
this.right = right
this.bottom = bottom
this.left = left
}
function parse_dom_clip(current_object) {
clip_string = current_object.css.clip
if (clip_string.length > 0) {
var values_string = clip_string.slice(5, clip_string.length - 1)
var clip_values = values_string.split(" ")
var clip_top = parseInt(clip_values[0])
var clip_right = parseInt(clip_values[1])
var clip_bottom = parseInt(clip_values[2])
var clip_left = parseInt(clip_values[3])
}
else {
var clip_top = 0
var clip_right = current_object.width()
var clip_bottom = current_object.height()
var clip_left = 0
}
current_clip = new clip_object(clip_top, clip_right, clip_bottom, clip_left)
}
function get_clip_right() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.right
}
else {
return this.css.clip.right
}
}
function get_clip_bottom() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.bottom
}
else {
return this.css.clip.bottom
}
}
function get_clip_left() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.left
}
else {
return this.css.clip.left
}
}
function get_clip_width() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.right - current_clip.left
}
else {
return this.css.clip.width
}
}
function get_clip_height() {
if (!document.layers) {
parse_dom_clip(this)
return current_clip.bottom - current_clip.top
}
else {
return this.css.clip.height
}
}
function resize_clip_to(new_top, new_right, new_bottom, new_left) {
if (new_top == "auto") {new_top = this.get_clip_top() }
if (new_right == "auto") {new_right = this.get_clip_right() }
if (new_bottom == "auto") {new_bottom = this.get_clip_bottom() }
if (new_left == "auto") {new_left = this.get_clip_left() }
if (!document.layers) {
this.css.clip = "rect(" + new_top + " " + new_right + " " +
    new_bottom + " " + new_left + ")"
}
else {
this.css.clip.top = new_top
this.css.clip.right = new_right
this.css.clip.bottom = new_bottom
this.css.clip.left = new_left
}
}
function resize_clip_by(delta_top, delta_right, delta_bottom, delta_left) {
var new_top = this.get_clip_top() + delta_top
var new_right = this.get_clip_right() + delta_right
var new_bottom = this.get_clip_bottom() + delta_bottom
var new_left = this.get_clip_left() + delta_left
if (!document.layers) {
this.css.clip = "rect(" + new_top + " " + new_right + " " +
    new_bottom + " " + new_left + ")"
}
else {
this.css.clip.top = new_top
this.css.clip.right = new_right
this.css.clip.bottom = new_bottom
this.css.clip.left = new_left
}
}
function get_mouse_x(current_event) {
if (its_ie4plus) {
return event.clientX
}
else if (its_ns4plus) {
return current_event.pageX
}
else {
return null
}
}
function get_mouse_y(current_event) {
if (its_ie4plus) {
return event.clientY
}
else if (its_ns4plus) {
return current_event.pageY
}
else {
return null
}
}
function get_client_width() {
if (its_ie4plus) {
return document.body.clientWidth
}
else if (its_ns4plus) {
return window.innerWidth - 18
}
else {
return null
}
}
function get_client_height() {
if (its_ie4plus) {
return document.body.clientHeight
}
else if (its_ns4plus) {
return window.innerHeight;//-3;// - 18
}
else {
return null
}
}
function get_client_scroll_left() {
if (its_ie4plus) {
return document.body.scrollLeft
}
else if (its_ns4plus) {
return pageXOffset
}
else {
return null
}
}
function get_client_scroll_top() {
if (its_ie4plus) {
return document.body.scrollTop
}
else if (its_ns4plus) {
return 0
}
else {
return null
}
}

function get_client_scroll_top_n() {
if (its_ie4plus) {
return document.body.scrollTop
}
else if (its_ns4plus) {
return pageYOffset
}
else {
return null
}
}