// Get Date for Copyright
var now = new Date();
var year= now.getYear();

// Hack for Firefox & Safari Y2K Issue
if (year >= 100 && year <= 1999)
	{ 
		year = year + 1900
	}
	else {
		year = year
	}
	
// Cache Images for Rollover
$(document).ready(function(){
  $.preloadCssImages();
});

//Rollover for Social Images
$(document).ready(function(){
	$("#arenaIMG").hover(function(){
		$(this).attr({src: "images/arenaSocial_bw.png"});},function(){$(this).attr({src: "images/arenaSocial.png"});
	});
	$("#facebookIMG").hover(function(){
		$(this).attr({src: "images/facebook_bw.png"});},function(){$(this).attr({src: "images/facebook.png"});
	});
	$("#flickrIMG").hover(function(){
		$(this).attr({src: "images/flickr_bw.png"});},function(){$(this).attr({src: "images/flickr.png"});
	});
	$("#linkedinIMG").hover(function(){
		$(this).attr({src: "images/linkedin_bw.png"});},function(){$(this).attr({src: "images/linkedin.png"});
	});
	$("#gtaIMG").hover(function(){
		$(this).attr({src: "images/gta_bw.png"});},function(){$(this).attr({src: "images/gta.png"});
	});
	$("#twitterIMG").hover(function(){
		$(this).attr({src: "images/twitter_bw.png"});},function(){$(this).attr({src: "images/twitter.png"});
	});
});

/*$(document).ready(function(){
	$("#features").hover(function(){
		$(".popup").css("display","block");},
		function(){
			$(".popup").css("display","none");});
});*/

$(document).ready(function(){
	$("#features").click(function(){
		
		$("#modalBackground").css("filter","alpha(opacity=60)");
		 $("#modalBackground").css("opacity","0.60");
		 $("#modalBackground").fadeIn(700);		 
		 //$("#modalBackground").show();	 
		 $("#feature-popup").css("z-index","50000001").show(); 

	});
	$("#close").click(function(){
		$("#feature-popup").css("display","none");
		$("#contractModal").fadeOut(700);
		$("#modalBackground").fadeOut(700);
	});
	/*$("#tour").hover(function(){
		$(this).css({ backgroundImage : "url(images/tour_over.png)" });},function(){$(this).css({ backgroundImage : "url(images/tour.png)" });
	});*/
});

//Rotating Ads on Hompage using Cycle jQuery Plugin
/*$(document).ready(function(){
	$('#adControl').hover(function(){
		$(this).css({'border':'solid 2px #9a9999', 'top':'312px', 'right':'194px'});},function(){$(this).css({'border':'#000', 'top':'314px', 'right':'196px'});
		});
	$('#s1').cycle({ 
	    //fx:    'scrollLeft', 
		fx: 'scrollHorz',
	    speed:  5000,
		next: '#nextad',
		prev: '#prevad',
		autostop: 1
	 });
	 $('#pausead').click(function(){
		$('#s1').cycle('pause');
		$(this).css('visibility','hidden');
		$('#playad').css('display','block');
	});
	$('#playad').click(function(){
		$('#s1').cycle('resume');
		$('#pausead').css('visibility','visible');
		$(this).css('display','none');
	});
	$('#playad').hover(function(){
		$('#adControl').css({'border':'solid 2px #9a9999', 'top':'312px', 'right':'194px'});},function(){$('#adControl').css({'border':'#000', 'top':'314px', 'right':'196px'});
		});
 });*/
 
 //jQuery Paging
 /**
             * Callback function that displays the content.
             *
             * Gets called every time the user clicks on a pagination link.
             *
             * @param {int}page_index New Page index
             * @param {jQuery} jq the container with the pagination links as a jQuery object
* */
function pageselectCallback(page_index, jq){
	var new_content = $('#hiddenresult div.result:eq('+page_index+')').clone();
	$('#Searchresult').empty().append(new_content);
	return false;
}

/** 
	 * Callback function for the AJAX content loader.
 **/
function initPagination() {
	var num_entries = $('#hiddenresult div.result').length;
	// Create pagination element
	$("#Pagination").pagination(num_entries, {
		num_edge_entries: 2,
		num_display_entries: 8,
		callback: pageselectCallback,
		items_per_page:1
	});
 }
                    
// Load HTML snippet with AJAX and insert it into the Hiddenresult element
// When the HTML has loaded, call initPagination to paginate the elements        
$(document).ready(function(){      
	$('#hiddenresult').load('../Include/news.html', null, initPagination);
});

// jQuery Accordion
$(document).ready(function(){   
	$('#accordion').accordion();
	$('#accordion').css('visibility','visible');
});