function setBgImage(url, after_id) {
	var img = $("<img />").attr('id', after_id + '_bg_image').attr('src', url);
	$("#sidebar").before(img); 
}

function iConventionTweaks() {

	var loc = '.' + window.location; 
	var title = $("#bodycopy h1").text();

	if(title == 'Directory of Exhibitors') {
		if(loc.indexOf('?bg=7') > 0 || loc.indexOf('&bg=7') > 0) {
			$("#bodycopy h1").text("Open Daily Directory");
	
		} else if(loc.indexOf('?bg=26') > 0 || loc.indexOf('&bg=26') > 0) {
			$("#bodycopy h1").text("Market Wednesday"); 	
		}
	}

	if($(".sfstorefront input[name=editProductID]").size() > 0) {
		// edit product or post upload screen 
		$(".sfstorefront #bodycopy").css("top", "0px").css("left", "-85px"); 
	}
}

$(document).ready(function() {

	$("#topsearchtext").attr("rel", $("#topsearchtext").val())
		.focus(function() {
			if($(this).val() == $(this).attr("rel")) $(this).attr("value", ""); 
			$(this).addClass("inputfocus").removeClass("inputblur"); 
		}).blur(function() {
			if($(this).val().length == 0) $(this).attr("value", $(this).attr("rel")); 
			$(this).addClass("inputblur").removeClass("inputfocus"); 
		}); 

	$("#container a.file_pdf").attr("target", "_blank"); 

	if($("html").is("#iconvention")) iConventionTweaks(); 

	if($("#bloglink").size() < 1 && !$("#container").is(".notopnav")) {
		$("#topnav").after($("<a id='bloglink' href='http://blog.americasmart.com'>visit our blog</a>")); 
	}

}); 
