jQuery(document).ready( function(){
    jQuery('#SearchForm_SearchForm_Search').focus(function() {
    	jQuery(this).val('');
    });
    
	jQuery('#Content a, #SearchResults a, #MainHotLinks a, #SideBarContent a').each(function() {
		var fileURL = jQuery(this).attr('href');
		if (fileURL) {
			if (fileURL.match("\.doc$")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_doc.gif) no-repeat scroll 0 1px');
			}
			if (fileURL.match("\.pdf$")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_pdf.gif) no-repeat scroll 0 1px');
			}
			if (fileURL.match("\.xls$")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_xls.gif) no-repeat scroll 0 1px');
			}
			if (fileURL.match("\.ppt$")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_ppt.gif) no-repeat scroll 0 1px');
			}
		}
	});
	
	jQuery(".photo a").fancybox(); 
	
	jQuery('#EmailLink').fancybox({
		'hideOnContentClick': false,
		'frameWidth': 300
	});
	jQuery('#PrintPage').click(function() {
		window.print();
		return false;
	});
	if ( jQuery('#MessageClick') ) {
		jQuery('#MessageClick').fancybox({
			'frameWidth': 300,
			'frameHeight': 50
		});
		jQuery('#MessageClick').click();
	}
	
	jQuery('#SideBarAds a img').each(function() {
		var temp = jQuery(this).parent().attr('title');
		jQuery(this).attr('alt',temp);
	});
	
	
	
    
    var background = jQuery('#MainHotButtonImage1').html();
    jQuery('#MainHotLinks').css('background-image','url("'+background+'")');
	jQuery("#MainHotButton1").hover(
      function () { showHot1(); }, 
      function () { }
    );
	jQuery("#MainHotButton2").hover(
      function () { showHot2(); }, 
      function () { }
    );
	jQuery("#MainHotButton3").hover(
      function () { showHot3(); }, 
      function () { }
    );
	jQuery("#MainHotLinks").hover(
      function () { isMoving = 0; }, 
      function () { isMoving = 1; }
    );
    setTimeout("goToNext();",5000);
});


    
var isMoving = 1;
var currentHot = 1;

function goToNext() {
	if (isMoving == 1) {
		if (currentHot == 1) { showHot2(); }
		else if (currentHot == 2) { showHot3(); }
		else if (currentHot == 3) { showHot1(); }
	}
	setTimeout("goToNext();",6000);
}


function showHot1() {
	jQuery('#MainHotLinks h2 a').css('color','#00ab4e');
	jQuery("#MainHotButton1").css('color','#e4ecef');
	var background = jQuery('#MainHotButtonImage1').html();
	jQuery('#MainHotLinks').css('background-image','url("'+background+'")');
	jQuery('#MainHotButtonOn').animate({ 
	    marginTop: "0px"
	  }, 500 );
	jQuery('#MainHotContent2,#MainHotContent3').fadeOut();
	jQuery('#MainHotContent1').fadeIn();
	currentHot = 1;
}
function showHot2() {
	jQuery('#MainHotLinks h2 a').css('color','#00ab4e');
	jQuery("#MainHotButton2").css('color','#e4ecef');
	var background = jQuery('#MainHotButtonImage2').html();
	jQuery('#MainHotLinks').css('background-image','url("'+background+'")');
	jQuery('#MainHotButtonOn').animate({ 
	    marginTop: "63px"
	  }, 500 );
	jQuery('#MainHotContent1,#MainHotContent3').fadeOut();
	jQuery('#MainHotContent2').fadeIn();
	currentHot = 2;
}
function showHot3() {
	jQuery('#MainHotLinks h2 a').css('color','#00ab4e');
	jQuery("#MainHotButton3").css('color','#e4ecef');
	var background = jQuery('#MainHotButtonImage3').html();
	jQuery('#MainHotLinks').css('background-image','url("'+background+'")');
	jQuery('#MainHotButtonOn').animate({ 
	    marginTop: "126px"
	  }, 500 );
	jQuery('#MainHotContent1,#MainHotContent2').fadeOut();
	jQuery('#MainHotContent3').fadeIn();
	currentHot = 3;
}