(function(global){var vurig=global.vurig=global.vurig||{};String.prototype.toBoolean=function(){return("true"==this)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(elt,from){var len=this.length>>>0;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0){from+=len}for(;from<len;from++){if(from in this&&this[from]===elt){return from}}return -1}}$("a[href=#]").click(function(e){e.preventDefault()});vurig.mobilePlatform=navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad|android|devicebb|winmob|s60|symbian|palm)/);vurig.directions={HORIZONTAL:"horizontal",VERTICAL:"vertical",UP:"up",DOWN:"down",RIGHT:"right",LEFT:"left",toCss:function(dir){var css;switch(dir){case vurig.directions.UP:css="up";break;case vurig.directions.DOWN:css="bottom";break;case vurig.directions.RIGHT:css="right";break;case vurig.directions.LEFT:css="left";break}return css}};vurig.images=vurig.images||{};vurig.images.preload=function(images,callback){images=images||[],callback=callback||{};if(typeof(images)==="string"){images=[images]}if(images.constructor.toString().indexOf("Array")!==-1){this._images=new vurig.structures.iterator(images);var _images=this._images;this._total=_images.total();_images.each(function(){if(this.toString().match(/\.(jpe?g|png|gif|bmp|svg)$/i)){var image=new Image();image.onload=function(){while(true){if(this.complete||this.readyState===4||this.readyState==="complete"||(this.readyState==="uninitialized"&&this.src.indexOf("data:")>=0)){_images._data.splice(_images._data.indexOf(this),1);if(_images._data.length===0){if(typeof(callback)==="function"){callback.call(this)}}break}}};image.src=this}})}return};vurig.images.preload.prototype.status=function(){return Math.ceil((100/this._total)*(this._total-this._images._data.length))};vurig.structures=vurig.structures||{};vurig.structures.iterator=function(data){data=data||[];if(data.constructor.toString().indexOf("Array")!==-1){this._data=data;this._currentIndex;this._totalItems=this._data.length;if(this._totalItems>0){this._currentIndex=0}}return};vurig.structures.iterator.prototype.data=function(data){data=data||{};if(data.constructor.toString().indexOf("Array")!==-1){this._data=data;this._totalItems=this._data.length;if(this._totalItems>0){this._currentIndex=0}return}else{return this._data}};vurig.structures.iterator.prototype.hasNext=function(){return(this._currentIndex<=this._totalItems-2)};vurig.structures.iterator.prototype.next=function(){if(this.hasNext()){this._currentIndex++;return this._data[this._currentIndex]}return};vurig.structures.iterator.prototype.hasPrev=function(){return(this._currentIndex>0)};vurig.structures.iterator.prototype.prev=function(){if(this.hasPrev()){this._currentIndex--;return this._data[this._currentIndex]}return};vurig.structures.iterator.prototype.current=function(){return this._data[this._currentIndex]};vurig.structures.iterator.prototype.rewind=function(){this._currentIndex=0};vurig.structures.iterator.prototype.ffwd=function(){this._currentIndex=this._totalItems-1};vurig.structures.iterator.prototype.total=function(){return this._totalItems};vurig.structures.iterator.prototype.currentIndex=function(index){index=index||-1;index=parseInt(index);if(index<0){return this._currentIndex}else{if(index<this.total()){this._currentIndex=index}}};vurig.structures.iterator.prototype.isFirst=function(){return(this._currentIndex===0)};vurig.structures.iterator.prototype.isLast=function(){return(this._currentIndex===this._totalItems-1)};vurig.structures.iterator.prototype.each=function(block,callback){block=block||{},callback=callback||{};if(typeof(block)==="function"){for(var i=0;i<this._totalItems;i++){block.call(this._data[i]);if(i===(this._totalItems-1)){if(typeof(callback)==="function"){callback.call()}}}}};vurig.controls=vurig.controls||{};vurig.controls.slider=function(parentName,childName,axis,infinite){this._parentName=parentName;this._childName=childName;this._axis=(axis.toString()===vurig.directions.HORIZONTAL)?vurig.directions.HORIZONTAL:vurig.directions.VERTICAL;this._infinite=(infinite===true)?true:false;this._pages=0;this._currentPage=0;this._itemsPerPage=1;this._totalItems=0;this._currentItem=0;this.init()};vurig.controls.slider.prototype.init=function(){var width=0,height=0,items=$(this._parentName).find(this._childName);this._pages=items.size();this._totalItems=this._pages;if(this._totalItems>0){if(this._totalItems===1){this._infinite=false}this._currentItem=1}if(this._axis===vurig.directions.HORIZONTAL){items.each(function(){width+=$(this).outerWidth(true);$(this).addClass("slider-item")});$(this._parentName).width(width)}else{items.each(function(){height+=$(this).outerHeight(true)});$(this._parentName).height(height)}if(this._infinite){var size=items.size();if(size>1){var childs=$(this._parentName).children();childs.first().before($(items[size-1]).clone().removeClass("slider-item"));var cssDirection=this.cssDirection(this._axis);$(this._parentName).css(cssDirection,($(items[size-1]).width()*-1));childs.last().after($(items[0]).clone().removeClass("slider-item"));if(this._axis===vurig.directions.HORIZONTAL){$(this._parentName).width($(this._parentName).width()+childs.first().outerWidth(true)+childs.last().outerWidth(true))}else{$(this._parentName).height($(this._parentName).heigth()+childs.first().outerHeight(true)+childs.last().outerHeight(true))}}}if(Modernizr.csstransitions){var params=[];params["-webkit-transition"]="";params["-moz-transition"]="";params["-o-transition"]="";params["-ms-transition"]="";params.transition="";$(this._parentName).css(params)}};vurig.controls.slider.prototype.totalItems=function(){return this._totalItems};vurig.controls.slider.prototype.itemsPerPage=function(itemsPerPage){var itemsPerPage=parseInt(itemsPerPage);if(itemsPerPage>0){this._itemsPerPage=itemsPerPage;this._pages=Math.ceil(this._totalItems/itemsPerPage)}else{return this._itemsPerPage}};vurig.controls.slider.prototype.pages=function(){return this._pages};vurig.controls.slider.prototype.hasNextItem=function(){return(this.totalItems()>this.currentItem())};vurig.controls.slider.prototype.hasPrevItem=function(){return(this.currentItem()>1)};vurig.controls.slider.prototype.hasNextPage=function(){return(this.pages()>this.currentPage())};vurig.controls.slider.prototype.hasPrevPage=function(){return(this.currentPage()>1)};vurig.controls.slider.prototype.currentPage=function(){return(this.currentItem()===0)?0:Math.ceil(this.currentItem()/this.itemsPerPage())};vurig.controls.slider.prototype.currentItem=function(){return this._currentItem};vurig.controls.slider.prototype.width=function(width){width=width||-1;width=parseInt(width);if(width<0){return $(this._parentName).find(".slider-item").outerWidth(true)}else{$(this._parentName).find(".slider-item").width(width);var offset=(this.currentPage()<2)?0:(this.currentPage()*width)*-1;switch(this._axis){case vurig.directions.HORIZONTAL:$(this._parent).css({marginLeft:offset});break;case vurig.directions.VERTICAL:$(this._parent).css({marginTop:offset});break}}};vurig.controls.slider.prototype.height=function(){return $(this._parentName).find(".slider-item").outerHeight(true)};vurig.controls.slider.prototype.totalWidth=function(){return $(this._parentName).find(".slider-item").outerWidth(true)};vurig.controls.slider.prototype.totalHeight=function(){return $(this._parentName).find(".slider-item").outerHeight(true)};vurig.controls.slider.prototype.infinite=function(infinite){if(infinite){if(this.totalItems()>1){this._infinite=(infinite===true)?true:false}}return this._infinite};vurig.controls.slider.prototype.slideToNext=function(duration,easingcss,easing,callback){var direction,page;if(this.hasNextPage()||this.infinite()){direction=(this._axis===vurig.directions.HORIZONTAL)?vurig.directions.LEFT:vurig.directions.UP}else{return}this.slide(direction,1,duration,easingcss,easing,callback)};vurig.controls.slider.prototype.slideToPrev=function(duration,easingcss,easing,callback){var direction,page;if(this.hasPrevPage()||this.infinite()){direction=(this._axis===vurig.directions.HORIZONTAL)?vurig.directions.RIGHT:vurig.directions.DOWN}else{return}this.slide(direction,1,duration,easingcss,easing,callback)};vurig.controls.slider.prototype.slideToPage=function(page,duration,easingcss,easing,callback){var page=parseInt(page);var totalItems=Math.abs(this.currentPage()-page)*this._itemsPerPage,direction;if(page>this._currentPage&&this.hasNextPage()){direction=(this._axis===vurig.directions.HORIZONTAL)?vurig.directions.LEFT:vurig.directions.UP}else{if(page<this._currentPage&&this.hasPrevPage()){direction=(this._axis===vurig.directions.HORIZONTAL)?vurig.directions.RIGHT:vurig.directions.DOWN}else{return}}this._currentPage=page;this.slide(direction,totalItems,duration,easingcss,easing,callback)};vurig.controls.slider.prototype.cssDirection=function(direction){direction=direction||this._axis;var cssDirection;switch(direction){case vurig.directions.HORIZONTAL:case vurig.directions.LEFT:case vurig.directions.RIGHT:cssDirection="margin-left";break;case vurig.directions.VERTICAL:case vurig.directions.UP:case vurig.directions.DOWN:cssDirection="margin-top";break}return cssDirection};vurig.controls.slider.prototype._resetInfinite=function(offset){var resetParams={},cssDirection=this.cssDirection();resetParams[cssDirection]=((offset<0)?(this.totalItems())*offset:0-offset);if(Modernizr.csstransitions){var resetTrans=cssDirection+" 0s";resetParams["-webkit-transition"]=resetTrans;resetParams["-moz-transition"]=resetTrans;resetParams["-o-transition"]=resetTrans;resetParams["-ms-transition"]=resetTrans;resetParams.transition=resetTrans}$(this._parentName).css(resetParams)};vurig.controls.slider.prototype.slide=function(direction,totalItems,duration,easingcss,easing,callback){var parentNode=$(this._parentName),totalItems=parseInt(totalItems)||0,cssDirection=this.cssDirection(direction),params={},infiniteOffset=0;if(cssDirection==="margin-left"){if(direction===vurig.directions.LEFT){if((this._currentItem+totalItems>this.totalItems())){if(totalItems===1&&this.infinite()){infiniteOffset=(this.width())}else{return}}else{this._currentItem+=totalItems}}else{if((this._currentItem-totalItems<1)){if(totalItems===1&&this.infinite()){infiniteOffset=-1*this.width()}else{return}}else{this._currentItem-=totalItems}}params[cssDirection]=-1*(this.width()*(this._currentItem-1));if(this.infinite()){params[cssDirection]-=(infiniteOffset+this.width());if(infiniteOffset!==0){this._currentItem=(this._currentItem===1)?this.totalItems():1}}}else{if(direction===vurig.directions.UP){if((this._currentItem+totalItems>this.totalItems())){if(totalItems===1&&this.infinite()){infiniteOffset=(this.height())}else{return}}else{this._currentItem+=totalItems}}else{if((this._currentItem-totalItems<1)){if(totalItems===1&&this.infinite()){infiniteOffset=-1*this.height()}else{return}}else{this._currentItem-=totalItems}}params[cssDirection]=-1*(this.height()*(this._currentItem-1));if(this.infinite()){params[cssDirection]-=(infiniteOffset+this.height());if(infiniteOffset!==0){this._currentItem=(this._currentItem===1)?this.totalItems():1}}}if(Modernizr.csstransitions){var trans=cssDirection+" "+(duration/1000)+"s "+easingcss;params["-webkit-transition"]=trans;params["-moz-transition"]=trans;params["-o-transition"]=trans;params["-ms-transition"]=trans;params.transition=trans;parentNode.css(params);setTimeout(function(){if(callback){(callback)()}},duration)}else{parentNode.animate(params,duration,easing,callback)}var localThis=this;if(infiniteOffset!==0){setTimeout(function(){localThis._resetInfinite(infiniteOffset)},duration)}};vurig.controls.slider.prototype.items=function(){return $(this._parentName).find(".slider-item")};vurig.controls.slider.prototype.current=function(){return $(this._parentName).find(".slider-item:eq("+this._currentItem+")")};vurig.controls.slider.prototype.getItem=function(index){var index=parseInt(index);return $(this._parentName).find(".slider-item:eq("+index+")")};vurig.googleMaps=function(id,lat,lng,zoom){this._id=id.toString();this._map;this._markers=[];this._lat=lat;this._lng=lng;this._zoom=parseInt(zoom);if(!global.google||!global.google.maps){alert("Google Maps API not available.")}else{this.init()}};vurig.googleMaps.prototype.init=function(){var latlng=new google.maps.LatLng(this._lat||51.903818,this._lng||4.458839),options={zoom:this._zoom||16,center:latlng,disableDefaultUI:false,mapTypeId:google.maps.MapTypeId.ROADMAP,scrollwheel:false,zoomControl:true,zoomControlOptions:{style:google.maps.ZoomControlStyle.SMALL},navigationControl:false,navigationControlOptions:{style:google.maps.NavigationControlStyle.ZOOM_PAN,position:google.maps.ControlPosition.LEFT},mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}};this._map=new google.maps.Map(document.getElementById(this._id),options);this._map.setCenter(latlng);$("#"+this._id).bind("resize",{map:this},function(e){e.data.map.center();google.maps.event.trigger(e.data.map.map(),"resize")})};vurig.googleMaps.prototype.map=function(){return this._map};vurig.googleMaps.prototype.center=function(){var latlng=new google.maps.LatLng(this._lat||51.903818,this._lng||4.458839);this._map.setCenter(latlng)};vurig.googleMaps.prototype.zoom=function(zoom){this._map.setZoom(parseInt(zoom))};vurig.googleMaps.prototype.resize=function(){google.maps.event.trigger(this._map,"resize")};vurig.googleMaps.prototype.addMarker=function(lat,lng,options){if(typeof(options)!=="object"){options={}}var latlng=new google.maps.LatLng(lat||51.903818,lng||4.458839);options.position=latlng;options.map=this._map;var marker=new google.maps.Marker(options);this._markers.push(marker)}})(window);
