// SWFObject 2.2 - http://code.google.com/p/swfobject/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 1M=9(){5 w="2U",J="2f",21="2X 2R",2Q="2P.2P",1x="3o/x-3K-3X",23="3d",2b="3s",C=2K,y=32,12=3e,29=D,1v=[2J],W=[],1s=[],1d=[],1i,1w,1Y,2h,15=D,1q=D,Q,1X,28=H,7=9(){5 b=A y.K!=w&&A y.14!=w&&A y.N!=w,u=12.3f.Y(),p=12.3z.Y(),2I=p?/C/.U(p):/C/.U(u),1a=p?/1a/.U(p):/1a/.U(u),1U=/1U/.U(u)?39(u.1k(/^.*1U\\/(\\d+(\\.\\d+)?).*$/,"$1")):D,E=!+"\\3q",1j=[0,0,0],d=G;3(A 12.2i!=w&&A 12.2i[21]==J){d=12.2i[21].31;3(d&&!(A 12.2m!=w&&12.2m[1x]&&!12.2m[1x].33)){29=H;E=D;d=d.1k(/^.*\\s+(\\S+\\s+\\S+$)/,"$1");1j[0]=I(d.1k(/^(.*)\\..*$/,"$1"),10);1j[1]=I(d.1k(/^.*\\.(.*)\\s.*$/,"$1"),10);1j[2]=/[a-2F-Z]/.U(d)?I(d.1k(/^.*[a-2F-Z]+(.*)$/,"$1"),10):0}}z 3(A C.2E!=w){1N{5 a=2Z 2E(2Q);3(a){d=a.2k("$2D");3(d){E=H;d=d.1e(" ")[1].1e(",");1j=[I(d[0],10),I(d[1],10),I(d[2],10)]}}}1L(e){}}B{11:b,1b:1j,P:1U,E:E,C:2I,1a:1a}}(),3r=9(){3(!7.11){B}3((A y.R!=w&&y.R=="2c")||(A y.R==w&&(y.14("1J")[0]||y.1J))){1c()}3(!15){3(A y.1l!=w){y.1l("2Y",1c,D)}3(7.E&&7.C){y.1I(2b,9(){3(y.R=="2c"){y.2C(2b,18.19);1c()}});3(C==34){(9(){3(15){B}1N{y.35.36("37")}1L(e){1m(18.19,0);B}1c()})()}}3(7.P){(9(){3(15){B}3(!/3c|2c/.U(y.R)){1m(18.19,0);B}1c()})()}1H(1c)}}();9 1c(){3(15){B}1N{5 t=y.14("1J")[0].1h(N("3g"));t.O.1o(t)}1L(e){B}15=H;5 a=1v.L;F(5 i=0;i<a;i++){1v[i]()}}9 1F(a){3(15){a()}z{1v[1v.L]=a}}9 1H(a){3(A C.1l!=w){C.1l("2B",a,D)}z 3(A y.1l!=w){y.1l("2B",a,D)}z 3(A C.1I!=w){2y(C,"1u",a)}z 3(A C.1u=="9"){5 b=C.1u;C.1u=9(){b();a()}}z{C.1u=a}}9 2J(){3(29){2x()}z{1C()}}9 2x(){5 b=y.14("1J")[0];5 o=N(J);o.V("24",1x);5 t=b.1h(o);3(t){5 a=0;(9(){3(A t.2k!=w){5 d=t.2k("$2D");3(d){d=d.1e(" ")[1].1e(",");7.1b=[I(d[0],10),I(d[1],10),I(d[2],10)]}}z 3(a<10){a++;1m(18.19,10);B}b.1o(o);t=G;1C()})()}z{1C()}}9 1C(){5 a=W.L;3(a>0){F(5 i=0;i<a;i++){5 b=W[i].M;5 c=W[i].2w;5 d={1f:D,M:b};3(7.1b[0]>0){5 e=K(b);3(e){3(1y(W[i].2v)&&!(7.P&&7.P<1B)){13(b,H);3(c){d.1f=H;d.2j=1r(b);c(d)}}z 3(W[i].2l&&1E()){5 f={};f.1G=W[i].2l;f.17=e.X("17")||"0";f.16=e.X("16")||"0";3(e.X("1A")){f.25=e.X("1A")}3(e.X("27")){f.27=e.X("27")}5 g={};5 p=e.14("22");5 h=p.L;F(5 j=0;j<h;j++){3(p[j].X("1P").Y()!="2d"){g[p[j].X("1P")]=p[j].X("2e")}}1z(f,g,b,c)}z{2u(e);3(c){c(d)}}}}z{13(b,H);3(c){5 o=1r(b);3(o&&A o.2s!=w){d.1f=H;d.2j=o}c(d)}}}}}9 1r(a){5 r=G;5 o=K(a);3(o&&o.1T=="J"){3(A o.2s!=w){r=o}z{5 n=o.14(J)[0];3(n){r=n}}}B r}9 1E(){B!1q&&1y("6.0.3p")&&(7.C||7.1a)&&!(7.P&&7.P<1B)}9 1z(a,b,c,d){1q=H;1Y=d||G;2h={1f:D,M:c};5 e=K(c);3(e){3(e.1T=="J"){1i=1V(e);1w=G}z{1i=e;1w=c}a.M=23;3(A a.17==w||(!/%$/.U(a.17)&&I(a.17,10)<2r)){a.17="2r"}3(A a.16==w||(!/%$/.U(a.16)&&I(a.16,10)<2A)){a.16="2A"}y.2o=y.2o.3A(0,3B)+" - 2R 3E 3F";5 f=7.E&&7.C?"3H":"3J",2p="3N="+C.2n.3Y().1k(/&/g,"%26")+"&2V="+f+"&2W="+y.2o;3(A b.1n!=w){b.1n+="&"+2p}z{b.1n=2p}3(7.E&&7.C&&e.R!=4){5 g=N("2g");c+="30";g.V("M",c);e.O.2t(g,e);e.1g.1K="20";(9(){3(e.R==4){e.O.1o(e)}z{1m(18.19,10)}})()}1t(a,b,c)}}9 2u(a){3(7.E&&7.C&&a.R!=4){5 b=N("2g");a.O.2t(b,a);b.O.1D(1V(a),b);a.1g.1K="20";(9(){3(a.R==4){a.O.1o(a)}z{1m(18.19,10)}})()}z{a.O.1D(1V(a),a)}}9 1V(a){5 b=N("2g");3(7.C&&7.E){b.2z=a.2z}z{5 d=a.14(J)[0];3(d){5 c=d.38;3(c){5 e=c.L;F(5 i=0;i<e;i++){3(!(c[i].2q==1&&c[i].1T=="3a")&&!(c[i].2q==8)){b.1h(c[i].3b(H))}}}}}B b}9 1t(a,b,c){5 r,1p=K(c);3(7.P&&7.P<1B){B r}3(1p){3(A a.M==w){a.M=c}3(7.E&&7.C){5 d="";F(5 i T a){3(a[i]!=1O.1R[i]){3(i.Y()=="1G"){b.2d=a[i]}z 3(i.Y()=="25"){d+=\' 1A="\'+a[i]+\'"\'}z 3(i.Y()!="2a"){d+=\' \'+i+\'="\'+a[i]+\'"\'}}}5 e="";F(5 j T b){3(b[j]!=1O.1R[j]){e+=\'<22 1P="\'+j+\'" 2e="\'+b[j]+\'" />\'}}1p.3h=\'<2f 2a="3i:3j-3k-3l-3m-3n"\'+d+\'>\'+e+\'</2f>\';1s[1s.L]=a.M;r=K(a.M)}z{5 o=N(J);o.V("24",1x);F(5 m T a){3(a[m]!=1O.1R[m]){3(m.Y()=="25"){o.V("1A",a[m])}z 3(m.Y()!="2a"){o.V(m,a[m])}}}F(5 n T b){3(b[n]!=1O.1R[n]&&n.Y()!="2d"){2G(o,n,b[n])}}1p.O.1D(o,1p);r=o}}B r}9 2G(a,b,c){5 p=N("22");p.V("1P",b);p.V("2e",c);a.1h(p)}9 1W(a){5 b=K(a);3(b&&b.1T=="J"){3(7.E&&7.C){b.1g.1K="20";(9(){3(b.R==4){2H(a)}z{1m(18.19,10)}})()}z{b.O.1o(b)}}}9 2H(a){5 b=K(a);3(b){F(5 i T b){3(A b[i]=="9"){b[i]=G}}b.O.1o(b)}}9 K(a){5 b=G;1N{b=y.K(a)}1L(e){}B b}9 N(a){B y.N(a)}9 2y(a,b,c){a.1I(b,c);1d[1d.L]=[a,b,c]}9 1y(a){5 b=7.1b,v=a.1e(".");v[0]=I(v[0],10);v[1]=I(v[1],10)||0;v[2]=I(v[2],10)||0;B(b[0]>v[0]||(b[0]==v[0]&&b[1]>v[1])||(b[0]==v[0]&&b[1]==v[1]&&b[2]>=v[2]))?H:D}9 1S(a,b,c,d){3(7.E&&7.1a){B}5 h=y.14("3t")[0];3(!h){B}5 m=(c&&A c=="3u")?c:"3v";3(d){Q=G;1X=G}3(!Q||1X!=m){5 s=N("1g");s.V("24","3w/3x");s.V("3y",m);Q=h.1h(s);3(7.E&&7.C&&A y.1Q!=w&&y.1Q.L>0){Q=y.1Q[y.1Q.L-1]}1X=m}3(7.E&&7.C){3(Q&&A Q.2L==J){Q.2L(a,b)}}z{3(Q&&A y.2M!=w){Q.1h(y.2M(a+" {"+b+"}"))}}}9 13(a,b){3(!28){B}5 v=b?"3C":"3D";3(15&&K(a)){K(a).1g.2N=v}z{1S("#"+a,"2N:"+v)}}9 1Z(s){5 a=/[\\\\\\"<>\\.;]/;5 b=a.3G(s)!=G;B b&&A 2O!=w?2O(s):s}5 x=9(){3(7.E&&7.C){2K.1I("3I",9(){5 a=1d.L;F(5 i=0;i<a;i++){1d[i][0].2C(1d[i][1],1d[i][2])}5 b=1s.L;F(5 j=0;j<b;j++){1W(1s[j])}F(5 k T 7){7[k]=G}7=G;F(5 l T 1M){1M[l]=G}1M=G})}}();B{3L:9(a,b,c,d){3(7.11&&a&&b){5 e={};e.M=a;e.2v=b;e.2l=c;e.2w=d;W[W.L]=e;13(a,D)}z 3(d){d({1f:D,M:a})}},1r:9(a){3(7.11){B 1r(a)}},3M:9(d,e,f,g,h,l,m,n,o,p){5 q={1f:D,M:e};3(7.11&&!(7.P&&7.P<1B)&&d&&e&&f&&g&&h){13(e,D);1F(9(){f+="";g+="";5 a={};3(o&&A o===J){F(5 i T o){a[i]=o[i]}}a.1G=d;a.17=f;a.16=g;5 b={};3(n&&A n===J){F(5 j T n){b[j]=n[j]}}3(m&&A m===J){F(5 k T m){3(A b.1n!=w){b.1n+="&"+k+"="+m[k]}z{b.1n=k+"="+m[k]}}}3(1y(h)){5 c=1t(a,b,e);3(a.M==e){13(e,H)}q.1f=H;q.2j=c}z 3(l&&1E()){a.1G=l;1z(a,b,e,p);B}z{13(e,H)}3(p){p(q)}})}z 3(p){p(q)}},3O:9(){28=D},7:7,3P:9(){B{3Q:7.1b[0],3R:7.1b[1],3S:7.1b[2]}},3T:1y,1t:9(a,b,c){3(7.11){B 1t(a,b,c)}z{B 2U}},1z:9(a,b,c,d){3(7.11&&1E()){1z(a,b,c,d)}},1W:9(a){3(7.11){1W(a)}},1S:9(a,b,c,d){3(7.11){1S(a,b,c,d)}},1F:1F,1H:1H,3U:9(a){5 q=y.2n.3V||y.2n.3W;3(q){3(/\\?/.U(q)){q=q.1e("?")[1]}3(a==G){B 1Z(q)}5 b=q.1e("&");F(5 i=0;i<b.L;i++){3(b[i].2S(0,b[i].2T("="))==a){B 1Z(b[i].2S((b[i].2T("=")+1)))}}}B""},3Z:9(){3(1q){5 a=K(23);3(a&&1i){a.O.1D(1i,a);3(1w){13(1w,H);3(7.E&&7.C){1i.1g.1K="40"}}3(1Y){1Y(2h)}}1q=D}}}}();',62,249,'|||if||var||ua||function|||||||||||||||||||||||||doc|else|typeof|return|win|false|ie|for|null|true|parseInt|OBJECT|getElementById|length|id|createElement|parentNode|wk|dynamicStylesheet|readyState||in|test|setAttribute|regObjArr|getAttribute|toLowerCase|||w3|nav|setVisibility|getElementsByTagName|isDomLoaded|height|width|arguments|callee|mac|pv|callDomLoadFunctions|listenersArr|split|success|style|appendChild|storedAltContent|playerVersion|replace|addEventListener|setTimeout|flashvars|removeChild|el|isExpressInstallActive|getObjectById|objIdArr|createSWF|onload|domLoadFnArr|storedAltContentId|FLASH_MIME_TYPE|hasPlayerVersion|showExpressInstall|class|312|matchVersions|replaceChild|canExpressInstall|addDomLoadEvent|data|addLoadEvent|attachEvent|body|display|catch|swfobject|try|Object|name|styleSheets|prototype|createCSS|nodeName|webkit|abstractAltContent|removeSWF|dynamicStylesheetMedia|storedCallbackFn|urlEncodeIfNecessary|none|SHOCKWAVE_FLASH|param|EXPRESS_INSTALL_ID|type|styleclass||align|autoHideShow|plugin|classid|ON_READY_STATE_CHANGE|complete|movie|value|object|div|storedCallbackObj|plugins|ref|GetVariable|expressInstall|mimeTypes|location|title|fv|nodeType|310|SetVariable|insertBefore|displayAltContent|swfVersion|callbackFn|testPlayerVersion|addListener|innerHTML|137|load|detachEvent|version|ActiveXObject|zA|createObjParam|removeObjectInIE|windows|main|window|addRule|createTextNode|visibility|encodeURIComponent|ShockwaveFlash|SHOCKWAVE_FLASH_AX|Flash|substring|indexOf|undefined|MMplayerType|MMdoctitle|Shockwave|DOMContentLoaded|new|SWFObjectNew|description|document|enabledPlugin|top|documentElement|doScroll|left|childNodes|parseFloat|PARAM|cloneNode|loaded|SWFObjectExprInst|navigator|userAgent|span|outerHTML|clsid|D27CDB6E|AE6D|11cf|96B8|444553540000|application|65|v1|onDomLoad|onreadystatechange|head|string|screen|text|css|media|platform|slice|47|visible|hidden|Player|Installation|exec|ActiveX|onunload|PlugIn|shockwave|registerObject|embedSWF|MMredirectURL|switchOffAutoHideShow|getFlashPlayerVersion|major|minor|release|hasFlashPlayerVersion|getQueryParamValue|search|hash|flash|toString|expressInstallCallback|block'.split('|'),0,{}))

