jQuery(document).ready(function() {



var dd=0;
jQuery('#block1').find('a').each(function(index) {
if(!$(this).hasClass('link')){
dd=dd+6;
$(this).css('margin-left', dd+'px');
}
  });
  
var dd=0;
jQuery('#block2').find('a').each(function(index) {
if(!$(this).hasClass('link')){
dd=dd+6;
$(this).css('margin-right', dd+'px');
}
  });
var dd=95;
jQuery('#block3').find('a').each(function(index) {
if(!$(this).hasClass('link')){
dd=dd-4;
$(this).css('margin-left', dd+'px');
}
  });
var dd=95;
jQuery('#block4').find('a').each(function(index) {
if(!$(this).hasClass('link')){
dd=dd-4;
$(this).css('margin-right', dd+'px');
}



  });


			jQuery.preLoadImages("/images/blocksbg_01.png", "/images/blocksbg_02.png","/images/blocksbg_03.png", "/images/blocksbg_04.png");

			jQuery("#outer AREA").mouseover(function(){
				var regionList = '.'+$(this).attr('id')+'-bl';
			
  jQuery(regionList).customFadeIn("slow"); 
  
				
			});

		jQuery("#outer AREA").click(function(event){
		event.preventDefault();
			if($(this).attr('id') == 'block5'){
			showorhide ('block1');
			showorhide ('block2');
			showorhide ('block3');
			showorhide ('block4');
			}
		});	
								});
function showorhide(id){
if($('#'+id).css('display') == 'none'){

  jQuery('#'+id).customFadeIn("slow"); 
 
}else{


  jQuery('#'+id).customFadeOut("slow"); 

}

}

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

function showpopup(){
if($('#popup').css('display') == 'block'){
$('#popup').customFadeOut("slow");}else{
$('#popup').customFadeIn("slow");
}
}

(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};
})(jQuery);
