$(document).ready(function(){
/* initialization */
	$(".project_old  .gallery ul li a").fancybox({
		titlePosition:	'over'
	}); 
	
	$(".project .content .e2g .galleryCell .boxcontent a").fancybox({
		titlePosition:	'over'
	});
	
	$("header.basic .con-info .section .faq").popupwin({
		pwinBlock: '.questionForm',
		pwinClose: '.questionForm a.close',
		pwinBack: '#000',
		pwinOpacity: 0.3,
		pwinSpeed: 'slow'
	});
	
	$("header.basic .con-info .section .call").popupwin({
		pwinBlock: '.callForm',
		pwinClose: '.callForm a.close',
		pwinBack: '#000',
		pwinOpacity: 0.3,
		pwinSpeed: 'slow'
	}); 
	
/* ========= scripts =========== */
	/*$('.i-content section .partners .slider a.disabled').click(function(){
		return false;
	});*/
	
	function hoverIMG(iclass) {
		if (iclass.length > 0) {
			var img = new Image ();
			iclass.each(function(){
				img.src=$('img', this).attr('rel');
			});
			iclass.hover(function(){
				var rel = $('img', this).attr('rel');
				var src = $('img', this).attr('src');
				$('img', this).attr('src', rel);
				$('img', this).attr('rel', src);
			}, function(){
				var rel = $('img', this).attr('rel');
				var src = $('img', this).attr('src');
				$('img', this).attr('src', rel);
				$('img', this).attr('rel', src);
			});
		}
	}
	hoverIMG($('.i-sidebar .supplier .section a'));
	hoverIMG($('.footer .card a'));
	
	indexSlider = $('.i-content section .partners .slider .wrap ul li:first span.img').innerHeight();
	var hLi = 0;
	$('.i-content section .partners .slider .wrap ul li').each(function(){
		var img = $('img', this).innerHeight();
		if (img < indexSlider) {
			$('img', this).css({'margin-top': ((indexSlider-img)/2)});
		}
		var li = $(this).innerHeight();
		if (li > hLi) {
			hLi = li;
		}
	});
	$('.i-content section .partners .slider .wrap').css({'height': hLi+10});
	$(".i-content section .partners .slider .wrap").jCarouselLite({
		btnNext: ".i-content section .partners .slider  .next",
		btnPrev: ".i-content section .partners .slider  .prev",
		visible: 2,
		circular: true
	});
	hoverIMG($('.i-content section .partners .slider .wrap ul li a')); 
});
