/* Lightbox Image Hover */
jQuery(document).ready(function($){
$('.cameron_promo img').each(function(i){
if ( jQuery(this).parent().attr('rel') != '' && jQuery(this).parent().attr('rel') != undefined ){
jQuery(this).parent().addClass('hov');
$imgw = jQuery(this).width();
$imgh = jQuery(this).height();
jQuery(this).parent().append('');
var $hovs = jQuery(this).parent().find('span.image_link_hover');
$hovs.css({width: $imgw, height: $imgh, opacity: 0});
jQuery(this).parent().hover(
function(){
$hovs.stop().animate({ opacity: '0.6' }, 500);
}, function(){
$hovs.stop().animate({ opacity: '0' }, 500);
}
);
}
});
});
/* Image Preloader */
jQuery(document).ready(function($){
var $imgContainerClass = '.cameron_promo .thumbArea';
var $images = jQuery($imgContainerClass+' a img.image_shadow');
var $max = $images.length;
jQuery('a.preloader').each(function(){
jQuery('').prependTo(jQuery(this));
});
$images.remove();
if ($max > 0){
LoadImage(0, $max);
}
function LoadImage(index, $max){
if (index < $max){
jQuery('').each(function(){
jQuery(this).prependTo(jQuery('.thumbArea a.preloader .loading_img').eq(index));
});
var $img = new Image();
var $curr = jQuery('#img'+(index+1));
jQuery($img).load(function(){
jQuery(this).css({display: 'none', opacity: 0});
jQuery($curr).append(this);
jQuery(this).css({display: 'block'}).animate({opacity: 1}, 500, function(){
jQuery(this).parent().css({backgroundImage: 'none'});
if (index == ($max-1)){
} else {
LoadImage(index+1, $max);
}
});
}).error(function(){
jQuery($curr).remove();
LoadImage(index+1, $max);
}).attr({
src: jQuery($images[index]).attr('src'),
title: jQuery($images[index]).attr('title'),
alt: jQuery($images[index]).attr('alt')
}).addClass(jQuery($images[index]).attr('class'));
}
}
});