var App={};$(document).ready(function(){try{App.MenuMgr.init();App.BannerMgr.init();App.PortfolioMgr.init();App.AboutUsMgr.init();App.Common.init();}catch(e){}});;App.Common={init:function(){$("a#search_hover_over").fancybox();this.initialize();App.Common.overImage();},initSearch:function(){$('#isci').click(function(){this.form.submit();return false;});},initialize:function(){$('a.arrow_project').click(function(){if($(this).attr('id')=='go_next'){var item=$("ul.items li[rel='"+$(this).attr('rel')+"']").next('li').not('.cloned');}else if($(this).attr('id')=='go_prev'){var item=$("ul.items li[rel='"+$(this).attr('rel')+"']").prev('li').not('.cloned');};var id=item.attr('rel');$(item).css('boreder','1px solid red');var obj=this;var type=$('.selectproducttype').text();$.ajax({url:"/si/ajax",type:"POST",dataType:"json",data:"id="+id+"&type="+type,success:function(data){$(obj).attr('rel',data.project_id);$("#showcase img").attr('src',data.image);$('#showcase .tekst h2').hide().text(data.title).fadeIn(500);$('#showcase .tekst ul li.type').hide().text(data.type).fadeIn(500);$('#showcase .tekst ul li.link a').text(data.link);$('#showcase .tekst ul li.link a').hide().attr('href',data.link).fadeIn(500);$('#showcase .okvir a').attr('href',data.image);App.Common.overImage();$("a#search_hover_over").fancybox();}});});},overImage:function(){$('#showcase .content .okvir').hover(function(){$('#search_hover_over').css({position:'absolute',top:'8px',left:'11px',zIndex:'450',width:'401px',height:'281px',background:'#000 url("/static/images/search_icon.png") no-repeat center center',opacity:.5,display:'block'});},function(){$('#search_hover_over').hide();});}};;jQuery.fn.aPosition=function(){thisLeft=this.offset().left;thisTop=this.offset().top;thisParent=this.parent();parentLeft=thisParent.offset().left;parentTop=thisParent.offset().top;return{left:thisLeft-parentLeft,top:thisTop-parentTop}}
App.MenuMgr={APP_MAIN_MENU_TARGET:'#menu',APP_MAIN_MENU_ELEMENT:'li',APP_MAIN_MENU_TARGET_ACTIVE:'.active',APP_MAIN_MENU_HOVER_TARGET:'b',APP_MAIN_MENU_HOVER_TARGET_PARENT:'#header',APP_MAIN_MENU_HOVER_TARGET_WITDH:147,activeElement:null,init:function(){jQuery.each($(App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT),function(){$(this).find('a.h').width($(this).width());});try{var t=App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT+App.MenuMgr.APP_MAIN_MENU_TARGET_ACTIVE;if($(t).length)
$('.moon').show();else
$('.moon').hide();this.reposition(t);}catch(err){$(this.APP_MAIN_MENU_TARGET+' '+this.APP_MAIN_MENU_ELEMENT+':first').addClass('active');this.reposition(App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT+App.MenuMgr.APP_MAIN_MENU_TARGET_ACTIVE);}
$(App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT+' a').hover(function(){App.MenuMgr.activeElement=$(this).parent();setTimeout(function(){$(App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET_PARENT+' '+App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET).stop();App.MenuMgr.animate(App.MenuMgr.activeElement);},250);},function(){$(App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT+' a').mouseout(function(){setTimeout(function(){$(App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET_PARENT+' '+App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET).stop();App.MenuMgr.animate($(App.MenuMgr.APP_MAIN_MENU_TARGET+' '+App.MenuMgr.APP_MAIN_MENU_ELEMENT+App.MenuMgr.APP_MAIN_MENU_TARGET_ACTIVE));},250);});});return false;},calcOffset:function(target){var Const=194;var Tmp=Math.ceil($(target).aPosition().left);offsetLeft=Const+Tmp;var margin_offset=parseInt(14/2);var parent_offset=parseInt(($(target).width()/2));var hover_offset=parseInt(App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET_WITDH/2);offsetLeft=offsetLeft-(hover_offset-parent_offset-margin_offset);return offsetLeft;},reposition:function(target){var offsetLeft=App.MenuMgr.calcOffset($(target));$(App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET_PARENT+' '+App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET).css('left',offsetLeft+'px');return false;},animate:function(target){var offsetLeft=App.MenuMgr.calcOffset(target);$(App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET_PARENT+' '+App.MenuMgr.APP_MAIN_MENU_HOVER_TARGET).animate({left:offsetLeft+'px'},300,"linear");}};;App.BannerMgr={SELF_API:null,init:function(){$('.banner_selector').cycle({fx:'scrollLeft',speed:3000,timeout:3000});$('#app-frontpage-scrollpane-start').click(function(){$('.banner_selector').cycle('resume');$(this).attr('class','bannerStart');$('#app-frontpage-scrollpane-stop').attr('class','bannerStopUnactive');return false;});$('#app-frontpage-scrollpane-stop').click(function(){$('.banner_selector').cycle('pause');$(this).attr('class','bannerStop');$('#app-frontpage-scrollpane-start').attr('class','bannerStartUnactive');return false;});var api=$("#banner_bg").scrollable({items:'.items',speed:1000,clickable:false,next:'#thisdoesnotexistnext',prev:'#thisdoesnotexistprev'}).circular({}).autoscroll({autoplay:true,api:true});$('#app-scrollpane-startstop').click(function(){if($(this).attr('rel')=='start'){api.play();$(this).addClass('stop');$(this).removeClass('start');$(this).attr('rel','stop');}else{api.stop();$(this).addClass('start');$(this).removeClass('stop');$(this).attr('rel','start');};return false;});$('#app-scrollpane-next,#app-scrollpane-prev').click(function(){api.stop();if($(this).attr('rel')=='next'){api.move(5,1000);}else if($(this).attr('rel')=='prev'){api.move(-5,1000);};$('#app-scrollpane-startstop').addClass('start');$('#app-scrollpane-startstop').removeClass('stop');$('#app-scrollpane-startstop').attr('rel','start');});return false;}};;App.PortfolioMgr={APP_SUBMENU_TARGET:'#submenu',APP_SUBMENU_TARGET_EL:'li',APP_SUBMENU_ACTIVE_EL:'li.active',APP_SUBMENU_HOVER_EL:'li.back',APP_SUBMENU_ANIMATION_SPEED:250,APP_SUBMENU_ANIMATION_DELAY:250,APP_SUBMENU_ANIMATION_EFFECT:'linear',APP_SUBMENU_HOVER_SUM:3,APP_SUBMENU_ACTIVE_HOVER:null,APP_SUBMENU_MOUSEOVER_ACTIVE:0,init:function(){try{this.reposition();}catch(err){}
$(this.APP_SUBMENU_TARGET+' '+this.APP_SUBMENU_TARGET_EL).hover(function(){App.PortfolioMgr.APP_SUBMENU_MOUSEOVER_ACTIVE=1;App.PortfolioMgr.APP_SUBMENU_ACTIVE_HOVER=$(this);setTimeout(function(){$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_HOVER_EL).stop();App.PortfolioMgr.moveToHover();},App.PortfolioMgr.APP_SUBMENU_ANIMATION_DELAY);},function(){setTimeout(function(){$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_HOVER_EL).stop();App.PortfolioMgr.moveToActive();},App.PortfolioMgr.APP_SUBMENU_ANIMATION_DELAY);});},reposition:function(){var el=$(this.APP_SUBMENU_TARGET+' '+this.APP_SUBMENU_ACTIVE_EL);var offset=el.position().left;var width=el.width();offset+=this.APP_SUBMENU_HOVER_SUM;$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_HOVER_EL).css('left',offset+'px').css('width',width+'px');},moveToActive:function(){var el=$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_ACTIVE_EL);var offset=el.position().left;var width=el.width();offset+=App.PortfolioMgr.APP_SUBMENU_HOVER_SUM;$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_HOVER_EL).animate({width:width+'px',left:offset+'px'},App.PortfolioMgr.APP_SUBMENU_ANIMATION_SPEED,App.PortfolioMgr.APP_SUBMENU_ANIMATION_EFFECT);},moveToHover:function(){var offset=App.PortfolioMgr.APP_SUBMENU_ACTIVE_HOVER.position().left;var width=App.PortfolioMgr.APP_SUBMENU_ACTIVE_HOVER.width();offset+=App.PortfolioMgr.APP_SUBMENU_HOVER_SUM;$(App.PortfolioMgr.APP_SUBMENU_TARGET+' '+App.PortfolioMgr.APP_SUBMENU_HOVER_EL).animate({width:width+'px',left:offset+'px'},App.PortfolioMgr.APP_SUBMENU_ANIMATION_SPEED,"linear",function(){App.PortfolioMgr.APP_SUBMENU_MOUSEOVER_ACTIVE=0;});}};;App.AboutUsMgr={DEFAULT_TEXT:'Tu vnesite vaše sporočilo ...',DEFAULT_TEXT_EMAIL:'Vaš email',init:function(){this.events();},events:function(){var t=App.AboutUsMgr;$('.contact_button').click(function(){t.toggleForm($(this));return false;});$('textarea').focus(function(){t.clearTextarea($(this));return false;});$('input.emailinput').focus(function(){t.clearInput($(this));return false;});$('.send_contact_form').click(function(t){var id=$(this).parent().find('input.userid').val();var te=$(this).parent().find('textarea');var inp=$(this).parent().find('input.emailinput');var q=$(te).val();var email=$(inp).val();var to=$(this).parent().parent();$.ajax({url:"/si/ajax/",type:"POST",dataType:"json",data:'user_id='+id+"&q="+q+"&email="+email,success:function(data){if(data==1){$(to).slideUp();}else if(data==0){te.css('outline','1px solid red');inp.css('outline','1px solid red');};}});});},toggleForm:function(scope){var f=scope.parent().parent().find('.contact_me');var v=$(f).is(':visible');if(v)
f.slideUp();else
f.slideDown();},clearTextarea:function(scope){if(scope.html()==this.DEFAULT_TEXT)
scope.html('');},clearInput:function(scope){if(scope.val()==this.DEFAULT_TEXT_EMAIL)
scope.val('');}};