$(document).ready(function(){
	$('.rollmap').hover(function(){
		var over = $(this).attr('id');
		$('#' + over + '_over').show();		
	}, function() {
		var over = $(this).attr('id');
		$('#' + over + '_over').hover(function(){	
			//nothing								   
		}, function() {
			$('#' + over + '_over').hide();
		});
	});	
	
	rollovers();
	
	if($('#comment-inline').length) {
		$("#comment-inline").colorbox({width:"610px", inline:true, href:"#inline", title:"Tell Rex Something"});
	}
	
	if($('#down_link').length){
		$('#down_link').click(function () { 
		  $('#down_link_img').attr('src','assets/images/download_down.png');
		  setTimeout(function () { $('#down_link_img').attr('src','assets/images/download_off.png'); }, 2000);
		});
	}
	
	if($('#page1').length) {
		var top = 'page1_img';
		
		$('#page1_img').click(function() {
			if(top == 'page1_img') {
				$('#page1_img').css('left','-70px');
				$('#page2_img').css('marginLeft','263px');
				top = 'page2_img';
			}else{
				$('#page1_img').css('left','0px');
				$('#page2_img').css('marginLeft','100px');
				top = 'page1_img';
			}
		});
	}
});


function rollovers()
{
	$(".rollover").hover(
		function () {
			var imgSrc = $(this).attr("src");
			var newImgSrc = imgSrc.replace("_off","_on");
			
			$(this).attr("src",newImgSrc);
		}, 
		function () {
			imgSrc = $(this).attr("src");
			newImgSrc = imgSrc.replace("_on","_off");
			
			$(this).attr("src",newImgSrc);
		}
	);
}


