document.body.className += " js";
document.write('<s'+'cript type="text\/javascript" src="http:\/\/www.astrostar.ru\/js\/swfobject.js"><\/sc'+'ript>');
var AstrostarPortal = {};
var Util = AstrostarPortal.Util = {};
// Push function based on JScript 2.0 functionality that substitutes
// the Array.push() method which is only implemented in JScript 5.5
Util.push = function (arr)
{
	for (var i = 1; i < arguments.length; i ++) arr [arr.length] = arguments [i]; 
	return arr;
};
// Splice function based on JScript 2.0 functionality that substitutes
// the Array.splice() method which is only implemented in JScript 5.5
Util.splice = function (arr, index, howMany)
{
	var i;
	var returnArr = new Array ();
	var postArr = new Array ();
	for (i = 0; i < arr.length; i ++)
	{
		if (i < index) this.push (returnArr, arr [i]);
		if (i >= (index + howMany)) this.push (postArr, arr [i]);
	}
	for (i = 3; i < arguments.length; i ++) this.push (returnArr, arguments [i]); 
	for (i = 0; i < postArr.length; i ++) this.push (returnArr, postArr [i]); 
	return returnArr;
};
Util.getElementsByClassName = function (strClass, strTag, objContElm)
{
	strTag = strTag || "*";
	objContElm = objContElm || document;
	var objColl = (strTag == '*' && document.all && ! window.opera) ? document.all : objContElm.getElementsByTagName (strTag);
	var arr = new Array ();
	var delim = strClass.indexOf ('|') != - 1 ? '|' : ' ';
	var arrClass = strClass.split (delim);
	for (var i = 0, j = objColl.length; i < j; i ++)
	{
		var arrObjClass = objColl [i].className.split (' ');
		if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
		var c = 0;
		comparisonLoop :
		for (var k = 0, l = arrObjClass.length; k < l; k ++)
		{
			for (var m = 0, n = arrClass.length; m < n; m ++)
			{
				if (arrClass [m] == arrObjClass [k]) c ++;
				if ((delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length))
				{
					arr [arr.length] = objColl [i];
					break comparisonLoop;
				}
			}
		}
	}
	return arr;
};
Util.saveAs = function (txt)
{
	if (document.execCommand && document.all && ! window.opera)
	{
		document.execCommand ("SaveAs");
	}else
	{
		alert (txt || 'Ваш браузер не может сохранить страницу автоматически. Нажмите Ctrl + S.');
	}
	return false;
};
Util.trace = function (o)
{
	document.write ("<hr><strong>" + o + "</strong>:<br />");
	for (var i in o) document.write (i + ": <strong>" + o [i] + "</strong><br />"); 
	document.write ("<hr>");
};
Util.trim = function (s)
{
	var str = s || '';
	str = str.toString ();
	str = s === 0 ? 0 : str;
	while (str.charCodeAt (0) <= 32) str = str.substr (1, str.length);
	while (str.charCodeAt (str.length - 1) <= 32) str = str.substr (0, str.length - 1);
	return str;
};
Util.obj2str = function (o)
{
	var str = "";
	for (var i in o) str += (i + "=" + o [i] + ","); 
	str = str.substr (0, (str.length - 1));
	return str;
};
Util.shiftoutArray = function (a, val)
{
	var i = a.length;
	while (i --) if (a [i] == val) a = Util.splice (a, i, i + 1);
	return a;
};
Util.openWin = function (src, w, h, name, prop, txt)
{
	if (self.screen)
	{
		sw=screen.width;
		sh=screen.height;
	} else if (self.java)
	{
		var j=java.awt.Toolkit.getDefaultToolkit();
		var s=j.getScreenSize();
		sw=s.width;
		sh=s.height;
	}
	sw = sw||1024;
	sh = sh||768;
	w = w||sw/2;
	h = h||sh/2;
	var o = {
		resizable:'yes',
		menubar:'no',
		status:'yes',
		scrollbars:'yes',
		address:'no',
		width:w,
		height:h,
		left:((sw-w)/2),
		top:((sh-h)/2)
	};
	if(typeof prop == "object")
	{
		for(var i in prop) o[i] = prop[i].toString();
		prop = "";
		prop = Util.obj2str(o);
	} else
	{
		prop = prop||Util.obj2str(o);
	}
	src = src||"about:blank";
	name = name ||"_blank";
	win = window.open(src, name, prop);
	if(win && txt)
		win.document.write(txt);
	return win;
};
Util.openTxt = function (txt, target)
{
	return Util.openWin (null, null, null, target||'textPopup', null, txt, getWin)
};
Util.openImg = function (src, alt, target)
{
	alt = alt || '';
	var str = '<html>';
	str += '<head><title>' + alt + '</title></head>';
	str += '<body onclick="window.close();" style="margin:0;padding:0;text-align:center;"><img src="' + src + '" ';
	str += 'onload="window.moveBy((100-this.width)/2,(100-this.height)/2);window.resizeBy(this.width, this.height);window.resizeBy(-100,-100);" ';
	str += 'title="' + alt + '" alt="' + alt + '" style="margin:0;padding:0;display:block;" /></body></html>';
	return this.openWin ("about:blank", (document.all && ! window.opera ? 120 : 100) , 100, target||"picturePopup", null, str);
};
Util.setHome = function (a)
{
	if (navigator.appVersion.indexOf ('MSIE'))
	{
		a.style.behavior = 'url(#default#homepage)';
		a.setHomePage ('http:\/\/astrostar.ru\/');
		return false;
	} else 
	{
		alert ('Ваш браузер не поддерживает возможность установки начальной страницы автоматически.\nВы можете установить её в настройках!')
	}
	return false;
}
AstrostarPortal.Validator = function (){};
AstrostarPortal.Validator.prototype.trim = Util.trim;
AstrostarPortal.Validator.prototype.check = function (f, o)
{
	//alert('Validator.check '+(f.onsubmit ? 'func' : 'null'))
	var fnc, val, el, txt, type, i;
	for (i in o)
	{
		el = f[i];
		//
		if ( ! el || typeof el == 'function') continue;
		txt = this.trim(o[i]);
		if (txt != window.undefined) fnc = txt.split (' ')[0];
		if (!this.types[fnc])
		{
			fnc = 'text';
		} else 
		{
			var a = txt.split (' ');
			a = a.slice (1);
			a = Util.shiftoutArray (a);
			txt = a.join (' ');
		}
		val = this.getElementValue(el);
		if(el.value != window.undefined && val != null && val != window.undefined)
			el.value = val;
		this.types.trim = this.trim;
		if (!this.types[fnc](val))
		{
			this.showWrong(el, txt);
			return false;
		}
	}
	return true;
};
AstrostarPortal.Validator.prototype.getElementValue = function(el){
	var v = null;
		if (el.type == 'checkbox') // checkbox
			v = el.checked ? el.value : null;
		else if (el.value) // text, password, hidden
			v = this.trim(el.value);
		else if (el.options) // select
			v = el.selectedIndex > -1 ? el.options[el.selectedIndex].value	: null;
		else if (el.length > 0) // radiobuton
			for (var i = 0; i < el.length; i++)
				if (el[i].checked) {
					v = el[i].value;
					break;
				} else {
					v = null;
				}
	return v;
};
/*  Типы для проверок
* --------------------------------------*/
AstrostarPortal.Validator.prototype.types = {
	text : function (txt)
	{
		return Boolean(this.trim(txt));
	},
	email : function (m)
	{
		return !(this.trim(m).length < 7 || !(/^.+@.+\.[a-z]{2,4}$/.test(this.trim(m.toLowerCase()))));
	}
}
AstrostarPortal.Validator.prototype.addType = function(name,f){
	this.types[name] = f;
};
AstrostarPortal.Validator.prototype.showWrong = function (el, txt)
{
	if (txt && txt.length) alert (txt);
	if(el.value != window.undefined){
		el.focus ();
		el.style.borderColor = 'red';
		el.onbl = el.onblur;
		el.onblur = function ()
		{
			this.style.borderColor = '';
			this.onblur = this.onbl;
			if (this.onbl) this.onbl();
		}
	}
	return false;
};
/**/
AstrostarPortal.Validator.prototype.setPostFunc = function (func, o)
{
	this.postFunc = func;
	this.postFuncArgs = o;
}
/* Меню (по сути триггер className)
--------------------------------------*/
function Menu(cls,cp,cod){
     this.closePrev = cp;
     this.closeOnDbl = cod; 
     this.activeClass = cls
     this.opened = null;
}
Menu.prototype.open = function(el){
     var f = this.isActive(el) && !this.closeOnDbl ? this.removeClass : this.addClass;
     if(this.closePrev && this.opened && this.opened != el){
          this.removeClass(this.opened,this.activeClass);
     }
     f(this.opened = el,this.activeClass);
}
Menu.prototype.isActive = function(el){
     if(!el && !el.className) return;
     return (el.className.indexOf(this.activeClass) > -1)
}
Menu.prototype.removeClass = function(el,cls){
     el.className = el.className.split(cls).join('');
}
Menu.prototype.addClass = function(el,cls){
     el.className += ' '+cls;
}
/* Всё остальное
--------------------------------------*/
var Validator = new AstrostarPortal.Validator ();