// launch this stuff as soon as the DOM is ready
$(document).ready(function(){

	// add class to links depending on extension
	$("a[@href$=pdf]").addClass("pdf");
	$("a[@href$=zip]").addClass("zip");
	$("a[@href$=doc]").addClass("doc");
	$("a[@href$=xls]").addClass("xls");
	$("a[@href$=psd]").addClass("psd");
	
	// automatically create external link class and open in new window if link is not local or ID anchor
	//$("a[@href^='http']").not(location.host).not("[href^=#]").addClass("external").attr('target','_blank');
	$("a[@href^='http']").not("[@href*=http://www.thebiggreenidea.org]").not("[href^=#]").addClass("external").attr('target','_blank');
	
	// anchors in ID.thumbs trigger an ID.main_image (img) to update
	$("#thumbs a").click(function(){$("#main_image").attr({ src: $(this).attr("href") });return false;});
	
	// ie png replacement
	if(navigator.appVersion.match(/MSIE [0-6]\./)){
		$('img[@src*=".png"]').addClass('png');
		$('input[@src*=".png"]').addClass('png');
		$('*').each(function(){
			if(this.currentStyle.backgroundImage != 'none' && this.currentStyle.backgroundImage.match(/\.png/)){
				var image = this.currentStyle.backgroundImage;
				image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
				$(this).css({
					'backgroundImage': 'none', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='" + image + "')"
				});
			}
		});
	}
});


/*
Credits:
http://15daysofjquery.com/ - go here to learn this stuff!
*/
