/* Global FancyBox and jQuery Cycle Scripts */

$(document).ready(function() {
	
	/* Cycle Images on Index - Wide */
	$(".picswide").cycle({
    	fx: 'fade',
		timeout: 6000,
		speed: 950,
		delay: 0,
		pause: 1,
		random: 1
  	});

	/* Cycle Images on all pages - Normal */
	$(".pics").cycle({
    	fx: 'fade',
		timeout: 6000,
		speed: 950,
		delay: 0,
		pause: 1,
		random: 1
  	});
	
	/* Fancybox 1.3.4 Global - New Homes, Office Units, Park Models, etc. */
	$("a.fancynewhome").fancybox({
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': true,
		'hideOnOverlayClick': true,
		'cyclic': true,
		'titleshow': true,
		'titlePosition': 'inside',
		'transitionIn': 'none',
		'transitionOut': 'none',
		'changeSpeed': 100
	});
	
	
	/* Right hand Specs Link on Park Models page, opening in new iFrame */
	$(".pmspecs").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 800,
		'height': 480,
		'autoScale': true,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': true,
		'hideOnOverlayClick': true,
		'transitionIn': 'none',
		'transitionOut': 'none'
	});
	
	/* Right hand specs links on CanadaBuilds page, opening in new iFrame */
	$(".cbspecs").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 402,
		'height': 480,
		'autoScale': true,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': true,
		'hideOnOverlayClick': true,
		'transitionIn': 'none',
		'transitionOut': 'none'
	});
	
	/* Hart Housing page descriptions for individual unit descriptions, opening in new iFrame */
	$(".fancyhart").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 800,
		'height': 480,
		'autoScale': true,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': true,
		'hideOnOverlayClick': true,
		'transitionIn': 'none',
		'transitionOut': 'none'
	});
	
	/* Fancybox jQuery Contact Form Window */
	$("a.fancycontactform").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 580,
		'height': 510,
		'autoScale': true,
		'enableEscapeButton': false,
		'overlayShow': true,
		'centerOnScroll': true,
		'hideOnContentClick': false,
		'hideOnOverlayClick': false,
		'overlayOpacity': 0.75
	});
	
	/*------ ZINE SCRIPTS FORM BUILDER CONTACT FORM -------*/
	$("#fancycontactform2").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 550,
		'height': 500,
		'autoScale': true,
		'enableEscapeButton': false,
		'overlayShow': true,
		'centerOnScroll': true,
		'hideOnContentClick': false,
		'hideOnOverlayClick': false,
		'overlayOpacity': 0.75
	});
	$("#fancycontactform-north").fancybox({
		'type': 'iframe',
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 550,
		'height': 500,
		'autoScale': true,
		'enableEscapeButton': false,
		'overlayShow': true,
		'centerOnScroll': true,
		'hideOnContentClick': false,
		'hideOnOverlayClick': false,
		'overlayOpacity': 0.75
	});
	
	/* Fancybox Northlander Video Window */
	$("a.northlandervideo").fancybox({
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	75,
		'width': 640,
		'height': 480,
		'enableEscapeButton': true,
		'overlayShow': true,
		'centerOnScroll': true,
		'hideOnContentClick': false,
		'overlayOpacity': 0.75
	});
	
	//------------------------------------
	// Century Homes SWF Fancybox Object
	//------------------------------------
	
	$("#centurykitchenswf").fancybox({
	    'padding'           : 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'zoomSpeedIn':	200, 
		'zoomSpeedOut':	200,
		'width': 720,
		'height': 440,
		'enableEscapeButton': true,
		'overlayShow': true,
		'centerOnScroll': true,
		'hideOnContentClick': false,
		'overlayOpacity': 0.75,
		'titlePosition': 'inside',
		'type': 'swf',
		'swf'			: {
			    'wmode'				: 'opaque',
				'allowfullscreen'	: 'true'
			}
	});
	
	/* Century Slideshow Simpleviewers loading in FancyBox */
	$("#simpleviewershow").fancybox({
		'zoomSpeedIn':	200, 
		'zoomSpeedOut':	200,
		'width': 805,
		'height': 455,
		'padding': 0,
		'margin': 0,
		'scrolling': 'no',
		'autoScale': false,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': true,
		'hideOnOverlayClick': true,
		'transitionIn': 'fade',
		'transitionOut': 'fade',
		'type': 'iframe'
	});
	
	/* Global Website Image Gallery *New 2011* Apple-Style Design */
	$("a.omhgallery").fancybox({
		'zoomSpeedIn':	200, 
		'zoomSpeedOut':	200,
		'width': 700,
		'height': 500,
		'padding': 0,
		'margin': 0,
		'scrolling': 'no',
		'autoScale': false,
		'overlayShow': true,
		'overlayOpacity': 0.75,
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': false,
		'hideOnOverlayClick': true,
		'transitionIn': 'fade',
		'transitionOut': 'fade',
		'type': 'iframe'
	});
	
	/* ------------------------------------------- */
	/*   New Homes Image Multi-Gallery, Late 2011  */
	/* ------------------------------------------- */ 
	$("a.multigallery").fancybox({
		'zoomSpeedIn':	200, 
		'zoomSpeedOut':	200,
		'width': 755,
		'height': 480,
		'padding': 0,
		'margin': 0,
		'scrolling': 'no',
		'autoScale': false,
		'overlayShow': true,
		'overlayOpacity': 0.55,
		'overlayColor': '#000',
		'centerOnScroll': true,
		'enableEscapeButton': true,
		'hideOnContentClick': false,
		'hideOnOverlayClick': true,
		'transitionIn': 'fade',
		'transitionOut': 'fade',
		'type': 'iframe',
		'titleShow': true,
		'titleFormat': formatMultiGalleryTitle,
		'titlePosition': 'outside'
	});
	
	/* FancyBox Title Formatting to Match Multi-Gallery */
	
	function formatMultiGalleryTitle(title, currentArray, currentIndex, currentOpts) {
    	return '<div id="title-multigallery">' + (title && title.length ? '<b>' + title + '</b>' : '' ) + '</div>';
	}
			//'titleFormat'		: formatTitle  (or in this case: formatMultiGalleryTitle - for fancybox call to this javascript


	
	/*---------------------------------------*/
	/*  Initialize the Century scrollables   */
	/*---------------------------------------*/
	
	$(".scrollable").scrollable({ vertical: true, mousewheel: true });
	
	
	// Tooltips for New Homes/Office/ParkModel unit listings
	// over the icons to show whether the appliances are available or not
	
	$("a.fridge").tooltip({ tipClass: 'tooltip-fridge', delay: 0});
	$("a.nofridge").tooltip({ tipClass: 'tooltip-fridge', delay: 0});
	
	$("a.stove").tooltip({ tipClass: 'tooltip-stove', delay:0});
	$("a.nostove").tooltip({ tipClass: 'tooltip-stove', delay: 0});
	
	$("a.microwave").tooltip({ tipClass: 'tooltip-mw', delay: 0});
	$("a.nomicrowave").tooltip({ tipClass: 'tooltip-mw', delay: 0});
	
	$("a.dishwasher").tooltip({ tipClass: 'tooltip-dw', delay: 0});
	$("a.nodishwasher").tooltip({ tipClass: 'tooltip-dw', delay: 0});
	
	$("a.laundry").tooltip({ tipClass: 'tooltip-laundry', delay: 0});
	$("a.nolaundry").tooltip({ tipClass: 'tooltip-laundry', delay: 0});
	
	$("a.heating").tooltip({ tipClass: 'tooltip-heating', delay: 0});
	$("a.heating").tooltip({ tipClass: 'tooltip-heating', delay: 0});
	
	$("a.aircond").tooltip({ tipClass: 'tooltip-aircond', delay: 0});
	$("a.aircond").tooltip({ tipClass: 'tooltip-aircond', delay: 0});
	
	$("a.csa").tooltip({ tipClass: 'tooltip-csa', delay: 0});
	$("a.csa").tooltip({ tipClass: 'tooltip-csa', delay: 0});
	
	$("a.esa").tooltip({ tipClass: 'tooltip-esa', delay: 0});
	$("a.esa").tooltip({ tipClass: 'tooltip-esa', delay: 0});
	
	$("a.pdf").tooltip({ tipClass: 'tooltip-pdf', delay: 0});
	$("a.nopdf").tooltip({ tipClass: 'tooltip-pdf', delay: 0});
	
	
	/*------------------------------------------------------*/
	/*       Initialize the Century Tabs                    */
	/*------------------------------------------------------*/
	
	$("ul.tabs").tabs("div.panes > div");
	
	
	/*-------------------------------------*/
	/*   jQuery Hover Banner Scripts       */
	/*-------------------------------------*/
	
	jQuery.noConflict();

	jQuery(".jquery-hover").hide();
	jQuery(".jquery-overlay").hide();
 
 	// North Office
	jQuery(".jquery-container-northoffice").hover(function() {
	jQuery(this).children(".jquery-hover").stop().show().css({ "left" : "-450px" }).animate({left : 0}, 150);
	jQuery(this).children(".jquery-overlay").stop().fadeTo(500, .7)
	}
	,function() {
	jQuery(this).children(".jquery-hover").stop().animate({left : 450}, 300);
	jQuery(this).children(".jquery-overlay").stop().fadeTo(500, 0)
	});
	
	// South or Head Office
	jQuery(".jquery-container-southoffice").hover(function() {
	jQuery(this).children(".jquery-hover").stop().show().css({ "left" : "-450px" }).animate({left : 0}, 150);
	jQuery(this).children(".jquery-overlay").stop().fadeTo(500, .7)
	}
	,function() {
	jQuery(this).children(".jquery-hover").stop().animate({left : 450}, 300);
	jQuery(this).children(".jquery-overlay").stop().fadeTo(500, 0)
	});
	
	/*-------------------------------------*/
	
	
});
