// declare getElementsByClassName function
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

// change thumbs for discography
function changeThumb(pic, imglink, imgid, me){

        thumbs=getElementsByClassName(document, "img", "artworkThumb");
        for (i=0; i<thumbs.length; i++){
                thumbs[i].style.borderColor="#706d58"
        }
        me.style.borderColor="#fff"
        document.getElementById(imgid).src = "/images/discography/" + pic + ".jpg";
        document.getElementById(imgid).parentNode.href=imglink;

        return false;
        
}

function rot13( stringText ){ //v1.0
	return stringText.replace(/[a-zA-Z]/g, function(c){
		return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
	});
};

$(function() {

	// run lightbox
	$('#content ul.lightbox li a, #content #discography .release .image a').lightBox({
	imageLoading: '/images/template/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: '/images/template/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: '/images/template/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: '/images/template/lightbox/lightbox-btn-next.gif',
	imageBlank: '/images/template/lightbox/lightbox-blank.gif'
	});
	
	// social network site tooltips
	$('#footer ul.left a').tooltip({
		showURL: false
	});
	
	// show homepage arrows if you need to scroll
	$('#homepage .boxes .box').each(function() {
		var boxHeight = $(this).find('.content').height();
		var listHeight = $(this).find('ul').height();
		if(listHeight > boxHeight) {
			$(this).find('.arrows').show();
		};
	});

});
