function contact_fir()
{
	document.write('<a h'+'ref="m'+'ailt'+'o:'+'%63%6f%6e%74%61%63%74%6f%66%66%69%63%65%40%66%69%74%7a%64%65%73%69%67%6e%2e%69%65" class="whttext">&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#111;&#102;&#102;&#105;&#99;&#101;&#64;&#102;&#105;&#116;&#122;&#100;&#101;&#115;&#105;&#103;&#110;&#46;&#105;&#101;<\/a>');
}
//===================         Browser Detection         =================== {
	
B = new function() {
	
	var data = [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "IE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Firefox"
		}
	];
	
	var searchString = function () {
		for (var i=0;i<data.length;i++)	{
			if (data[i].string) {
				if (data[i].string.indexOf(data[i].subString) != -1) return data[i].identity;
			} else if (data[i].prop) return data[i].identity;
		}
		return "unknown";
	}
	
	var b = searchString();
	
	this.safari = (b=='Safari') ? true : false;
	this.firefox = (b=='Firefox') ? true : false;
	this.opera = (b=='Opera') ? true : false;
	this.ie = (b=='IE') ? true : false;
}

//    /Browser Detection    == }

//===================         Basic Functions           =================== {

function $(id) { return document.getElementById(id); }

uid = (
	function(){
		var id=0; 
		return function(){
			return id++ ;
		};
	} 
)();

