// JavaScript Document

function popup(src,w,h,scrollbars,windowname) {
	cX=(screen.width-w)/2;
	cY=(screen.height-h)/2;
	if (!scrollbars)
		scrollbars='no';
	if (!windowname)
		windowname='_blank';
	return win = window.open(src,windowname,'width='+w+', height='+h+', scrollbars='+scrollbars+', left='+cX+',top='+cY+',screenX'+cX+',screenY='+cY);
}

function privacy() {
	popup('/popup_privacy.html',400,500,'yes');
}

function conditions() {
	popup('/popup_conditions.html',400,500,'yes');
}

function contest_rules() {
	popup('/popup_contest_rules.html',400,500,'yes');
}

function layerOnOff(id,state) {
	if (document.getElementById)
	{
		if (document.getElementById(id)) {
			if (state)
				document.getElementById(id).style.display='block';
			else
				document.getElementById(id).style.display='none';
		}
	}
	else
	{
		if (document.all)
		{
			if (document.all[id]) {
				if (state)
					document.all[id].style.display='block';
				else
					document.all[id].style.display='none';
			}
		}
		else
		{
			if (document.layers[id]) {
				if (state)
					document.layers[id].display='block';
				else
					document.layers[id].display='none';
			}
		}
	}
}


function show(id) {
	if (activeLayer!=id) {
		if (document.getElementById)
		{
			if (document.getElementById(id)) {
				document.getElementById(id).style.display='block';
			}
				document.getElementById(activeLayer).style.display='none';
		}
		else
		{
			if (document.all)
			{
				if (document.all[id]) {
					document.all[id].style.display='block';
				}
					document.all[activeLayer].style.display='none';
			}
			else
			{
				if (document.layers[id]) {
					document.layers[id].display='block';
				}
					document.layers[activeLayer].display='none';
			}
		}
		activeLayer = id;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function delete_row(table_name,id) {
	if (confirm('Действительно желаете удалить?')) {
		document.forms.list_form.table_name.value = table_name;
		document.forms.list_form.delete_row_id.value = id;
		document.forms.list_form.submit();
	}
}

var defaultBullet = 0;
var activeBullet = defaultBullet;

function bullet(id,status) {
/*
	if (status) {
		MM_findObj('menu_bullet'+id).className = 'bullet';
		activeBullet = id;
	} else {
		MM_findObj('menu_bullet'+activeBullet).className = 'no_bullet';
		activeBullet = defaultBullet;
	}
*/	
		MM_findObj('menu_bullet'+id).className = status ? 'bullet' : 'no_bullet';
}

function submit_value(form_name, control_name, value, confirmation) {

  if (confirmation)
    if (!confirm(confirmation))
      return;

  eval('document.forms.'+form_name+'.'+control_name+'.value='+value);
  eval('document.forms.'+form_name+'.submit()');

}
