browser = navigator.userAgent.toLowerCase();
isDOM = document.getElementById?true:false; //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+) 
isOpera = isOpera5 = window.opera && isDOM;
isOpera6 = isOpera && window.print;
isOpera7 = isOpera && document.readyState;
isMSIE = isIE = document.all && document.all.item && !isOpera; //Microsoft Internet Explorer 4+ 
isStrict = document.compatMode=="CSS1Compat";
isNN = isNC = navigator.appName=="Netscape";
isNN4 = isNC4 = isNN && !isDOM;
isNN6 = isNN && isDOM; //Mozilla или Netscape 6.* 
isKHTML = isSafari = (browser.match(/applewebkit/)!=null);
isMozilla = isDOM && (browser.match(/gecko/)!=null);
isMac = (browser.match(/mac/)!=null);

function isDefined() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}
function isStr() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}
function isNum() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='number') return false;}
  return true;
}
function isDigit(keyCode){
	return ((keyCode>=48 && keyCode<=57) || (keyCode>=96 && keyCode<=105));
}
function isControl(keyCode){
	return ((',35,36,37,38,39,40,8,9,46,').indexOf(','+keyCode+',')>-1);
}
function checkOnInt(val){
	return (((',35,36,37,39,8,9,46,').indexOf(','+val+',')>-1) || (val>=48 && val<=57) || (val>=96 && val<=105));
}
function checkOnFloat(val){
	return (((',35,36,37,39,8,9,46,190,191,').indexOf(','+val+',')>-1) || (val>=48 && val<=57) || (val>=96 && val<=105));
}

htmlrootpath='';

function word_case(num, word1, word2, word3){
	if((num%100>4) && (num%100<21)) return word3;
	if(num%10==1) return word1;
	if((num%10>1) && (num%10<5)) return word2;
	return word3;
}
	
function dhtmlLoadScript(url){
	var e = document.createElement("script");
	e.src = url;
	e.type="text/javascript";
	document.getElementsByTagName("head")[0].appendChild(e);
}
function dhtmlLoadStyle(url){
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = url;
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
}

function createScript(scriptSrc){
	var span = document.createElement('SPAN');
	span.style.display = 'none';
	document.body.insertBefore(span, document.body.lastChild);
	span.innerHTML = 'IEtxt.<s'+'cript></' + 'script>';
	setTimeout(function() {
	   var s = span.getElementsByTagName('script')[0];
	   s.language = 'JavaScript';
	   if (s.setAttribute) s.setAttribute('src', scriptSrc); else s.src = scriptSrc;
	}, 10);
}

function switchBlockDisplay(ind) {
	var isTR = /^\s*<td/i.test(document.getElementById(ind).innerHTML);
	if (isDOM || isMSIE) {
		eval("var currElement = (isDOM)? document.getElementById('"+ind+"') : document.all['"+ind+"'];");
		if(currElement) currElement.style.display = (currElement.style.display == '')? 'none' : ((currElement.style.display == 'none')? ((isTR && isMozilla)?'table-row':'block') : 'none');
	}
}

if(isMozilla && !isMSIE) {event = null;}

var admConsoleInterv;
var macstyleInterv;

var adminConsoleWidth;
var adminConsoleHeight;

var firstMovingNode = 0;
var mn_sect_groupsID1;
var mn_ind1;
var mn_url1;
var mn_parent1;
var mn_deep1;
var tNode = new Array();
var sect_groupsID = 0;

var tree = new Array();


function switchAdminConsole(action){
	if(action==0){
		document.getElementById('admin_console').style.display = 'none';
		if(isMSIE) document.getElementById('admin_console_block_png').style.display = 'none';
	} else {
		switchBlockDisplay('admin_console');
		if(isMSIE) switchBlockDisplay('admin_console_block_png');
	}
	document.getElementById('admConsoleTbl').className = (((document.getElementById('admin_console').style.display=='none') || (action==0))?'xp_style_dis':'xp_style_act');
}

function cross_PNG_background(name, src, adds, sizingMethod){
	if(0 && isMSIE)
		return name+' {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+htmlrootpath+src+'\', sizingMethod=\''+(isDefined(sizingMethod)?sizingMethod:'crop')+'\');'+(isDefined(adds)?adds:'')+'} ';
	else if(isDOM)
		return name+' {background-image:url('+htmlrootpath+src+');'+(isDefined(adds)?adds:'')+'} ';
}

// document.write("<style type=\"text/css\">"+
	// cross_PNG_background('#logo', '/static/images/logo.png', '', 'crop')+
	// cross_PNG_background('#photo_frame div', '/static/images/photo_frame.png', '', 'crop')+
	// cross_PNG_background('#news_block', '/static/images/news_block_frame.png', '', 'crop')+
	// cross_PNG_background('div.breeds_frame div', '/static/images/breeds_frame.png', '', 'crop')+
	// cross_PNG_background('#main_content', '/static/images/pigeons.png', '', 'crop')+
	// "</style>");

// if(document.all && !window.opera) {
	// if (/MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32") {
		// document.write("<style type=\"text/css\">"+
		// "#admin_console_block_png {width:100%;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+htmlrootpath+"/static/images/dark_glass.png', sizingMethod='crop');white-space:nowrap;margin:0px 0px 3px 0px;} "+
		// "</style>");
	// }
// } else if (document.getElementById) {
	// document.write("<style type=\"text/css\">"+
		// "#admin_console_block {background-image:url("+htmlrootpath+"/static/images/dark_glass.png);white-space:nowrap;margin:0px 0px 3px 0px;}"+
		// "</style>");
// }

document.write("<style type=\"text/css\">"+
".xp_style_dis td.l		{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_left.gif) no-repeat right top;}"+
".xp_style_act_hov td.l	{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_hov_left.gif) no-repeat right top;}"+
".xp_style_dis_hov td.l	{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_hov_left.gif) no-repeat right top;}"+
".xp_style_act td.l		{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_left.gif) no-repeat right top;}"+
".xp_style_dis td.r		{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_right.gif) no-repeat left top;}"+
".xp_style_act_hov td.r	{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_hov_right.gif) no-repeat left top;}"+
".xp_style_dis_hov td.r	{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_hov_right.gif) no-repeat left top;}"+
".xp_style_act td.r		{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_right.gif) no-repeat left top;}"+
".xp_style_dis td.i		{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_bg.gif) repeat-x left top;}"+
".xp_style_act_hov td.i	{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_hov_bg.gif) repeat-x left top;color:#FFFFFF;}"+
".xp_style_dis_hov td.i	{background:url("+htmlrootpath+"/static/images/xp-style-bar/dis_hov_bg.gif) repeat-x left top;}"+
".xp_style_act td.i		{background:url("+htmlrootpath+"/static/images/xp-style-bar/act_bg.gif) repeat-x left top;color:#FFFFFF;}"+
"</style>");
