var header_img_width = 1121;
var scroll = header_img_width;

function externalLinks() {
	if (!document.getElementsByTagName) {
		return;
	}

    var anchors = document.getElementsByTagName("a");

    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];

        if (anchor.getAttribute("href") && (anchor.getAttribute("rel") === "external" || anchor.getAttribute("rel") === "new-window")) {
            if (anchor.getAttribute("className")) {
                anchor.target = anchor.getAttribute("className");
            }
            else {
                anchor.target = "_blank";
            }
        }
    }
}

jQuery(document).ready(function(){

	// moving header
	if (jQuery('#header-img')) {
		setInterval(function() {
			scroll = (scroll-- < 1) ? header_img_width : scroll;
			jQuery('#header-img').css({backgroundPosition: scroll + 'px 0px'});
		}, 50);
	}
	
	// lightbox
	if (jQuery('#gallery') && jQuery().lightBox) {
	
		jQuery(function() {
			$('#gallery a').lightBox();
		});
	
	}

	externalLinks();
	
});