$(document).ready(function(){



/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */
/*hoverIntent.js*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode}catch(e){p=this}}if(p==this){return false}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.mouseover(handleHover).mouseout(handleHover)}})(jQuery);
/*superfish.js*/
;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl()},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path)}},o.delay)},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone())};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass)});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this))}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li)}).blur(function(){out.call($li)})});o.onInit.call(this)}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '))})};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)this.toggleClass(sf.c.shadowClass+'-off')};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul)});return this}})})(jQuery);
/*Supersubs v0.2b*/
;(function($){$.fn.supersubs=function(options){var opts=$.extend({},$.fn.supersubs.defaults,options);return this.each(function(){var $$=$(this);var o=$.meta?$.extend({},opts,$$.data()):opts;var fontsize=$('<li id="menu-fontsize">&#8212;</li>').css({'padding':0,'position':'absolute','top':'-999em','width':'auto'}).appendTo($$).width();$('#menu-fontsize').remove();$ULs=$$.find('ul');$ULs.each(function(i){var $ul=$ULs.eq(i);var $LIs=$ul.children();var $As=$LIs.children('a');var liFloat=$LIs.css('white-space','nowrap').css('float');var emWidth=$ul.add($LIs).add($As).css({'float':'none','width':'auto'}).end().end()[0].clientWidth/fontsize;emWidth+=o.extraWidth;if(emWidth>o.maxWidth){emWidth=o.maxWidth}else if(emWidth<o.minWidth){emWidth=o.minWidth}emWidth+='em';$ul.css('width',emWidth);$LIs.css({'float':liFloat,'width':'100%','white-space':'normal'}).each(function(){var $childUl=$('>ul',this);var offsetDirection=$childUl.css('left')!==undefined?'left':'right';$childUl.css(offsetDirection,emWidth)})})})};$.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);

/** jQuery: Background-Position Animation Plugin
 * @author Alexander Farkas
 * v. 1.21
 */
(function($){if(!document.defaultView||!document.defaultView.getComputedStyle){var oldCurCSS=jQuery.curCSS;jQuery.curCSS=function(elem,name,force){if(name==='background-position'){name='backgroundPosition';}
if(name!=='backgroundPosition'||!elem.currentStyle||elem.currentStyle[name]){return oldCurCSS.apply(this,arguments);}
var style=elem.style;if(!force&&style&&style[name]){return style[name];}
return oldCurCSS(elem,'backgroundPositionX',force)+' '+oldCurCSS(elem,'backgroundPositionY',force);};}
var oldAnim=$.fn.animate;$.fn.animate=function(prop){if('background-position'in prop){prop.backgroundPosition=prop['background-position'];delete prop['background-position'];}
if('backgroundPosition'in prop){prop.backgroundPosition='('+prop.backgroundPosition;}
return oldAnim.apply(this,arguments);};function toArray(strg){strg=strg.replace(/left|top/g,'0px');strg=strg.replace(/right|bottom/g,'100%');strg=strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");var res=strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return[parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];}
$.fx.step.backgroundPosition=function(fx){if(!fx.bgPosReady){var start=$.curCSS(fx.elem,'backgroundPosition');if(!start){start='0px 0px';}
start=toArray(start);fx.start=[start[0],start[2]];var end=toArray(fx.options.curAnim.backgroundPosition);fx.end=[end[0],end[2]];fx.unit=[end[1],end[3]];fx.bgPosReady=true;}
var nowPosX=[];nowPosX[0]=((fx.end[0]-fx.start[0])*fx.pos)+fx.start[0]+fx.unit[0];nowPosX[1]=((fx.end[1]-fx.start[1])*fx.pos)+fx.start[1]+fx.unit[1];fx.elem.style.backgroundPosition=nowPosX[0]+' '+nowPosX[1];};})(jQuery);

/* Created by Martin Hintzmann 2008 martin [a] hintzmann.dk
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 * Version: 0.2
 * Requires: jQuery 1.2+
 * http://plugins.jquery.com/project/textshadow
 */
(function($){$.fn.textShadow=function(option){if(!$.browser.msie)return;var IE6=$.browser.version<7;return this.each(function(){var el=$(this);var shadow=el.textShadowParse(this.currentStyle["text-shadow"]);shadow=$.extend(shadow,option);el.textShadowRemove();if(shadow.x==0&&shadow.y==0&&shadow.radius==0)return;if(el.css("position")=="static"){el.css({position:"relative"})}el.css({zIndex:"0"});if(IE6){el.css({zoom:"1"})}var span=document.createElement("span");$(span).addClass("jQueryTextShadow");$(span).html(el.html());$(span).css({padding:this.currentStyle["padding"],width:el.width(),position:"absolute",zIndex:"-1",color:shadow.color!=null?shadow.color:el.css("color"),left:(-parseInt(shadow.radius)+parseInt(shadow.x))+"px",top:(-parseInt(shadow.radius)+parseInt(shadow.y))+"px"});if(shadow.radius!=0){if(shadow.opacity!=null){$(span).css("filter","progid:DXImageTransform.Microsoft.Blur(pixelradius="+parseInt(shadow.radius)+", enabled='true', makeShadow='true', ShadowOpacity="+shadow.opacity+")")}else{$(span).css("filter","progid:DXImageTransform.Microsoft.Blur(pixelradius="+parseInt(shadow.radius)+", enabled='true')")}}el.append(span)})};
	$.fn.textShadowParse = function(value) 
	{
		value = String(value)
			.replace(/^\s+|\s+$/gi, '')
			.replace(/\s*!\s*important/i, '')
			.replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g, '($1/$2/$3/$4)')
			.replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g, '($1/$2/$3)')
var shadow={x:0,y:0,radius:0,color:null};if(value.length>1||value[0].toLowerCase()!='none'){value=value.replace(/\//g,',');var color;if(value.match(/(\#[0-9a-f]{6}|\#[0-9a-f]{3}|(rgb|hsb)a?\([^\)]*\)|\b[a-z]+\b)/i)&&(color=RegExp.$1)){shadow.color=color.replace(/^\s+/,'');value=value.replace(shadow.color,'')}value=value.replace(/^\s+|\s+$/g,'').split(/\s+/).map(function(item){return(item||'').replace(/^0[a-z]*$/,'')?item:0});switch(value.length){case 1:shadow.x=shadow.y=value[0];break;case 2:shadow.x=value[0];shadow.y=value[1];break;case 3:shadow.x=value[0];shadow.y=value[1];shadow.radius=value[2];break}if((!shadow.x&&!shadow.y&&!shadow.radius)||shadow.color=='transparent'){shadow.x=shadow.y=shadow.radius=0;shadow.color=null}}return shadow};$.fn.textShadowRemove=function(){if(!$.browser.msie)return;return this.each(function(){$(this).children("span.jQueryTextShadow").remove()})}})(jQuery);if(typeof Array.prototype.map=='undefined'){Array.prototype.map=function(fnc){var a=new Array(this.length);for(var i=0;i<this.length;i++){a[i]=fnc(this[i])}return a}};

/* ===== MENU superfish ===== */
$("ul.sf-menu").supersubs({
            minWidth:    12,
            maxWidth:    40,
            extraWidth:  1
        }).superfish();

/* ===== SHADOW set for IE ===== */
var option = {
  x:      1, 
  y:      1, 
  radius: 2,
  color:  "#979797"
}
$("h1, h2, h3, h4, h5, h6").textShadow( option );

var option2 = {
  x:      1, 
  y:      -4, 
  radius: 2,
  color:  "#979797"
}
$("ul.sitemap_tree li.page_item a, .info_text b").textShadow( option2 );


/* ===== header ICON HOVER ===== */
$('.i_home')
	.mouseover(function(){
		$('.i_home a').animate({backgroundPosition: '0px -58px'}, {duration:350} );
		})
	.mouseout(function(){
		$('.i_home a').animate({backgroundPosition: '0px -108px'}, {duration:350} );
		});
	
$('.i_sitemap')
	.mouseover(function(){
		$('.i_sitemap a').animate({backgroundPosition: '-70px -58px'}, {duration:350} );
		})
	.mouseout(function(){
		$('.i_sitemap a').animate({backgroundPosition: '-70px -108px'}, {duration:350} );
		});
	
$('.i_twitter')
	.mouseover(function(){
		$('.i_twitter a').animate({backgroundPosition: '-140px -58px'}, {duration:350} );
		})
	.mouseout(function(){
		$('.i_twitter a').animate({backgroundPosition: '-140px -108px'}, {duration:350} );
		});
	
$('.i_draugiem')
	.mouseover(function(){
		$('.i_draugiem a').animate({backgroundPosition: '-209px -58px'}, {duration:350} );
		})
	.mouseout(function(){
		$('.i_draugiem a').animate({backgroundPosition: '-209px -108px'}, {duration:350} );
		});
	
$('.i_searchx')
	.mouseover(function(){
		$('.i_search a').animate({backgroundPosition: '-422px -58px'}, {duration:350} );
		})
	.mouseout(function(){
		$('.i_search a').animate({backgroundPosition: '-422px -108px'}, {duration:350} );
		});


/* ===== SEARCH BOX ===== */
$('.i_search a')
	.click(function(){
		$('#search_box').animate({top: '0px'}, {duration:350} );
		});

$('#search_close')
	.click(function(){
		$('#search_box').animate({top: '-50px'}, {duration:350} );
		});


/* ===== NEWS BOX first page ===== */
$('.l_panel ul:eq(1), .l_panel ul:eq(2), .l_panel ul:eq(3), .l_panel div:eq(1), .l_panel div:eq(2), .l_panel div:eq(3)').hide();
$('.s_panel ul li:eq(0)').css('color', '#4a4a4a');

/* 0 */
$('.s_panel ul li:eq(0)').click(function() {	
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
	$('.xs_panel').css('top', '10px');
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'block');
	$('.s_panel ul li:eq(0)').css('color', '#4a4a4a');		
	$('.s_panel ul li:eq(1)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(2)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(3)').css('color', '#7e7e7e');
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
});

/* 1st */
$('.s_panel ul li:eq(1)').click(function() {	
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
	$('.xs_panel').css('top', '39px');
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'block');
	$('.s_panel ul li:eq(1)').css('color', '#4a4a4a');		
	$('.s_panel ul li:eq(0)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(2)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(3)').css('color', '#7e7e7e');
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
});

/* 2st */
$('.s_panel ul li:eq(2)').click(function() {	
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(1), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
	$('.xs_panel').css('top', '68px');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'block');
	$('.s_panel ul li:eq(2)').css('color', '#4a4a4a');		
	$('.s_panel ul li:eq(0)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(1)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(3)').css('color', '#7e7e7e');
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'none');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'none');
});

