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

// 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 
			$('.photowrap').addClass('old').before('<div class="photowrap hide"><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>');
			$("#thumbs ul li").addClass("wait");
			$('#newimg').load(function(){ 
                              var getHeight = imgNew.height;
                              var getWidth = imgNew.width;
	                      $("div.hide .newshadowwrap").css("left",(790-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
    });
});




