cards.each(function(card, i) {
	
	if( card != '' && undefined != card ) {
	
		if( card.substring( 0, 5).toLowerCase() == "group" ) {
		
			var name = card.split(":");
			$('grid').innerHTML += '<h1 style="clear:both;">' + name[1] + '</h1>';
			
		} else {

			var new_thumb =	'<div class="thumb">';
			new_thumb +=	'<div class="top"><img class="zoom" style="float: right;" src="branded_images/viewer_zoom.gif" alt="' + card + '" />';
			new_thumb +=	'<img id="'+ card +'" style="float: left;" src="branded_images/viewer_top_left.gif" /></div>';
			new_thumb +=	'<div class="image"><img class="zoom" src="branded_images/' + card + '_thumb.jpg" alt="' + card + '" />';
			new_thumb +=	'</div><h5>' + card + '</h5>';
			new_thumb +=	'<div class="bottom"><img style="float: right;" src="branded_images/viewer_bottom_right.gif" />';
			new_thumb +=	'<img style="float: left;" src="branded_images/viewer_bottom_left.gif" /></div></div>';
			
			$('grid').innerHTML += new_thumb;
		}
	
	}

});

$$("img.zoom").addEvent('click', function() {
	if( cards.indexOf(this.alt) > 0 ) {
		Lightbox.open([['branded_images/' + this.alt + '.jpg?width=700', this.alt], ['branded_images/' + this.alt + '_merge.jpg?width=700', this.alt]], 0);
	} else if( prebrand_cards.indexOf(this.alt) > 0 ) {
		Lightbox.open([['images/' + this.alt + 'a.jpg?width=700', this.alt], ['images/' + this.alt + 'b.jpg?width=700', this.alt]], 0);
	}
//	Lightbox.show('branded_images/' + this.alt + '.jpg?width=700', this.alt);
});

url_check = function() {
	document.location.search.replace("?", "").split("&").each(function(arg, i) {
		if( arg.substring(0,5) == "zoom=" ) {
			var postcard = arg.replace("zoom=", "").toLowerCase();
				if( cards.indexOf(postcard) > 0 ) {
					Lightbox.open([['branded_images/' + postcard + '.jpg?width=700', postcard], ['branded_images/' + postcard + '_merge.jpg?width=700', postcard]], 0);
//					Lightbox.show('branded_images/' + postcard + '.jpg?width=700', postcard);
				} else if( prebrand_cards.indexOf(postcard) > 0 ) {
					Lightbox.open([['images/' + postcard + 'a.jpg?width=700', postcard], ['images/' + postcard + 'b.jpg?width=700', postcard]], 0);
//					Lightbox.show('images/' + postcard + 'a.jpg?width=700', postcard);
				}

		}
	});
}.delay(1000);