  $(document).ready(function(){							 

		if($("#homepage")){
			
			jQuery.fn.onImagesLoaded = function(_cb) { 
  return this.each(function() {
 
    var $imgs = (this.tagName.toLowerCase()==='img')?$(this):$('img',this),
        _cont = this,
            i = 0,
    _done=function() {
      if( typeof _cb === 'function' ) _cb(_cont);
    };
 
    if( $imgs.length ) {
      $imgs.each(function() {
        var _img = this,
        _checki=function(e) {
          if((_img.complete) || (_img.readyState=='complete'&&e.type=='readystatechange') )
          {
            if( ++i===$imgs.length ) _done();
          }
          else if( _img.readyState === undefined ) // dont for IE
          {
            $(_img).attr('src',$(_img).attr('src')); // re-fire load event
          }
        }; // _checki \\
 
        $(_img).bind('load readystatechange', function(e){_checki(e);});
        _checki({type:'readystatechange'}); // bind to 'load' event...
      });
    } else _done();
  });
};

$('#homemain').onImagesLoaded(function(_this){
     $(".contact").show(); 
			function randOrd(){
				return (Math.floor(Math.random())-0.5); 
			} 
			home_links = $(".square a").get();
			home_links.sort(randOrd);
			for(i=0;i<home_links.length;i++){
				$(home_links[i]).stop().fadeOut(Math.floor(Math.random()*6000+1))
			}
			// fade in effects
			$("#home3").mouseover(function() {			
							$("#home4 a").css({'textIndent':'0'}).fadeIn(200);
							$(this).css({'cursor':'pointer'});
			});
			$("#home7").mouseover(function() {			
							$("#home8 a").css({'textIndent':'0'}).fadeIn(200);
							$(this).css({'cursor':'pointer'});
			});
			$("#home16").mouseover(function() {			
							$("#home17 a").css({'textIndent':'0'}).fadeIn(200);
							$(this).css({'cursor':'pointer'});
			});
			$("#home20").mouseover(function() {			
							$("#home21 a").css({'textIndent':'0'}).fadeIn(200);
							$(this).css({'cursor':'pointer'});
			});		
			// click events
			$("#home3").click(function() {			
							window.location=$("#home4 a").attr("href");
			});
			$("#home7").click(function() {			
							window.location=$("#home8 a").attr("href");
			});
			$("#home16").click(function() {			
							window.location=$("#home17 a").attr("href");
			});
			$("#home20").click(function() {			
							window.location=$("#home21 a").attr("href");
			});
  });
}
		
 });
