$(document).ready(function(){
/*BEGINING*/


var dev = $('#dev'),
    head = $('#head'),
    cc = $('#cc'),
    menu = $('#menu'),
    menuli = $('#menu li'),
    H = $(window).height();

menuli.each(function() {
    
    $(this).mouseover(function(event) {
        if ($(this).hasClass('selected') || $(this).hasClass('dummy')) {} else {
            $(this).css('borderLeftColor','#235689');
        }
    });

    $(this).mouseout(function(event) {
        if ($(this).hasClass('selected') || $(this).hasClass('dummy')) {} else {
            $(this).css('borderLeftColor','white');
        }
    });

});

if ($('.fullheight').length!=0) { $('.fullheight').height($('.fullheight').parent().height()); }

$.headphoto = function() {
	var bgitems = 10;
    var cctext = new Array(); 
    cctext[0] = "fot&#243;: V&#233;kony Dorottya";
    cctext[1] = "fot&#243;: Kaulics Viola";
    cctext[2] = "fot&#243;: Simon Zsuzsanna";
    cctext[3] = "fot&#243;: Simon Zsuzsanna";
    cctext[4] = "fot&#243;: Iv&#225;n &#193;dam";
    cctext[5] = "fot&#243;: Iv&#225;n &#193;dam";
    cctext[6] = "fot&#243;: Zselinsky Miroslav";
    cctext[7] = "fot&#243;: Zselinsky Miroslav";
    cctext[8] = "fot&#243;: Kaulics Viola";
    cctext[9] = "fot&#243;: Simon Zsuzsanna";     
        
	j = Math.floor(bgitems * (Math.random() % 1))+1;
	
	if (j>=10){
	    bg_string='gfx/head_bg_' + j + '.jpg';
	}else{
	    bg_string='gfx/head_bg_0' + j + '.jpg';
	}
    if (head.hasClass('index')) {} else {
        head.css('background-image',"url(" + bg_string + ")");
        cc.html(cctext[j-1]);
    }
}

/* gaq - event */
document.onclick = function(event) { /*ravelrumba*/
 
    event = event || window.event;
    var target = event.target || event.srcElement,
        targetElement = target.tagName.toLowerCase();
 
    if (targetElement == "a") {
        var href = target.getAttribute("href"),
            urlHost = document.domain.replace(/^www\./i,"");
        var urlPattern = "^(?:https?:)?\/\/(?:(?:www)\.)?" + urlHost + "\/?";
        eventCheck(href,urlPattern);
    }
 
    function eventCheck(href,urlPattern){
        if ((href.match(/^https?\:/i)) && (!href.match(urlPattern))){
            if (href.match(/^.*\.(pdf|jpg|png|gif|zip|mp3|txt|doc|rar|js|py)$/i)) {
                _gaq.push(['_trackEvent', 'Download', 'click', href]);
            } else {
                _gaq.push(['_trackEvent', 'External', 'click', href]);
            }
        } else if (href.match(/^mailto\:/i)) {
            _gaq.push(['_trackEvent', 'Email', 'click', href.substr(7)]);
        } else if (href.match(/^.*\.(pdf|jpg|png|gif|zip|mp3|txt|doc|rar|js|py)$/i)) {
            _gaq.push(['_trackEvent', 'Download', 'click', href]);
        }
    }
};
/* gaq - event end */

$.headphoto(); 
/*END*/
});
