var searchtext = 'Search Music Lovers';
$(document).ready(function() {
	$('.icon').each(function() {
		$(this).parent().css({'background':'#FFF'});
		var margin = 0;
		if (Number($(this).children('img').height()) < 89) margin = 89 - Number($(this).children('img').height());
		$(this).children('img').addClass('rounded-wrap');
		if (margin > 0) $(this).css({'padding-top':String(margin)+'px'}).parent().children('h3:first').css({'margin-top':'-'+String(margin)+'px'});
		
	});
	$('.icon-link').each(function() {
		$(this).parent().css({'background':'#FFF'});
		var margin = 0;
		if (Number($(this).children('a').children('img').height()) < 89) margin = 89 - Number($(this).children('a').children('img').height());
		$(this).children('img').addClass('rounded-wrap');
		if (margin > 0) $(this).css({'padding-top':String(margin)+'px'}).parent().children('h3:first').css({'margin-top':'-'+String(margin)+'px'});
		
	});
	$('.rounded-wrap').each(function() {
		$(this).wrap('<div class="rounded" style="width:'+$(this).width()+';height:'+$(this).height()+';"></div>');
	});
	$('.rounded').each(function() {
		$(this).height($(this).children('img').height());
		$(this).width($(this).children('img').width());
		$(this).parent().css({'background':'#FFF'});
	});
	$('.rounded-help').each(function() {
		$(this).height($(this).prev().height());
		$(this).width($(this).prev().width());
	});
	$('.rounded').corner();
	$('input.searchbox').focus(function() {
		if ($(this).val() == searchtext) $(this).val('');
	});
	$('input.searchbox').blur(function() {
		if ($(this).val().length < 1) $(this).val(searchtext);
	});
	$('input.searchbox').each(function() {
		$(this).blur();
	});
	$('.store-icon').each(function() {
		if (document.images) {
			var src = $(this).attr('src');
			var over = new Image();
			over.src = src.replace('.png','-over.png');
			$(this).hover(function() { $(this).attr('src', over.src); }, function() { $(this).attr('src', src); });
		}
	});
	$('a[rel=external]').attr('target','_blank');
});
