/**
 * @author kiril
 *
 * File configuration for all jScript components 
 */
currentCount = 1;
function countIt(curCount) {
	currentCount = parseInt(curCount);
	if(currentCount < 1) {
		currentCount = 1;
	}
};

$(document).ready(function() {
	// ******** initialize superfish menu **********
	if($('ul.sf-menu').length > 0) {
		$('ul.sf-menu').supersubs({
			minWidth : 12, // minimum width of sub-menus in em units
			maxWidth : 25, // maximum width of sub-menus in em units
			extraWidth : 1
			// extra width can ensure lines don't sometimes turn over
			// due to slight rounding differences and font-family
		}).superfish({
			autoArrows : false
		});
		// call supersubs first, then superfish, so that subs are
		// not display:none when measuring. Call before initialising
		// containing tabs for same reason.
	}

	// ********** initialize installations showcase scrollable *************
	if($("#featured-installations").length > 0) {
		$("#featured-installations").scrollable();
	}

	// ********** initialize thumb gallery ******
	if($('div.scrollable.thumbs').length > 0) {

		$('div.scrollable.thumbs').scrollable({
			size : 5,
			easing : "swing",
			speed : 800
		});
	}

	// ********** initialize Pretty Photo lightbox ******
	if($("a[rel^='prettyPhoto']").length > 0) {

		$("a[rel^='prettyPhoto']").prettyPhoto({
			overlay_gallery : false
		});

	}

	// ********** setup custom VWO test for subscribe check box ******
		if($('#cfSubscribe').length > 0) {
			$('#cfSubscribe').click(function() {

				if($(this).attr('checked')) {

					if( typeof (_vis_opt_top_initialize) == "function") {
						// Code for Custom Goal: Select subscribe check box
						_vis_opt_goal_conversion(200);
						_vis_opt_pause(500);
					}
				}
			});
		}


	// ************ Set hidden form fields for referrer value and date for tracking ******************

	if($("#refer").length > 0) {
		$("#refer").val(cRefer);
	}
	if($("#refer_date").length > 0) {
		$("#refer_date").val(cDateRef);
	}

});

