// JavaScript Document

(function($){
    $.fn.extend({
        thumbNail: function(options) {
            var defaults = {
				uiClass : "thumb",
				thumbHT : 100,
				thumbWT : 200,
				MinusPath : 7,
				anchorPath :"fullscreen/"
            }
            var sj =  $.extend(defaults, options);
            return this.each(function() {
                var s = sj;
					//var Width = $(this).height();
					alert("hello");
					$(this).parent().css({ width: '670px', padding: '0 0 0 30px' });
                 	var path = ($(this).attr('src'));
				 	var FPath;
					var newPath = path.substring(s.MinusPath, 1000);
					if(s.thumbHT==""){s.thumbHT = "100";} else{s.thumbHT;};	
					if(s.thumbWT==""){s.thumbWT = "200";} else{s.thumbWT;};

					if(s.anchorPath == "") 
					{
							FPath = path
					} 
					else 
					{
						//FPath = ( s.anchorPath + newPath );						

						//alert(" PATH : " + path + " LENGTH : " + path.length);
						//alert(" Anchorpath : " + s.anchorPath + " LENGTH : " + s.anchorPath.length);
						fulllength	= path.length;
						pathlength	= s.anchorPath.length;
						filename	= path.substring(pathlength,(fulllength));

						FPath = ( s.anchorPath + "fullscreen/" + filename );
					};
					
					var HoldGal = "<div class='gallery_lt'><ul class='gallery clearfix gallerylist'><li><div class='imgSh'>";
					var endHoldGal="</div></li></ul></div>";
					//var rImg ="<img src='images/spacer.gif' class='image_bg' style='background-image:url("+path+"); border:none; ' height='"+s.thumbHT+"' width='"+s.thumbWT+"' align='absmiddle'  />";

					var rImg ="<img src='http://www.slaughamplace-weddings.co.uk/images/spacer.gif' class='image_bg2' style='background-image:url("+path+"); border:none; width:150px;height:150px; ' height='"+s.thumbHT+"' width='"+s.thumbWT+"' align='absmiddle'  />"; 
					$(this).replaceWith(HoldGal+"<a rel='prettyPhoto[gallery1]' href='"+FPath+"' ><span class='imgStk'>"+rImg+"</span></a><br class='clearit'/>"+endHoldGal);
				 	/*var rImg ="<img src='images/spacer.gif' class='newthumb' style='background-image:url("+path+"); border:none; ' height='"+s.thumbHT+"' width='"+s.thumbWT+"' align='absmiddle'  />";
					$(this).replaceWith("<a rel='prettyPhoto[gallery1]' href='"+FPath+"' class='"+s.uiClass+"'>"+rImg+"</a>");
					$("img").css({backgroundPosition:"50% 50%"});*/
            });
        }
    });
     
})(jQuery);



