//global

$(document).ready(function() {
   

$(".dragme").draggable();



$("div.dog").corner("dog 10px");

$(".round, .blue-box").corner("round 10px");

$("div.fray").corner("fray 10px");

$("div.bite").corner("bite 10px");



$(".external").append( " ", "<img src='Styles/g/icons/external.png' border='0'  title='' alt='' class='' />");




// use this to obfuscate email

$('a.email').each(function(){
			e = this.rel.replace('/','@');
                        
                         theText = "Email"
			this.href = 'mailto:' + e;
		
		});







});







// this will add a caption below an image 
// img class="add-caption"
// caption taken from alt


$(window).load(function(){
		$("img.add-caption").each(function(i) {
			var imgwidth = $(this).width();
			var thetext = $(this).attr("alt");
                        var thetitle = $(this).attr("title");
			$(this).wrap("<div class='image-wrap'></div>");	
			$(this).parent().width(imgwidth);

			if ((thetext != null)&&(thetext != " "))
	                if ((thetitle != null)&&(thetitle != " "))
			{
				$(this).parent().append("<p class='image-caption'>" + "<strong>" + thetitle +  "</strong>" + "&nbsp;" + thetext + "</p>");
			}	
		});	

	});
	



// This add caption floats left


$(window).load(function(){
		$("img.add-caption-left").each(function(i) {
			var imgwidth = $(this).width();
                        var thetext = $(this).attr("alt");
			var thetitle = $(this).attr("title");
                	$(this).wrap("<div class='image-wrap' style='float:left;margin:0 15px .5em 0;'></div>");
	
			$(this).parent().width(imgwidth);
                        		if ((thetitle != null)&&(thetitle != " "))
			if ((thetext != null)&&(thetext != " "))
			{
				$(this).parent().append("<p class='image-caption'>" + "<strong>" + thetitle +  "</strong>" + "&nbsp;" + thetext +  "</p>");
		           }
                           

		});	

	});
	





// This add caption floats right


$(window).load(function(){
		$("img.add-caption-right").each(function(i) {
			var imgwidth = $(this).width();
                        var thetext = $(this).attr("alt");
			var thetitle = $(this).attr("title");
                	$(this).wrap("<div class='image-wrap' style='float:right;margin-left:15px;'></div>");	
			$(this).parent().width(imgwidth);
                        	if ((thetitle != null)&&(thetitle != " "))
			if ((thetext != null)&&(thetext != " "))
			{
				$(this).parent().append("<p class='image-caption'>" + "<strong>" + thetitle +  "</strong>" + "&nbsp;" + thetext +  "</p>");
			}	
		});	

	});
	





