var GLOBAL_PATH="site/";
var IMGS_PATH=GLOBAL_PATH+"imgs/";



//INCLUDES
//include("css/hack.css");
//include("css/box.css");
//include("js/box.js");
//include("js/ajax.js");
//include("js/fs.js");
//--------
if(location.host=="ukrinsoft.com") include("http://www.google-analytics.com/ga.js");
//--------

//document.load=document.onload;
document.onload=function(){
	if(document.isLoaded) return false;
	else document.isLoaded=1;
	if(location.host=="ukrinsoft.com") ga();
	init_content();
	new Box(_("root"));
	fs=FullScreen();
	animationLogo();
	initPNG(document);
	if(document.load) for(var i in document.load) document.load[i]();
	
};
//document.write('<'+'script type="text/javascript">document.onload();</script'+'>');



function animationLogo(){
	var els=[
		{x:26, y:0, c:"#ff5f00"},
		{x:52, y:13, c:"#0087c6"},
		{x:65, y:52, c:"#5ebe12"},
		{x:39, y:65, c:"#ff9000"},
		{x:0, y:13, c:"#ffcc00"},
		{x:0, y:26, c:"#ffcc00"},
		{x:0, y:39, c:"#ffcc00"},
		{x:0, y:52, c:"#ffcc00"},
		{x:0, y:65, c:"#ffcc00"},
		{x:13, y:26, c:"#ffcc00"},
		{x:13, y:39, c:"#ffcc00"},
		{x:13, y:52, c:"#ffcc00"},
		{x:26, y:39, c:"#ffcc00"}
	];
	var block=document.createElement("div");
	block.className="move";
	block.appendChild(document.createElement("div"));
	var cur;
	for(var i in els){
		cur=document.createElement("b");
		cur.style.top=Number(els[i].y+26)+"px";
		cur.style.left=Number(els[i].x+39)+"px";
		cur.style.background=els[i].c;
		cur.move=new Move(cur);
		cur.move.onEndDrag=function(){
			var cc={x:this.obj.offsetLeft%13, y:this.obj.offsetTop%13};
			this.obj.style.top=Number(this.obj.offsetTop+(cc.y<7?-cc.y:13-cc.y))+"px";
			this.obj.style.left=Number(this.obj.offsetLeft+(cc.x<7?-cc.x:13-cc.x))+"px";
		};
		cur.onmouseover=function(){var _this=this; _this.className="act"; setTimeout(function(){_this.className=""},100)};
		block.appendChild(cur);
	}
	_("root").insertBefore(block, _("root").firstChild);
};

function _act(obj){
	if(!obj || !obj.parentNode) return false;
	if(_ATTR(obj, "noact")!=undefined) return false;
	var par=(obj.parentNode.tagName=="LI" || obj.parentNode.tagName=="VAR" ? obj.parentNode.parentNode : obj.parentNode);
	if(!par.set) par.set=function(i){return _(par, '~@a')[i].onclick();}; //init funtion [set]
	if(!par.act) par.act=function(i){return _act(_(par, '~@a')[i]);}; //init funtion [set]
	if(!par.unset) par.unset=function(){Style(par.cur).remove("act"); par.cur=null; return false;}; //init funtion [set]
	if(par.cur==obj) return false;
	if(!par.cur) par.cur=_(par, "a.act"); // if no [cur] try to find it
	if(par.cur) Style(par.cur).remove("act");
	Style(obj).add("act");
	par.cur=obj;
	(_ATTR(obj, "onact") || function(){})(); //call [onact] event
	return false;
};


function team(obj, n){
	_act(obj);
	obj.blur();
	_("person").innerHTML=_("uid_"+obj.hash.substr(1)).innerHTML;
	if(pageTracker) pageTracker._trackPageview(obj.href.replace(/[^#]*#(.*)/,"/team/$1/"));
};



function init_prev(root_id){
	var a=_(root_id).getElementsByTagName("a");
	for(var i=0, l=a.length; i<l; i++)
		if(a[i].href){ 
			//hover(a[i]); //preload img
			//a[i].onmouseover=function(){hover(this, 1)}
			//a[i].onmouseout=function(){hover(this, 0)}
			a[i].onfocus=function(){this.blur()};
			a[i].onclick=function(){return fs.show(this)};
		}
};


function slides(obj){
	function set(obj, num){
		num=num?num:(obj.cur==1?2:1);
		obj.cur=num;
		obj.src=obj.src.replace(/(.+_)[0-9]+(\.jpg)$/,"$1"+num+"$2");
	}
	obj.onmouseover=function(){obj.tm=setTimeout(function(){set(obj); obj.onmouseover()}, obj.cur==2?1500:500)};
	obj.onmouseout=function(){clearTimeout(obj.tm); set(obj, 1)};
	obj.cur=1;
	obj.onmouseover();
};


function init_content(){
	var tag=document.getElementsByTagName("a");
	for(var i=0, l=tag.length; i<l; i++){
		if(tag[i].lang){ //set antiapam mails
			var mail=tag[i].lang+"@"+tag[i].href.replace(/[^:]+:\/\/(.*)\/$/,"$1");
			tag[i].href="mailto:"+mail;
			if(!tag[i].innerHTML || tag[i].rel=="this") tag[i].innerHTML=mail;
			tag[i].lang="";
		}
		if(tag[i].rel=="nofollow"){ //set correct external links
			tag[i].target="_blank";
		}
	}
	
	var tag=document.getElementsByTagName("del");
	for(var i=0, l=tag.length; i<l; i++){
		if(tag[i].title){ //noindex del tags
			tag[i].innerHTML=tag[i].title;
			tag[i].title="";
			if(ie) tag[i].outerHTML+=" ";
		}
	}
};


/*Google Analytics*/
var pageTracker;
function ga(){
	pageTracker = _gat._getTracker("UA-1604326-3");
	pageTracker._initData();
	pageTracker._trackPageview();
};

function showhide(obj,args){
	obj=_(obj);
	var show=(args!=undefined && typeof args=="object")?args.show:args;
	if(show!=undefined) obj.style.display=(show?"block":"none");
	else obj.style.display=(CSS(obj).check({display:'block'})?"none":"block");
	show=CSS(obj).check({display:'block'});
	if(args!=undefined && typeof args=="object" && args.sender) Checkbox(args.sender, show);
	return false;
};