G = new function() {

	this.init=[];
	
	this.timers = {
		opacity : []
	}
	
	this.lastHideLength=0;
	this.lastShowLength=0;
	this.lastHideShowLength=0;
	
	window.onload = function() {
		for (var i=0;i<G.init.length;i++) G.init[i]();
	}
	
	this.clearTimeout = function(obj) {
		if (obj) for (var i=0;i<obj.length;i++) clearTimeout(obj[i]);
	}
	
	this.winParams = function() {
		var length, height, left, top;
		
		if (self.innerHeight) {
			length = self.innerWidth;
			height = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			length = document.documentElement.clientWidth;
			height = document.documentElement.clientHeight;
		} else if (document.body) {
			length = document.body.clientWidth;
			height = document.body.clientHeight;
		}
		
		if (self.pageYOffset) {
			left = self.pageXOffset;
			top = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			left = document.documentElement.scrollLeft;
			top = document.documentElement.scrollTop;
		} else if (document.body) {
			left = document.body.scrollLeft;
			top = document.body.scrollTop;
		}
		
		var r = {};
		r.length=length;
		r.height=height;
		r.scrollLeft=left;
		r.scrollTop=top;
		
		return r;
	}

	this.show = function(el, func, hold, d, func_timeout) {
		var timeout = !func_timeout ? 0 : func_timeout;
		var f = !func ? '' : func;
		
		f=f.replace(":id:",el.id);
		
		if (typeof(el)=='string') el=$(el);
		if (!el.id) el.id="tmp"+uid();
		var id=el.id;
		
		if (!hold) {
			this.clearTimeout(this.timers.opacity[id]);
			this.timers.opacity[id]=[];
		}
		
		if (!B.ie) {
			var op=parseFloat(el.style.opacity);
			if (isNaN(op)) op=0;
			if (op==1) {
				el.style.visibility='visible';
				return hold;
			}
			if (op>0) var start=(op+0.1)*10;
			else {
				el.style.opacity=0.1;
				var start=2;
			}
			el.style.visibility='visible';
			
			if (f=="hide") f="G.hide('"+id+"');";
			
			var n=1;
			if (!hold) {
				for (var i=start;i<=10;i++,n++) {
					this.timers.opacity[id].push(setTimeout("$('"+id+"').style.opacity="+(i/10), n*d));
				}
				if (f) this.timers.opacity[id].push(setTimeout(f, n*d+timeout));
			} else {
				for (var i=start;i<=10;i++) {
					hold.push("$('"+id+"').style.opacity="+(i/10)+";");
				}
				if (f) hold.push(f);
				this.lastHideShowLength=this.lastShowLength=hold.length;
				return hold;
			}
		} else {
			var op=el.style.filter;
			if (op) op=parseInt(op.substring(14, op.indexOf(')')));
			else op=0;
			
			if (op==100) {
				el.style.visibility='visible';
				return hold;
			}
			if (op>0) var start=(op+10)/10;
			else {
				el.style.filter="alpha(opacity=10)";
				var start=2;
			}
			el.style.visibility='visible';
			
			
			
			if (f=="hide") f="G.hide('"+id+"');";
			
			var n=1;
			if (!hold) {
				for (var i=start;i<=10;i++,n++) {
					this.timers.opacity[id].push(setTimeout(
						"$('"+id+"').style.filter='alpha(opacity="+(i*10)+")';", n*d));
				}
				if (f) this.timers.opacity[id].push(setTimeout(f, n*d+timeout));
			} else {
				for (var i=start;i<=10;i++) {
					hold.push("$('"+id+"').style.filter='alpha(opacity="+(i*10)+")';");
				}
				hold.push("$('"+id+"').style.filter='';");
				if (f) hold.push(f);
				this.lastHideShowLength=this.lastShowLength=hold.length;
				return hold;
			}
		}
	}

	this.hide = function(el, func, hold, d) {
		var f = !func ? '' : func;
		
		if (typeof(el)=='string') el=$(el);
		if (!el.id) el.id="tmp"+uid();
		var id=el.id;
		
		f=f.replace(":id:",el.id);
		
		if (!hold) {
			this.clearTimeout(this.timers.opacity[id]);
			this.timers.opacity[id]=[];
		}
		
		if (!B.ie) {
			var op=parseFloat(el.style.opacity);
			if (isNaN(op)) op=1;
			if (op==0) {
				el.style.visibility='hidden';
				return hold;
			}
			if (op<1) var start=(op-0.1)*10;
			else {
				el.style.opacity=0.9;
				var start=8;
			}
			
			var n=1;
			if (!hold) {
				for (var i=start;i>=0;i--,n++) {
					this.timers.opacity[id].push(setTimeout("$('"+id+"').style.opacity="+(i/10), n*d));
				}
				this.timers.opacity[id].push(setTimeout(
					"$('"+id+"').style.visibility='hidden';"+f, n*d));
			} else {
				for (var i=start;i>=0;i--) {
					hold.push("$('"+id+"').style.opacity="+(i/10)+";");
				}
				hold.push("$('"+id+"').style.visibility='hidden';"+f);
				this.lastHideShowLength=this.lastHideLength=hold.length;
				return hold;
			}	
		} else {
			var op=el.style.filter;
			if (op) op=parseInt(op.substring(14, op.indexOf(')')));
			else op=100;
			
			if (op==0) {
				el.style.visibility='hidden';
				return hold;
			}
		
			if (op<100) var start=(op-10)/10;
			else {
				el.style.filter="alpha(opacity=90)";
				var start=8;
			}
			
			var n=1;
			if (!hold) {
				for (var i=start;i>=0;i--,n++) {
					this.timers.opacity[id].push(setTimeout(
						"$('"+id+"').style.filter='alpha(opacity="+(i*10)+")';", n*d));
				}
				this.timers.opacity[id].push(setTimeout(
					"$('"+id+"').style.visibility='hidden';$('"+id+"').style.filter='';"+f, n*d+timeout));
			} else {
				for (var i=start;i>=0;i--) {
					hold.push("$('"+id+"').style.filter='alpha(opacity="+(i*10)+")';");
				}
				hold.push("$('"+id+"').style.visibility='hidden';$('"+id+"').style.filter='';"+f);
				this.lastHideShowLength=this.lastHideLength=hold.length;
				return hold;
			}	
		}
	}

	//================         AJAX                  ================ {

	function _Request(method, url, frontend, data, sync, hold, if_error) {
		var async = !sync ? true : false;
	    var rq;
	    try {
			rq = new XMLHttpRequest();
		} catch (trymicrosoft) {
			try {
				rq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (othermicrosoft) {
				try {
					rq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (failed) {
					rq = false;
				}
			}
		}
		if (!rq) {
			alert("Error! Can't create XMLHttpRequest object. If you are using an old version of browser, please update it. Otherwise, the problem may occur if ActiveX is turned off.");
			if (if_error) if_error();
		}

		rq.open(method, url, async);
		if (method=='post') rq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		rq.onreadystatechange = function() {
			if (rq.readyState == 4) {
				if (rq.status == 200) {
					if (rq.responseText.indexOf("<!--error-->")!=-1) {
						var e=rq.responseText.substring(12, rq.responseText.indexOf("<!--/error-->"));
						alert("Error.\n"+e);
					}
					frontend();
				} else if (rq.status == 404) {
					alert("Error 404. File not found.");
					if (if_error) if_error();
				} else {
					alert("Error " + rq.status + ".");
					if (if_error) if_error();
				}
			}
		}
		var cont = (!data) ? null : urlEncodeData(data);
	
		if (!hold) rq.send(cont);

	    return rq;
	}

	function mySubmit(form, frontend) {
		var data=[];
		for (var i=0;i<form.elements.length;i++) {
			if (form.elements[i].name.substr(0,4)=="skip") continue;
			if (form.elements[i].nodeName!="SELECT") data[form.elements[i].name]=form.elements[i].value;
			else data[form.elements[i].name]=form.elements[i].options[form.elements[i].selectedIndex].value;
		}	
		var rq=_Request("post", form.action, frontend, data);
		return rq;
	}

	function urlEncodeData(data) {
	    var query = [];
		var encodeArray = function(obj, keys, name) {
			for (var key in obj) {
				if (obj[key] instanceof Object) {
					var n_keys = keys.slice(0);
					n_keys.push(key);
					encodeArray(obj[key], n_keys, name);
				} else {
					var indexes="";
					for (var i=0;i<keys.length;i++) {
						indexes+="["+encodeURIComponent(keys[i])+"]";
					}
					indexes+="["+encodeURIComponent(key)+"]";
					query.push(name+indexes+"="+encodeURIComponent(obj[key]));
				}
			}
		}
	    if (data instanceof Object) {
	        for (var k in data) { 
				if (data[k] instanceof Object) {
					encodeArray(data[k], [], encodeURIComponent(k));
				} else query.push(encodeURIComponent(k) + "=" + encodeURIComponent(data[k]));
	        }
			return query.join('&');
	    } else {
	        return data;
	    }
	}

	//    /AJAX    == }

}

//    /Basic Functions    == }

//===================         Global Variables          =================== {

doPageCustomers=true;
slidingInterval=null;
customersInterval=null;
isFootPopup=false;
footPopupProgress=false;

//    /Global Variables    == }

//===================         Fade Replacements         =================== {

G.init[G.init.length] = function() {
	if ($('customers')) {
		var div=$('customers');
		customersInterval=setInterval("page_customers();", 5000);
		div.onmouseover = function() {
			doPageCustomers=false;
		}
		div.onmouseout = function() {
			doPageCustomers=true;
		}
		for (var el=div.firstChild;el.id!="customers_read_more";el=el.nextSibling) {
			el.style.opacity = el.className!="customer_active" ? 0 : 1;
			el.style.visibility = el.className!="customer_active" ? "hidden" : "visible";
		}
	}
}

function next_customer() {
	clearInterval(customersInterval);
	doPageCustomers=true;
	page_customers();
	doPageCustomers=false;
	customersInterval=setInterval("page_customers();", 5000);
}

function page_customers() {
	if (!doPageCustomers) return;
	var div=$('customers');
	for (var el=div.firstChild;el.id!="customers_read_more";el=el.nextSibling) {
		if (el.className=='customer_active') {
			if (el.nextSibling.id=="customers_read_more") {
				var nextOne=div.firstChild;
			} else {
				var nextOne=el.nextSibling;
			}
			var currentOne=el;
		}
	}
	nextOne.className='customer_active';
	currentOne.className='customer';
	if (!B.ie) {
		var fade1 = G.hide(currentOne, false, []);
		var fade2 = G.show(nextOne, false, []);
		var len = Math.max(fade1.length,fade2.length);
	
		for(var i=0,n=1;i<len;i++,n++) {
			setTimeout((fade1[i] || "") + (fade2[i] || ""), n*50);
		}
	} else {
		var fade1 = G.hide(currentOne.firstChild, false, []);
		var fade2 = G.hide(currentOne.childNodes[1], false, []);
		var fade3 = G.hide(currentOne.childNodes[2].firstChild, false, []);
		var fade4 = G.show(nextOne.firstChild, false, []);
		var fade5 = G.show(nextOne.childNodes[1], false, []);
		var fade6 = G.show(nextOne.childNodes[2].firstChild, false, []);
		var len = Math.max(fade1.length,fade4.length);
		
		for(var i=0,n=1;i<len;i++,n++) {
			setTimeout((fade1[i] || "") + (fade2[i] || "") + (fade3[i] || "") + (fade4[i] || "") + (fade5[i] || "") + (fade6[i] || ""), n*50);
		}
	}
}

function portfolio_slide(pos, el) {
	if (el.parentNode.className==el.id) return;
	el.parentNode.className=el.id;
	$('all_services').firstChild.href="services/"+el.id+"/";
	
	pos*=-512;
	if (!$('portfolio_cont').style.left) $('portfolio_cont').style.left="0px";
	var cur=parseFloat($('portfolio_cont').style.left.replace("px",""));
	clearInterval(slidingInterval);
	if (pos<cur) {
		slidingInterval=setInterval("var cur=parseFloat($('portfolio_cont').style.left.replace('px',''));"+
			"$('portfolio_cont').style.left=(cur-64)+'px';"+
			"if (cur-64=="+pos+") clearInterval(slidingInterval);", 30)
	} else {
		slidingInterval=setInterval("var cur=parseFloat($('portfolio_cont').style.left.replace('px',''));"+
			"$('portfolio_cont').style.left=(cur+64)+'px';"+
			"if (cur+64=="+pos+") clearInterval(slidingInterval);", 30)
	}
}

function portfolio_tab(el) {
	if (el.parentNode.className==el.id) return;
	var cont1 = $('portfolio_'+el.parentNode.className);
	var cont2 = $('portfolio_'+el.id);
	
	var ar = []
	ar[el.parentNode.className]=ar[el.id]=true;
	if (ar['create'] && ar['publish']) var cont3=$('portfolio_promote');
	else if (ar['create'] && ar['promote']) var cont3=$('portfolio_publish');
	else if (ar['publish'] && ar['promote']) var cont3=$('portfolio_create');
	
	el.parentNode.className=el.id;
	$('all_services').firstChild.href="services/"+el.id+"/";
	
	var fade1 = G.hide(cont1, false, []);
	var fade2 = G.show(cont2, false, []);
	var fade3 = G.hide(cont3, false, []);
	var len = Math.max(fade1.length,fade2.length);
	len = Math.max(len,fade3.length);
	
	var opID='home_portfolio_tabs';
	
	G.clearTimeout(G.timers.opacity[opID]);
	G.timers.opacity[opID]=[];
		
	for(var i=0,n=1;i<len;i++,n++) {
		G.timers.opacity[opID].push(setTimeout((fade1[i] || "") + (fade2[i] || "") + (fade3[i] || ""), n*50));
	}
}

function switch_latest(next) {
	var div=$('latest_cont');
	var actions=[];
	var len=0;
	if (!B.ie) {
		for (var i=0;i<div.childNodes.length;i++) {
			var el=div.childNodes[i];
			if (el.className=='latest_cont_active') {
				actions.push(G.hide(el, false, []));
				var current=el;
			} else {
				if (next) {
					if (i==div.childNodes.length-1) {
						if (div.firstChild.className=='latest_cont_active') {
							actions.push(G.show(el, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el, false, []));
						}
					} else {
						if (el.nextSibling.className=='latest_cont_active') {
							actions.push(G.show(el, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el, false, []));
						}
					}
				} else {
					if (i==0) {
						if (div.lastChild.className=='latest_cont_active') {
							actions.push(G.show(el, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el, false, []));
						}
					} else {
						if (el.previousSibling.className=='latest_cont_active') {
							actions.push(G.show(el, false, []));
							var newOne=el;
						} else {
					    	actions.push(G.hide(el, false, []));
						}
					}
				}
			}
			if (G.lastHideShowLength>len) len=G.lastHideShowLength;
		}
	} else {
		for (var i=0;i<div.childNodes.length;i++) {
			var el=div.childNodes[i];
			el.style.visibility="visible";
			if (el.className=='latest_cont_active') {
				actions.push(G.hide(el.lastChild.firstChild, "", []));
				actions.push(G.hide(el.firstChild, "", []));
				var current=el;
			} else {
				if (next) {
					if (i==div.childNodes.length-1) {
						if (div.firstChild.className=='latest_cont_active') {
							actions.push(G.show(el.lastChild.firstChild, false, []));
							actions.push(G.show(el.firstChild, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el.lastChild.firstChild, "", []));
							actions.push(G.hide(el.firstChild, "", []));
						}
					} else {
						if (el.nextSibling.className=='latest_cont_active') {
							actions.push(G.show(el.lastChild.firstChild, false, []));
							actions.push(G.show(el.firstChild, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el.lastChild.firstChild, "", []));
							actions.push(G.hide(el.firstChild, "", []));
						}
					}
				} else {
					if (i==0) {
						if (div.lastChild.className=='latest_cont_active') {
							actions.push(G.show(el.lastChild.firstChild, false, []));
							actions.push(G.show(el.firstChild, false, []));
							var newOne=el;
						} else {
							actions.push(G.hide(el.lastChild.firstChild, "", []));
							actions.push(G.hide(el.firstChild, "", []));
						}
					} else {
						if (el.previousSibling.className=='latest_cont_active') {
							actions.push(G.show(el.lastChild.firstChild, false, []));
							actions.push(G.show(el.firstChild, false, []));
							var newOne=el;
						} else {
					    	actions.push(G.hide(el.lastChild.firstChild, "", []));
							actions.push(G.hide(el.firstChild, "", []));
						}
					}
				}
			}
			if (G.lastHideShowLength>len) len=G.lastHideShowLength;
		}
	}	
	current.className="latest_cont";
	current.style.visibility="visible";
	newOne.className="latest_cont_active";
	newOne.lastChild.firstChild.style.visibility="visible";
	
	var opID='home_latest_switcher';

	G.clearTimeout(G.timers.opacity[opID]);
	G.timers.opacity[opID]=[];

	for(var i=0,n=1;i<len;i++,n++) {
		var action="";
		for (var x=0;x<actions.length;x++) {
			action += actions[x][i] || "";
		}
		G.timers.opacity[opID].push(setTimeout(action, n*50));
	}
}

//    /Fade Replacements    == }

//===================         Footer Popup              =================== {

function footer_popup() {	
	if (footPopupProgress) return false;
	if (isFootPopup) return footer_popup_close();
	footPopupProgress=true;
	isFootPopup=true;
	
	var popup=$('foot_popup');
	
	popup.style.clip="rect(433px, 0, auto, auto)";
	
	popup.style.visibility="visible";
	
	var t=Math.round(433/10);
	var r=Math.round(265/10);
	var st=433;
	var sr=0;
	for (var i=1;i<=10;i++) {
		st-=t;
		sr+=r;
		setTimeout("$('foot_popup').style.clip='rect("+st+"px, "+sr+"px, auto, auto)';", i*30);
	}
	setTimeout("$('foot_popup').style.clip='rect(0px, 265px, auto, auto)';footPopupProgress=false;", i*30);
}

function footer_popup_close() {
	if (!isFootPopup) return false;
	if (footPopupProgress) return false;
	footPopupProgress=true;
	isFootPopup=false;
	
	var popup=$('foot_popup');
	
	popup.style.clip="rect(0, 265px, auto, auto)";
	
	popup.style.visibility="visible";
	
	var t=Math.round(433/10);
	var r=Math.round(265/10);
	var st=0;
	var sr=265;
	for (var i=1;i<=10;i++) {
		st+=t;
		sr-=r;
		setTimeout("$('foot_popup').style.clip='rect("+st+"px, "+sr+"px, auto, auto)';", i*30);
	}
	setTimeout("$('foot_popup').style.clip='rect(433px, 0, auto, auto)';$('foot_popup').style.visibility='hidden';footPopupProgress=false;", i*30);
}

//    /Footer Popup       == }
