// CENTER  INITIAL PORTFOLIO IMAGE
$(document).ready(function(){
	var startHeight = 0;
	var startWidth = 0;
	$(".pubwrap").addClass('inithide');
 	var imgStart = new Image();
        imgStart.src = $(".pubwrap").find('img').attr("src");
 	$("#thumbs ul li").addClass("initwait");
	startHeight = imgStart.height;
	startWidth = imgStart.width;
 	$("div.inithide .newshadowwrap").css("left",(530-startWidth)/2);
 	$("div.inithide .newshadowwrap").css("top",(550-startHeight)/2);
	if ($.browser.msie){
		var startHeight = imgStart.height;
		var startWidth = imgStart.width;
 	        $("div.inithide .newshadowwrap").css("left",(530-startWidth)/2);
	}
 	$('#photoimg').load(function(){ 
 		var startHeight = imgStart.height;
                var startWidth = imgStart.width;
 	        $("div.inithide .newshadowwrap").css("left",(530-startWidth)/2);
 	        $("div.inithide .newshadowwrap").css("top",(550-startHeight)/2);
 			$('.inithide').fadeIn(1200, function(){ 
 				$('.inithide').removeClass('inithide'); 
 				$('.initwait').removeClass('initwait'); 
 			}); 
 		});
});

// PORTFOLIO IMAGE SWAP WITH FADE
$(document).ready(function() {	
	//Click and Hover events for thumbnail list
	$("#thumbs ul li:first").addClass('on'); 
	$("#thumbs ul li").click(function(){ 
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt");
		var imgFile = $(this).find('a').attr("href");
		var imgDesc = $(this).find('.block').html();
                var imgNew = new Image();
                imgNew.src = $(this).find('a').attr("href");

		if ($(this).is(".active")) {
			return false;
		} else if ($(this).is(".wait")) {
			return false;
		} else {
		// add image with dropshadow 
			$('.pubwrap').addClass('old').before('<div class="pubwrap hide"><div class="photowrap"><div class="newshadowwrap"><div class="shadow-one"><div class="corner-a"></div><div class="corner-b"></div><div class="shadow-two"><div class="shadow-three"><div class="shadow-four"><div id="photodiv"><img src="'+ imgFile +'" alt="'+imgAlt+'" title="'+imgAlt+'" id="newimg" /></div></div></div></div></div></div></div><div id="pubinfo">' + imgDesc + '</div></div>');
			$("#thumbs ul li").addClass("wait");
			$('#newimg').load(function(){ 
                              var getHeight = imgNew.height;
                              var getWidth = imgNew.width;
	                      $("div.hide .newshadowwrap").css("left",(530-getWidth)/2);
	                      $("div.hide .newshadowwrap").css("top",(550-getHeight)/2);

			      $('.hide').fadeIn(1200, function(){ 
				   $('.old').remove();
				   $('.hide').removeClass('hide'); 
				   $('.wait').removeClass('wait'); 
			      }); 
		         });
		}	
		$("#thumbs ul li").removeClass('on'); //Remove class of 'active' on all lists
		$(this).addClass('on');  //add class of 'active' on this list only
		return false;
	}) .hover(function(){
                if ($(this).is(".wait")){ }
                else {$(this).addClass('hover');}
		}, function() {$(this).removeClass('hover');});
});//Close Function

// INITIALIZE THUMBNAIL CAROUSEL
$(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // Configuration goes here
        visible: 10,
        scroll: 10
    });
});






