var bloggerImages = null;
var bloggerInfos = null;

function showBloggerInfo(bloggerID) {
	try {
		if (bloggerImages == null) {
			bloggerImages = document.getElementsByClassName('blogger_image', 'meetbloggers');
			bloggerInfos = document.getElementsByClassName('blogger_info', 'meetbloggers');
		}

		// Clean up
		for (var i = 0, l = bloggerImages.length; i < l; i++) {
			var Img = $(bloggerImages[i]);
			var Info = $(bloggerInfos[i]);
			Img.removeClassName('blogger_on');
			Info.removeClassName('blogger_on');
			Img.ancestors('a')[0].removeClassName('blogger_on');
		}

		Img = $('blogger_image-'+ bloggerID);
		Info = $('blogger_info-'+ bloggerID);
		Img.ancestors('a')[0].addClassName('blogger_on');
		Img.addClassName('blogger_on');
		Info.addClassName('blogger_on');
	} catch (e) { bloggerImages = null; bloggerInfos = null; }
}

// FEATURED BLOGGER 
function createFbrrWindow() {
	window.open("/wp-content/themes/openhouse/fbrr.html","fbrr","menubar=no,width=500,height=730,toolbar=no,scrollbar=yes");
}

// Tracking / Sharing
addthis_pub = 'HomeGoods';
addthis_logo_background = 'FFFFFF';
addthis_logo_color = '797979';
addthis_brand = 'HomeGoods';
addthis_options = 'favorites, email, twitter, delicious, facebook, google, myspace, live, more';
//addthis_offset_left = 15;
//addthis_offset_top = 11;

function goCat(F) {
	if (F.trim_cat.selectedIndex == 0)
		window.location.href = '/finds/';
	else
		window.location.href = '/finds/cat/'+ F.trim_cat.options[F.trim_cat.selectedIndex].value;
	return false;
}

function photoBoxing(Box, Photo, className) {
	try {
		var A = Photo.ancestors();
		Box.insert(A[0]);
		Photo.addClassName(className);
		Photo.removeClassName('alignright');
		Photo.removeClassName('alignleft');
		Photo.removeClassName('centered');
	} catch(e) { }
}

document.observe('dom:loaded', function() {  // need to do it once everything's loaded
 	// Activate Challenge selection if on Challenge Submit
	Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6;
	Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 7;
	Prototype.Browser.IE8 = Prototype.Browser.IE && !Prototype.Browser.IE6 && !Prototype.Browser.IE7;
	
	if (Prototype.Browser.IE)  $(document.body.parentNode).addClassName('ie');
	if (Prototype.Browser.IE6) $(document.body.parentNode).addClassName('ie6');
	if (Prototype.Browser.IE7) $(document.body.parentNode).addClassName('ie7');
	if (Prototype.Browser.IE8) $(document.body.parentNode).addClassName('ie8');

var BODY = document.body;
var CONTENT = $('content');

if (BODY.id == 'authors' || (CONTENT != null && CONTENT.hasClassName('author'))) {
	$$('A').each(function(E) {
		if ( (E.href.indexOf('homegoods') < 0) && (E.href.indexOf('tjx') < 0) && (E.href.indexOf('://') > 0) )
			E.setAttribute('target', '_blank');
	});
}

/* PhotoPress Repositioning */
/*
	try {
		var IMG = $$('BODY.single A[rel=lightbox] IMG');
		//alert(IMG.length);
		if (IMG.length> 0) {
			var B = $$('DIV.entry_content'); //blog_entry');
			b = B[0];
			var p = new Element('div', {class: 'photoBox'});
			b.insert({top: p});
			photoBoxing(p, IMG[0], 'photoBoxMain');
			for (var i = 1, l = IMG.length; i < l; i++) {
				photoBoxing(p, IMG[i], 'photoBoxExtra');
			}
		}
	} catch(e) { }
*/
});