
$.preloadImages = function()
{
       for(var i = 0; i<arguments.length; i++)
       {
               $("<img />").attr("src", arguments[i]);
       }
}


$(document).ready(function(){

  $.preloadCssImages();

/*
    $("div#portsingle").slideViewerPro({ 
        thumbs: 6,  
        autoslide: true,  
        typo: true, 
        galBorderWidth: 0, 
        thumbsBorderOpacity: 0,  
        buttonsTextColor: "#707070", 
        buttonsWidth: 40, 
        thumbsActiveBorderOpacity: 0.8, 
        shuffle: true 
    }); 
*/

  $(".post h2 a").live("click",function(event){
                //prevent standard browser link behavior
                event.preventDefault();
                //Fade out any existing visible content
				$(window).scrollTop(0);
                $("#singledetails div *:visible").fadeOut("slow");
                // Close existing project
                //$("#singledetails:visible").fadeOut("slow");
				$("#detailed").html('<p style="text-align:center;"><img src="http://www.idesi9n.com/ajax-loader.gif" width="16" height="16" style="margin: auto;"/></p>');	
                var randomnumber=Math.floor(Math.random()*100000000);
                var postAjaxURL = $(this).attr("href") + " #portsingle";
                $("#singledetails #detailed").load( postAjaxURL, {rand: randomnumber}, function(){                                         
                        //Set contents of #project-expanded to display:none so they can be faded in later
                        $("#singledetails div *").css("display","none");
                        //Expand #project-expanded through .show effect
                        $("#singledetails").fadeIn("slow");
                        //After #project-expanded is expanded, fade in the contents 
                        $("#singledetails div *").fadeIn("slow"); 
						Cufon.replace('#body-wrap.portfolio.subpage h2');
						$(".portfolio .wrap").vgrid();
					
				$.scrollTo(0, {duration:300});
						
                });
                return false;
			
    });
 
$("#singleclose").click(function () {
			$("#singledetails div *").hide("fast", function(){
			$("#singledetails").fadeOut(0);
															   });});

/*
$.jTwitter('crazyclouds', 1, function(data){
        $('.twitter').empty();
        $.each(data, function(i, post){
            $('.twitter').append(
                '<span>' +  '<a href="http://www.twitter.com/crazyclouds">@crazyclouds tweeted:</a> ' +   post.text +' </span>'
            );
        });
    });

 */
$(".twitter").tweet({
            username: "crazyclouds",  //Change this. 
            join_text: "auto",
            avatar_size: 48,
            count: 1,
            auto_join_text_default: "I said,",
            auto_join_text_ed: "I",
            auto_join_text_ing: "I was",
            auto_join_text_reply: "I replied to",
            auto_join_text_url: "I was checking out",
            loading_text: "loading tweets..."
        });


$("#header-wrap").css({backgroundPosition: "365px 56px"}).animate({backgroundPosition: "393px 56px"}, 500)

$("a.active").animate({paddingBottom: "10px"}).animate({paddingBottom: "0px"}, 200)

/*
$("#logo").hover(
    function(over) {
        $(this).stop().animate({opacity:"0.8"});
    },
    function(out) {
     $(this).stop().animate({opacity:"1"});
    });
*/		


$("#bodymenu li").hover(
    function(over) {
        $(this).stop().animate({width:"275px"}).find('b, span').animate({color:"#cdcdcd"});
    },
    function(out) {
     $(this).stop().animate({width:"263px"}).find('b, span').animate({color:"#888"});
    });
		
	
    $(".project a").css({bottom:"0px"}).hover(
    function(over) {
        $(this).find('img').stop().animate({bottom:"10px"})
    },
    function(out) {
    $(this).find('img').stop().animate({bottom:"0px"})
    });
						
$(".about").css({bottom:"400px"}).animate({bottom: "0px"}, 1000, "swing");
$(".contact").css({top:"400px"}).animate({top: "0px"}, 1000);

	
   


	});


