$ = jQuery;

jQuery(document).ready(function() {
	init(jQuery);
});

function init($) {
	// lightbox
	$('#products .images a[rel*=lightbox]').lightBox({
		imageLoading: 'wp-content/themes/absecurity/images/lightbox-ico-loading.gif',
		imageBtnClose: 'wp-content/themes/absecurity/images/lightbox-btn-close.gif',
		imageBtnPrev: 'wp-content/themes/absecurity/images/lightbox-btn-prev.gif',
		imageBtnNext: 'wp-content/themes/absecurity/images/lightbox-btn-next.gif',
		imageBlank: 'wp-content/themes/absecurity/images/lightbox-blank.gif'
	});
	
	if (window.innerWidth > 480) {
		flashHeader($);
		$(window).bind('resize', function() {
			if (window.innerWidth > 480) {
				flashHeader($);
				$(window).unbind('resize');
			}
		});
	}
}

function flashHeader($) {
	var body = $('body');
	var headerFile = 'home-header';
	
	if (body.hasClass('page-id-10')) {
		headerFile = 'security-header';
	}
	else if (body.hasClass('page-id-39')) {
		headerFile = 'customer-header';
	}
	else if (body.hasClass('page-id-41')) {
		headerFile = 'cctv-header';
	}
	else if (body.hasClass('page-id-43')) {
		headerFile = 'special-header';
	}
	else if (body.hasClass('page-id-54')) {
		headerFile = 'contact-header';
	}

	$('#branding').flash({
		src: 'wp-content/themes/absecurity/flash/' + headerFile + '.swf',
		width: 768,
		height: 251
	});
}
