if (document.getElementById) {
	if (document.styleSheets) {
		/* MZ: application/xhtml+xml IE: text/html */
		if (document.styleSheets[0].cssRules) {
			document.styleSheets[0].insertRule("@import url('../css/workjs.css') screen;",0);
			startJS = true;
		}
		else if (document.styleSheets[0].rules) {
			document.styleSheets[0].addImport("../css/workjs.css",0);
			startJS = true;
		}
	}
	else {		
		/* OPERA: text/html */
		document.write('<link rel="stylesheet" type="text/css" href="../css/workjs.css" media="screen"/>');
		startJS = true;
	}
}

function styl() {
	if (!document.styleSheets) return true;
	return !document.styleSheets[0].disabled;
}


function newwindow (t) {
	if (t.href.search(/.jpg|.gif|.png/)!=-1) {
		atribs = "width=400,height=400,resizable=1,status=0,menubar=0,scrollbars=1";
		i=window.open('../show.php?file='+t.href,'img',atribs);	
	}
	else {
		window.open(t.href,"","");		
	}
	return false;
}

function submenu(el) {
	if (styl()) {
		el.blur();
		var id = getHref(el);
		if (menus = getParentByClassName(el,"submenu").getElementsByTagName("div")) {
			for (i=0;i<menus.length;i++) {
				if (menus[i].id != id && hasClassName(menus[i],"open")) removeClassName(menus[i],"open");
			}
		}

		if (box = document.getElementById(id)) {
			if (!hasClassName(box,"open")) addClassName(box,"open");
			else removeClassName(box,"open");
			return false;	
		}
	}
}



function getHref(el) {
	href=el.getAttribute("href");
	return href.substr(href.lastIndexOf("#")+1);

}

/*-[ class manage ]------------------------------------------*/

function hasClassName (el, name) {
	var i, list;

	list = el.className.split(" ");
	for (i = 0; i < list.length; i++)
	if (list[i] == name) return true;
	return false;
};

function removeClassName (el, name, c) {
	var i, j, curList, newList;
	if (el.className == "") return;

	newList = new Array();
	curList = el.className.split(" ");
	j=0;
	for (i = 0; i < curList.length; i++) 
		if (curList[i] != name) 
			newList[i-j]=curList[i];
	    else j++;
	if (c!=1)el.className = newList.join(" ");
	else return newList.join(" ");
};


function addClassName (el, name) {
	if ((el.className == "") || (el.className == " ")) el.className = name;
	else el.className += " " + name;
};

function getParentByClassName(el,name) {
	while (el !=null && el.parentNode != null && !hasClassName(el,name)) {
		el = el.parentNode;
	}
	if (el !=null && el.parentNode != null)	return el;
	else return false;
}

/*-----------------------------------------------------------*/