// JavaScript Document
$(document).ready(function(){


initHover();
initPreview();
initCover();

});

function initPreview() {
	$('.photoBlock a').click(function () {
	try {
		var img= document.createElement('img');
	    img.src= $(this).attr('href');
		$(img).attr('title','close');
		$(img).addClass('fullImage');
		$(img).click(function() {$(this).remove();});
		$(this).parent().prepend($(img));
		return false;
		} 
	catch(e) {alert(e); return false; }
	});
}
function initCover() {
	$('.coverLink').click(function () {
	try {
		var img= document.createElement('img');
	    img.src= $(this).attr('href');
		$(img).attr('title','close');
		$(this).hide();
		$(img).addClass('fullImage');
		$(img).click(function() {
		  jQuery(".coverLink",$(this).parent()).show();
			$(this).remove(); 
			
//			alert($(this).parent().class()+' ');
			});
		$(this).parent().prepend($(img));
		return false;
		} 
	catch(e) {alert(e); return false; }
	});
}

function initHover() {
	var config = {    
		 sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 10, // number = milliseconds for onMouseOver polling interval    
		 over: h_fadeOut, // function = onMouseOver callback (REQUIRED)    
		 timeout: 10, // number = milliseconds delay before onMouseOut    
		 out: h_fadeIn // function = onMouseOut callback (REQUIRED)    
		};
	var config2 = {    
		 sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 0, // number = milliseconds for onMouseOver polling interval    
		 over: h_fadeOut2, // function = onMouseOver callback (REQUIRED)    
		 timeout: 0, // number = milliseconds delay before onMouseOut    
		 out: h_fadeIn2 // function = onMouseOut callback (REQUIRED)    
	};
	$('.hoverable').hover(
		function() {$(this).addClass('active');	}, 
		function() {$(this).removeClass('active');});
	$('#banner').hoverIntent(config2);
	$('#curIssue').hoverIntent(config);
	$('#curIssue').click(
	 function() {
		 window.location.href="http://irieup.com/index.php/check-all-issues/"; 
	  }
	);
}
function h_fadeIn() { $('#curCover').fadeIn();}
function h_fadeOut() {  $('#curCover').fadeOut();}
function h_fadeIn2() { $('#banner a img').fadeIn(50);}
function h_fadeOut2() { $('#banner a img').fadeOut(50);}