// JavaScript Document
// Code runs after DOM has loaded

$(document).ready(function() {
		
	function formatTitle() {
		return '<div class="fancybox-customTitle"><a href="' + this.href + '" target="_parent"><img src="http://www.sol-group.net/images/fancybox/fancy_expand.png" alt="Expand" /></a><a href="' + this.href + '" target="_parent">Expand to Full Screen</a></div>';
	}
	
	function formatTitle2(title, currentArray, currentIndex, currentOpts) {
    	return '<div class="fancybox-customTitle2">' + currentArray.length + ' ' + title + ' - ' + 'Slide ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
	}

	
	$("a.fancyimage").fancybox({ 
		'titleShow'     : false,
		'titlePosition' : 'inside'
	});
	
	$("a.fancyiframe").fancybox({			
			
			//options
			'type' : 'iframe',
			'hideOnOverlayClick' : false,
			'width' : '80%',
			'height' : '80%',
			'titlePosition' 		: 'inside',
			'titleFormat'		: formatTitle,
			'onClosed' : function() { $('a').eq(0).focus(); }   // Firefox mouse scroll wheel fix, without this, the mouse wheel stops working after the light box is closed
			
	});
	
	$("a.fancyiframe2").fancybox({			
			
			//options
			'type' : 'iframe',
			'hideOnOverlayClick' : false,
			'width' : 980,
			'height' : 500,
			'titlePosition' 		: 'inside',
			'titleFormat'		: formatTitle2,
			'onClosed' : function() { $('a').eq(0).focus(); }   // Firefox mouse scroll wheel fix, without this, the mouse wheel stops working after the light box is closed
			
	});
	
	$("a.fancycontact").fancybox({			
			
				//options
			'type' : 'iframe',
			/*'overlayColor' : '#66acc8',
			'overlayOpacity' : 0.8,*/
			'hideOnOverlayClick' : false,
			'titleShow' : false,
			'padding' : 0,
			'width' : 480,
			'height' : 654,			
			'onClosed' : function() { $('a').eq(0).focus(); }   // Firefox mouse scroll wheel fix, without this, the mouse wheel stops working after the light box is closed
			
		
	});
	
	$("a.fancyHelp").fancybox({			
			
			//options			
			'hideOnOverlayClick' : true,
			'overlayOpacity' : 0.3,
			'padding' : 20,
			'titleShow'     : false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'easingIn'      : 'easeOutBack',
			'easingOut'     : 'easeInBack'
				
	});
	
	
	$("a.fancyswf").fancybox({
		'type'				: 'swf',
	    'padding'           : 0,
        'autoScale'     	: true,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition'		: 'outside',
		'width'				: 640,
		'height'			: 480,
		'showNavArrows'		: false
		
	});


	
	$("a.fancyyoutube").click(function() {
	$.fancybox({
			'hideOnOverlayClick' : false,
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 480,
			'height'		: 385,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
	});
	
	// initialize coda sliders
	$('.coda-slider').codaSlider({
		dynamicArrows: false, 
		dynamicTabs: false,		      
        slideEaseDuration: 0,        
		autoHeight: true,
		autoHeightEaseDuration: 0
	}); 
	
	// find first element in each panel and set top margin to 0
	$('.panel-wrapper > :first-child').css('margin-top', '0px');
		
	$('.table_a tr:nth-child(odd)').css('background-color', '#eef7ff');	 // set alternating colors for table rows
	
	$('#content_center h1 + p').css('margin-top', '10px');
	$('#content_center h2 + p').css('margin-top', '5px');
	$('#content_center h1 + table').css('margin-top', '10px');
	$('#content_center h1 + ul').css('margin-top', '10px');
	$('#content_center img + h1').css('margin-top', '20px');		
	$('#content_center > :first-child').css('margin-top', '0px');   // find first element in each panel and set top margin to 0	
	
});