if (typeof window.console === 'undefined') {
	window.console = {
		log: function () {
			void(0);
		}
	};
}

var hoverTime;
function hideDropDownMenu(dropDownMenu) {
	$(dropDownMenu)
		.hide()
	;
}

function promoSlide(max) {
	$('#promoPanel')
		.html(
			$('#promo' + index).html()
		)
	;
	index++;
	if (index > max) {
		index = 1;
	}
}

jQuery(function($) {
	var currContentHeight = 0;
	var maxContentHeight = 0;
	var currTitleHeight = 0;
	var maxTitleHeight = 0;
	var rowLeveler = $('.rowLeveler');
	rowLeveler.each(function() {
		var titleLeveler = $(this).find('.titleLeveler');
		titleLeveler.each(function() {
			currTitleHeight = $(this).height();
			//console.log(this, 'title height:', currTitleHeight, 'px');
			if (currTitleHeight > maxTitleHeight) {
				maxTitleHeight = currTitleHeight;
			}
		});
		titleLeveler.height(maxTitleHeight);
		//console.log('Setting all above objects\' title height to:', maxTitleHeight, 'px');
		currTitleHeight = 0;
		maxTitleHeight = 0;

		var contentLeveler = $(this).find('.contentLeveler');
		contentLeveler.each(function() {
			currContentHeight = $(this).height();
			//console.log(this, 'content height:', currContentHeight, 'px');
			if (currContentHeight > maxContentHeight) {
				maxContentHeight = currContentHeight;
			}
		});
		contentLeveler.height(maxContentHeight);
		//console.log('Setting all above objects\' content height to:', maxContentHeight, 'px');
		currContentHeight = 0;
		maxContentHeight = 0;
	});

	/*$('input:text')
		.hint()
	;*/

	$('.target_blank')
		.attr('target', '_blank')
	;

	$('.submitCheck')
		.attr('value', '1')
	;

	$('a.inputButton')
		.click(function() {
			$(this)
				.parents('form')
					.submit()
			;
		})
	;

	var confirmCode = $('.confirmCode');
	confirmCode
		.click(function () {
			var src = $(this).attr('src');
			var pos = src.lastIndexOf('?');
			if (pos === -1) {
			    pos = src.length;
			}
			src = src.substring(0, pos);
			$(this)
				.attr('src', src + '?' + Math.round(Math.random() * 9999999999));
		})
	;

	var dropMenuShower = $('.dropMenuShower');
	dropMenuShower.not('.clickable')
		.click(function(e) {
			e.preventDefault();
		})
	;
	dropMenuShower
		.hover(function() {
			dropMenuShowerXPos = $(this).position().left;
			dropMenuShowerYPos = $(this).position().top;
			dropMenuShowerWidth = $(this).width();
			dropMenuShowerWidthHalf = $(this).width() / 2;
			dropMenuShowerHeight = $(this).height();
			dropDownMenu = '#' + $(this).attr('id') + 'Drop';
			dropMenuWidthHalf = $(dropDownMenu).width() / 2;
			$(dropDownMenu)
				.css('left', dropMenuShowerXPos + dropMenuShowerWidthHalf - dropMenuWidthHalf)
				.css('top', dropMenuShowerYPos + dropMenuShowerHeight)
				.show()
			;
			if (!$(this).parent('.dropDownMenu').hasClass('.level2')) {
				$('.dropDownMenu .level2').hide();
			}
			else {
				$('.level2 .level2').hide();
			}
			menuLevel2 = $(this).next('.level2');
			menuLevel2
				.css('left', dropMenuShowerXPos + dropMenuShowerWidth + 3)
				.css('top', dropMenuShowerYPos)
				.show()
			;
		}, function() {
			hoverTime = setTimeout("hideDropDownMenu(dropDownMenu)", 1);
		})
	;
	$('.dropDownMenu')
		.hover(function() {
			clearTimeout(hoverTime);
		}, function() {
			$(this)
				.hide()
			;
		})
	;

	var flashvars = {};
	var params = {
		play: 'true',
		loop: 'true',
		menu: 'false',
		quality: 'best',
		scale: 'showall',
		wmode: 'transparent',
		bgcolor: '#fff'
	};
	var attributes = {};
	swfobject.embedSWF('/flash/bite.swf', 'flashBite', '580', '67', '9.0.0', false, flashvars, params, attributes);

	var body = $('body');
	var defaultFontSize = 3;
	var currentFontSize = $.cookie('CT_FS');
	if (currentFontSize != null) {
		body.removeAttr('class');
		body.addClass('fs' + currentFontSize);
	}
	else {
		currentFontSize = defaultFontSize;
	}
	currentFontSize = parseInt(currentFontSize);
	$('#fontChange .fontInc')
		.click(function(e) {
			e.preventDefault();
			if (currentFontSize + 1 <= 5) {
				body.removeAttr('class');
				currentFontSize++;
				body.addClass('fs' + currentFontSize);
			}
			$.cookie('CT_FS', currentFontSize, { path: '/', expires: 365 });
		})
	;
	$('#fontChange .fontDec')
		.click(function(e) {
			e.preventDefault();
			if (currentFontSize - 1 >= 1) {
				body.removeAttr('class');
				currentFontSize--;
				body.addClass('fs' + currentFontSize);
			}
			$.cookie('CT_FS', currentFontSize, { path: '/', expires: 365 });
		})
	;
	$('#fontChange .fontDef')
		.click(function(e) {
			e.preventDefault();
			body.removeAttr('class');
			currentFontSize = defaultFontSize;
			body.addClass('fs' + currentFontSize);
			$.cookie('CT_FS', currentFontSize, { path: '/', expires: 365 });
		})
	;

	$('#servicesMenu .level2').prev('a').not('.clickable')
		.click(function(e) {
			e.preventDefault();
			$(this)
				.siblings('.level2')
					.slideUp(200)
				.end()
				.next('.level2')
					.slideToggle(200)
			;
		})
	;

	index = 1;
	setInterval("promoSlide(1)", 6000);
});
