document.body.className += " js";
var 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.getWin = function(){
	this.__getWin = true;
	return this;
};
Util.__isGetWin = function(){
	var tmp = this.__getWin;
	this.__getWin = false;
	return tmp;
};
Util.openWin = function(src, w, h, name, prop, txt, getWin){
	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(txt) win.document.write(txt);
	return getWin ? win : false;
};
Util.openTxt = function(txt, getWin){
	return Util.openWin(null, null, null, 'textPopup', null, txt, getWin)
};
Util.openImg = function (src, alt){
	alt = alt||'';
	var str = '<html>';
	str+='<head><title>'+alt+'</title><style type="text/css">*{margin:0;padding:0;}</style></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, "picturePopup", null, str);
};
var Validator = {types:{}};
Validator.trim = Util.trim;
Validator.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.split(" ")!='undefined') fnc = this.types[txt.split(" ")[0]];
		if(!fnc){
			fnc = this.types.text;
		} else {
			var a = txt.split(" ");
			a = a.slice(1);
			a = Util.shiftoutArray(a);
			txt = a.join(' ');
		}
		val = this.trim(el.value);
		el.value = val;
		if(!fnc(val)){
			return this.showWrong(el,txt);
			return false;
		}
	}
	//alert('Validator b4 finished '+(f.onsubmit ? 'func' : 'null'))
	var flag = this.postFunc ? this.postFunc(f, this.postFuncArgs, o) : true;
	//alert('Validator finished '+(f.onsubmit ? 'func' : 'null')+' : '+flag)
	return flag;
};
/*  îÏÍÁÅÏÉÕ ÐÕÎÍÁ:
--------------------------------------*/
Validator.types.text = function(txt){
	return Boolean(Validator.trim(txt));
};
Validator.types.email = function(m){
	return !(Validator.trim(m).length < 7 || !(/^.+@.+\.[a-z]{2,4}$/.test(Validator.trim(m.toLowerCase()))));
};
/*  îÏÍÁÅÏÉÞ ÎÏÞÁÕÊÝÌÍßÐÕ ÁÁÍÄÞ:
--------------------------------------*/
Validator.showWrong = function(el,txt){
	el.focus();
	if(txt && txt.length) alert(txt);
	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;
};
/**/
Validator.setPostFunc = function(func,o){
	this.postFunc = func;
	this.postFuncArgs = o;
}
/*  íÀÛÕÅ ÒÑÌÉÆÕÕ:
--------------------------------------*/
function setHome(a) { 
	if (navigator.appVersion.indexOf('MSIE')) {
		a.style.behavior='url(#default#homepage)'; 
		a.setHomePage('http:\/\/www.astrostar.ru\/');
		return false;
	} else {
		//
	}
		return false;
}
var openImg = Util.openImg;
var openWin = Util.openWin;
var trim = Util.trim;

var astrostar_set_status_of_readiness = function(){return false};
