old_id="test";
function setElementOpacity(oElem, nOpacity)
{
 var p = getOpacityProperty();
 (setElementOpacity = p=="filter"?new Function('oElem', 'nOpacity', 'nOpacity *= 100; var oAlpha = oElem.filters["DXImageTransform.Microsoft.alpha"] || oElem.filters.alpha; if (oAlpha) oAlpha.opacity = nOpacity; else oElem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";'):p?new Function('oElem', 'nOpacity', 'oElem.style.'+p+' = nOpacity;'):new Function)(oElem, nOpacity);
}

function getOpacityProperty()
{
 var p;
 if (typeof document.body.style.opacity == 'string') p = 'opacity';
 else if (typeof document.body.style.MozOpacity == 'string') p = 'MozOpacity';
 else if (typeof document.body.style.KhtmlOpacity == 'string') p = 'KhtmlOpacity';
 else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) p = 'filter';

 return (getOpacityProperty = new Function("return '"+p+"';"))();
}

function fadeOpacity(sElemId, sRuleName, bBackward)
{
 var elem = document.getElementById(sElemId);
 if (!elem || !getOpacityProperty() || !fadeOpacity.aRules[sRuleName]) return;

 var rule = fadeOpacity.aRules[sRuleName];
 var nOpacity = rule.nStartOpacity;

 if (fadeOpacity.aProc[sElemId]) {clearInterval(fadeOpacity.aProc[sElemId].tId);}//fadeOpacity.aProc[sElemId].nOpacity;}
 if ((nOpacity==rule.nStartOpacity && bBackward) || (nOpacity==rule.nFinishOpacity && !bBackward))	return;

 fadeOpacity.aProc[sElemId] = {'nOpacity':nOpacity, 'tId':setInterval('fadeOpacity.run("'+sElemId+'")', fadeOpacity.aRules[sRuleName].nDalay), 'sRuleName':sRuleName, 'bBackward':Boolean(bBackward)};
}

fadeOpacity.addRule = function(sRuleName, nStartOpacity, nFinishOpacity, nDalay){fadeOpacity.aRules[sRuleName]={'nStartOpacity':nStartOpacity, 'nFinishOpacity':nFinishOpacity, 'nDalay':(nDalay || 30),'nDSign':(nFinishOpacity-nStartOpacity > 0?1:-1)};};

fadeOpacity.back = function(sElemId){fadeOpacity(sElemId,fadeOpacity.aProc[sElemId].sRuleName,true);};

fadeOpacity.run = function(sElemId)
{
 var proc = fadeOpacity.aProc[sElemId];
 var rule = fadeOpacity.aRules[proc.sRuleName];

 proc.nOpacity = Math.round(( proc.nOpacity + .1*rule.nDSign*(proc.bBackward?-1:1) )*10)/10;
 setElementOpacity(document.getElementById(sElemId), proc.nOpacity);

 if (proc.nOpacity==rule.nStartOpacity || proc.nOpacity==rule.nFinishOpacity)	clearInterval(fadeOpacity.aProc[sElemId].tId);
}
fadeOpacity.aProc = {};
fadeOpacity.aRules = {};


function try_off(this_id) {
	old_id=document.getElementById("mainpic");
	var thisid = document.getElementById(this_id);
	if (thisid.className=="overitem_chosen") thisid.className="overitem";
}
var openpic = 0;
function try_on(this_id) {
	var thisid = document.getElementById(this_id);
	if (thisid.className!="overitem_opened") thisid.className="overitem_chosen";
	if (openpic != this_id) {
		if (document.getElementById("mainpic")) {
			picid = document.getElementById("mainpic");
			setElementOpacity(document.getElementById("mainpic"), 0);
			picid.src="/_bone/pic_"+this_id+".jpg";
			fadeOpacity('mainpic', 'or1');
		}
	}
	openpic = this_id;
}

function initCat(menuID) {
	var mid = document.getElementById(menuID);
	var arr = mid.getElementsByTagName("div");
	for (var i=0;i<arr.length;i++) {
		if ((arr[i].className=="submenu") || (arr[i].className=="subsubmenu")) arr[i].style.display = "none";
	}
}
function openCat(cat_id, this_id) {
	var thisid = document.getElementById(this_id);
	if ((thisid.className == "overitem")||((thisid.className == "overitem_chosen"))) thisid.className = "overitem_opened";
	else if (thisid.className == "level2") thisid.className = "level2_chosen";
	else if (thisid.className == "overitem_chosen") thisid.className = "overitem";
	else if (thisid.className == "level2_chosen") thisid.className = "level2";
	else if (thisid.className == "overitem_opened") thisid.className = "overitem";
//	thisid.className = (thisid.className == "level1") ? "level1 chosen" : "level1";
	var idcat = document.getElementById(cat_id);
	idcat.style.display = (idcat.style.display == "none") ? "block" : "none";
}

function getElementById(myid) {
   if (isNS4){
        objElement = document.layers[myid];
     }else if (isIE4) {
        objElement = document.all[myid];
     }else if (isIE5 || isNS6) {
             objElement = document.getElementById(myid);
     }
return(objElement);
}


