
(function( $ ) { //isScrolledIntoView plugin
  $.fn.isAnyScrolledIntoView = function() {
        var docViewTop = $(window).scrollTop();
        var docViewBottom = docViewTop + $(window).height();

        var result = false;
        $(this).each(function(){
            var elemTop = $(this).offset().top;
            var elemBottom = elemTop + $(this).height();
            if ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) )
            result = true;
        })
        return result;

  };
})( jQuery );


(function($){ //getCss plugin
    $.fn.getStyleObject = function(){
        var dom = this.get(0);
        var style;
        var returns = {};
        if(window.getComputedStyle){
            var camelize = function(a,b){
                return b.toUpperCase();
            };
            style = window.getComputedStyle(dom, null);
            for(var i = 0, l = style.length; i < l; i++){
                var prop = style[i];
                var camel = prop.replace(/\-([a-z])/g, camelize);
                var val = style.getPropertyValue(prop);
                returns[camel] = val;
            };
            return returns;
        };
        if(style = dom.currentStyle){
            for(var prop in style){
                returns[prop] = style[prop];
            };
            return returns;
        };
        return this.css();
    }
})(jQuery);


function sizes(){
    scrollFunc();
    $('.projects').css('max-width','');
    if ($('.projects').width()<810) $('.projects').css('max-width','540px');
}

$(window).resize(sizes);
$(document).ready(sizes);


function tellAnalytics(page){
    var p = translit(page);
    _gaq.push(['_trackPageview', p]);
}//telos function tellAnalytics

function translit(str)
{
    str = str.replace("α","a","g")
    str = str.replace("ά","a","g")
    str = str.replace("Α","A","g")
    str = str.replace("Ά","A","g")
    str = str.replace("β","b","g")
    str = str.replace("Β","B","g")
    str = str.replace("γ","g","g")
    str = str.replace("Γ","G","g")
    str = str.replace("δ","d","g")
    str = str.replace("Δ","D","g")
    str = str.replace("ε","e","g")
    str = str.replace("έ","e","g")
    str = str.replace("Ε","E","g")
    str = str.replace("Έ","E","g")
    str = str.replace("ζ","z","g")
    str = str.replace("Ζ","Z","g")
    str = str.replace("η","h","g")
    str = str.replace("ή","h","g")
    str = str.replace("Η","H","g")
    str = str.replace("Ή","H","g")
    str = str.replace("θ","th","g")
    str = str.replace("Θ","Th","g")
    str = str.replace("ι","i","g")
    str = str.replace("ί","i","g")
    str = str.replace("ϊ","i","g")
    str = str.replace("ΐ","i","g")
    str = str.replace("Ι","I","g")
    str = str.replace("Ί","I","g")
    str = str.replace("Ϊ","I","g")
    str = str.replace("κ","k","g")
    str = str.replace("Κ","K","g")
    str = str.replace("λ","l","g")
    str = str.replace("Λ","L","g")
    str = str.replace("μ","m","g")
    str = str.replace("Μ","M","g")
    str = str.replace("ν","n","g")
    str = str.replace("Ν","N","g")
    str = str.replace("ξ","ks","g")
    str = str.replace("Ξ","Ks","g")
    str = str.replace("ο","o","g")
    str = str.replace("ό","o","g")
    str = str.replace("Ο","O","g")
    str = str.replace("Ό","O","g")
    str = str.replace("π","p","g")
    str = str.replace("Π","P","g")
    str = str.replace("ρ","r","g")
    str = str.replace("Ρ","R","g")
    str = str.replace("σ","s","g")
    str = str.replace("ς","s","g")
    str = str.replace("Σ","S","g")
    str = str.replace("τ","t","g")
    str = str.replace("Τ","T","g")
    str = str.replace("υ","y","g")
    str = str.replace("ύ","y","g")
    str = str.replace("ϋ","y","g")
    str = str.replace("ΰ","y","g")
    str = str.replace("Υ","Y","g")
    str = str.replace("Ύ","Y","g")
    str = str.replace("Ϋ","Y","g")
    str = str.replace("φ","f","g")
    str = str.replace("Φ","F","g")
    str = str.replace("χ","x","g")
    str = str.replace("Χ","X","g")
    str = str.replace("ψ","ps","g")
    str = str.replace("Ψ","Ps","g")
    str = str.replace("ω","w","g")
    str = str.replace("ώ","w","g")
    str = str.replace("Ω","W","g")
    str = str.replace("Ώ","W","g")
    return str;
}
