function createCaption(img) {
	
	var imgStyle = img.attr("style");
	var imgWidth = img.attr("width");
	var imgHeight = img.attr("height");
	var imgAlternative = img.attr("alt");
	var imgSrc = img.attr("src");
	var imgTitle = img.attr("title");
	
	img.css({margin: "0px", float: "none"});
	img.wrap("<div style='" + imgStyle +" background-color: #fff; padding: 5px; border: 1px solid #ccccd0;'></div>");
	img.after('<div style="margin-top: 5px; width: ' + imgWidth + 'px; text-align: center; font-size: 12px; font-family: \'Trebuchet MS\', Arial; color: #555;">' + imgTitle + '</span>');

}

function moveSkyline() {

	var curPos = "";

	if($(".skyline").css('backgroundPosition') == "" || $(".skyline").css('backgroundPosition') == undefined) {
		$(".skyline").css({backgroundPosition: "0px 0px"});
	}else{
		curPos = $(".skyline").css('backgroundPosition');
	}
	
	pos = curPos.split(" ");
	pos[0] = pos[0].substr(0, pos[0].length - 2);

	pos[0] = pos[0] - 1;

	$(".skyline").css({backgroundPosition: pos[0] + "px 0px"});
	
	
}

$(document).ready(function() {
	//fix png for ie < 7
    $(document).pngFix();
	
	window.setInterval("moveSkyline();", 75);
	
	$("#sliderControl .text").animate({opacity: 0.2}, 2500);
	
	$("#mainContent").find("img").each(function() {
		if($(this).attr("title") != "" && $(this).attr("title") != undefined) {
			createCaption($(this));
		}
	});
});
