﻿/* ===========================================================
	 Initialisation code
   ========================================================== */

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Page-load event =-=-=

$(function() {
	// add a class of 'current' to the designers tab when on designer pages
	if ($.query.get('csId') >= 1) {
		$("#nav_site li:nth-child(3)").addClass("current");
	}

	// add scrolling if there are more than 4 images
	if ($("#case_study_carousel img").length > 4) {
		$("#case_study_carousel").jcarousel();
	}
	else {
		$("#case_study_carousel li:last").addClass('last');
	}

	// rotate the deadly sin images
	$("#rotate").newsticker(5000);

	// fade the designer case studies in
	$("#case_study_imagery, #case_studies").css({ "display": "none" }).fadeIn(500);

	$("#shop_online li li:last-child").css("border", "none");

	if ($("#embiggener").length) {
		// We have the embiggener
		$.getScript("http://js.if-fma.com/jquery.jqzoom.pack.1.0.1.js", function() {
			$("#embiggener").jqzoom({
				imageOpacity: 0.2,
				fadeinSpeed: 'medium',
				fadeoutSpeed: 'medium',
				hideEffect: 'fadeout',
				position: 'right',
				showEffect: 'fadein',
				title: false,
				xOffset: 10,
				yOffset: 0,
				zoomHeight: 362,
				zoomType: 'reverse',
				zoomWidth: 362
			});
		});
	}
});	
