var dom = (document.getElementById)? true : false;
var ie = (dom && document.all && !window.opera) ? true : false;
var ie4 = (document.all && !dom)? true : false;
var ie = (document.all)? true : false
var nn6 = (!ie && dom) ? true : false
var nn4 = (document.layers)? true : false 


function putElem(elemId) {
  if (dom) document.getElementById(elemId).style.display = "block";
    else if (ie4) document.all[elemId].style.display = "block";
}

function putElemTr(elemId) {
	if (ie) {
		if (dom) document.getElementById(elemId).style.display = "block";
		else if (ie4) document.all[elemId].style.display = "block";
	} else {
		if (dom) document.getElementById(elemId).style.display = "table-row";
	}
}



function removeElem(elemId) {
  if (dom) document.getElementById(elemId).style.display = "none";
    else if (ie4) document.all[elemId].style.display = "none";
//	document.cookie = "object_"+elemId+"=hidden; expires=\"01.01.2010\"; path=/";
}


function changeElem(elemId) {
	
	if (document.getElementById(elemId).style.display == "none") {
		putElem(elemId);
		}
	else	{
		removeElem(elemId);
		nextyear.setFullYear(nextyear.getFullYear() + 1);
		}
}

function changePanel( elemId, state )
{
    var nextyear = new Date();
    nextyear.setFullYear(nextyear.getFullYear() + 1);

    if (state==1)
    {
      var a = document.getElementById(elemId+'_visible');
      a.style.display='none';
      var a = document.getElementById(elemId+'_hidden');
      a.style.display='block';
      document.cookie = "object_"+elemId+"=hidden; expires=" + nextyear.toGMTString() + "; path=/";
    }
    else
    {
      var a = document.getElementById(elemId+'_hidden');
      a.style.display='none';
      var a = document.getElementById(elemId+'_visible');
      a.style.display='block';
      document.cookie = "object_"+elemId+"=visible; expires=" + nextyear.toGMTString() + "; path=/";
    }
}

function show_hide ( id ) {
	
	var hdn_div = document.all['bm_div_'+id];
	var xpand_img = document.all['bm_shimg_'+id];
	var tit_div = document.all['bm_div_title_'+id];

	if( hdn_div.style.display == 'block' ) {
		hdn_div.style.display = 'none';
		xpand_img.src = '/pictures/items/sh0.gif';
		tit_div.className = "bm_div_title_hidden";
	} else {
		hdn_div.style.display = 'block';
		xpand_img.src = '/pictures/items/sh1.gif';
		tit_div.className = "bm_div_title";
	}
}

function show ( id ) {
	
	var hdn_div = document.all['bm_div_'+id];
	var xpand_img = document.all['bm_shimg_'+id];
	var tit_div = document.all['bm_div_title_'+id];

	hdn_div.style.display = 'block';
	xpand_img.src = '/pictures/items/sh1.gif';
	tit_div.className = "bm_div_title";
}

function hide ( id ) {
	
	var hdn_div = document.all['bm_div_'+id];
	var xpand_img = document.all['bm_shimg_'+id];
	var tit_div = document.all['bm_div_title_'+id];

	hdn_div.style.display = 'none';
	xpand_img.src = '/pictures/items/sh0.gif';
	tit_div.className = "bm_div_title_hidden";
}

function hover ( id ) {
	var tit_div = document.getElementById('bm_div_title_'+id);
	var matches = tit_div.className.match("bm_div_title((_hidden)?)((_active)?)");
	tit_div.className = "bm_div_title"+matches[1]+"_active";

}

function dishover ( id ) {
	var tit_div = document.getElementById('bm_div_title_'+id);
	var hdn_div = document.getElementById('bm_div_'+id);
	var matches = tit_div.className.match("bm_div_title((_hidden)?)((_active)?)");
	tit_div.className = "bm_div_title"+matches[1];
}


function hover ( id ) {
	var tit_div = document.getElementById('bm_div_title_'+id);
	var matches = tit_div.className.match("bm_div_title((_hidden)?)((_active)?)");
	tit_div.className = "bm_div_title"+matches[1]+"_active";
}


function sF()
{

	if (document.forms.workform.elements.action) 
	{
	document.forms.workform.elements.action.value="Пожалуйста подождите...";
	document.forms.workform.elements.action.className="btn_cancel";
	document.forms.workform.elements.action.disabled="true";
	}
	if (document.forms.workform.elements.save) 
	{
	document.forms.workform.elements.save.value="Пожалуйста подождите...";
	document.forms.workform.elements.save.className="btn_cancel";
	document.forms.workform.elements.save.disabled="true";
	}
}