/* 3st */
$('.s_panel ul li:eq(3)').click(function() {	
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'none');
	$('.xs_panel').css('top', '97px');
	$('.l_panel ul:eq(3), .l_panel div:eq(3)').css('display', 'block');
	$('.s_panel ul li:eq(3)').css('color', '#4a4a4a');		
	$('.s_panel ul li:eq(0)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(2)').css('color', '#7e7e7e');
	$('.s_panel ul li:eq(1)').css('color', '#7e7e7e');
	$('.l_panel ul:eq(0), .l_panel div:eq(0)').css('display', 'none');
	$('.l_panel ul:eq(2), .l_panel div:eq(2)').css('display', 'none');
	$('.l_panel ul:eq(1), .l_panel div:eq(1)').css('display', 'none');
});

/* ===== SIDEBAR MENU ===== */
$('.sidebar_menu a').hover (
	function(){
		$(this).stop().animate({backgroundPosition: '0px 0px'}, {duration:350} );
	},
	function(){
		$(this).stop().animate({backgroundPosition: '-220px 0px'}, {duration:350} );
	});
	
	
/* ===== MENU dinamic marigin left ===== */
$('.sf-menu').css({'margin-left':((980 -($('.sf-menu').width())))/2+'px'});
	
/* ===== SUROUNDING box ===== */
$('.s_pic_wrap div:eq(0)').css('display', 'block');

$('.surounding_list li').click(function() {
	var index = $('.surounding_list li').index(this);
	$('.s_pic_wrap div').css('display', 'none');										  
	$('.s_pic_wrap div:eq('+index+')').css('display', 'block');
});

/* ===== Fancybox ===== */
$("a[rel=fancyb]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});


/* ===== Why VeA ===== */
function fadeContent() {
  $(".whyvea div:hidden:first").fadeIn(500).delay(2000).fadeOut(500, function() {
    $(this).appendTo($(this).parent());
    fadeContent();
  });
}
fadeContent();





})
