xnTimeOut = 0;
jQuery(document).ready(function(){
        
        if ( $('.image-gallery').length > 0 ) {
        	$('a.image-gallery-ele').each(
        		function() {
				var galARel = 'cboxGal';
                                /*var galTitle = $(this).parent('div.grid_12').find('h2').text();
                                if ( galTitle.length > 0 ) {
                                    galARel = galARel+'-'+galTitle;
                                }*/
        			$(this).colorbox({rel:galARel,maxHeight:'80%',opacity:'0.7'});
        		}
        	); 
	        /*if ( $('.highlights').length > 0 ) {      	   
        		$('a.image-gallery-ele').each(
        			function() {     			
        				$(this).append('<div class="image-mask"></div>');
        			}
        		);
	        }*/
        }

	$("#content").css({
	 'height':'auto'
	});
	$("#banner").css({
	 'height':'auto'
	});
	$(".lightbox1").colorbox({width:"800px", height:"80%", iframe:true});
	$(".accordion").accordion({ active: false });
	$(".button").button();
	$(".dialog").dialog();
  $(".tabs").tabs();
  var effect = 'slide';
  var options = {};
  var speedin = 500;
  var speedout = 200;
  xbproofAni = true;
  $('.blink').blink(500);
  function fadeInSub1() {	
    if ( typeof(xoInterval) != 'undefined' ) {
      window.clearInterval(xoInterval);
    }
    if ( xbproofAni ) {
      xoInterval = window.setInterval("clearMenu()",1000);
      xnTimeOut = 0;
      xbproofAni = false
      $('div.sub:visible',$(this).parent().prevAll()).hide(effect,options,speedout);
      $('div.sub:visible',$(this).parent().nextAll()).hide(effect,options,speedout);
      $('div.subsub:visible',$(this).parent().prevAll()).hide(effect,options,speedout);
      $('div.subsub:visible',$(this).parent().nextAll()).hide(effect,options,speedout);
      if ( $('div.sub:visible',$(this).parent()).length > 0 ) {
        xbproofAni = true;
      }
      $('div.sub:hidden',$(this).parent()).show(effect,options,speedin, 
        function() {
          xbproofAni = true;
        }
      );
    }
   }

  

});

(function($)
{
	$.fn.blink = function(options)
	{
		var defaults = { delay:500 };
		var options = $.extend(defaults, options);
		
		return this.each(function()
		{
			var obj = $(this);
			setInterval(function()
			{
				if($(obj).css("color") == "#4c4c4c")
				{
					$(obj).css('color','#CC0000');
				}
				else
				{
					$(obj).css('color','#4c4c4c');
				}
			}, options.delay);
		});
	}
}(jQuery))

function clearMenu () {
  var effect = 'slide';
  var options = {};
  var speedin = 500;
  var speedout = 200;
  xnTimeOut ++;
  if ( xnTimeOut >= 8 ) {
      $('div.sub:visible').hide(effect,options,speedout);
      $('div.subsub:visible').hide(effect,options,speedout);
      xnTimeOut = 0;
  } 
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  win = window.open(theURL,winName,features);
  win.focus();
}


