
// remap jQuery to $
(function($){

 





 



})(this.jQuery);



// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};



// catch all document.write() calls
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);

// Toggle Dropdown Content

$(document).ready(function(){

	//Set default open/close settings
	$('.acc_container').hide(); //Hide/close all containers
	//$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
	
	//On Click
	$('.acc_trigger').click(function(){
		if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
			$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
		}
		return false; //Prevent the browser jump to the link anchor
	});

});

// Search

$("#keywords")
    .val("SEARCH")
    .css("color", "#b9b9b9")
    .focus(function(){
        $(this).css("color", "#666");
        if ($(this).val() == "SEARCH") {
            $(this).val("");
        }
    })
    .blur(function(){
        $(this).css("color", "#b9b9b9");
        if ($(this).val() == "") {
            $(this).val("SEARCH");
        }
    });
    
// Supersized

$(function(){
	$.fn.supersized.options = {  
		startwidth: 1500,  
		startheight: 1000,
		vertical_center: 0,
		slideshow: 0,
		navigation: 0,
		thumbnail_navigation: 0,
		transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
		pause_hover: 0,
		slide_counter: 0,
		slide_captions: 0
	}
	var pathArray = window.location.pathname.split('/');
	if(pathArray[1] == "") {
		$.fn.supersized.options = {
			startwidth: 1500,  
			startheight: 1000,
			vertical_center: 0,
			slideshow: 1,
			navigation: 0,
			thumbnail_navigation: 0,
			transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
			pause_hover: 0,
			slide_counter: 0,
			slide_captions: 0,
			slide_interval: 6000,
			slides : [
				{image : 'http://www.amsafety.bm/site_images/home_bg.jpg', url : 'http://www.amsafety.bm/site_images/home_bg.jpg'}]
		}
	};
	
	if(pathArray[1] != "") {
		$.fn.supersized.options = {  
			slides : [{image : 'http://www.amsafety.bm/site_images/inside_bg.jpg', url : 'http://www.amsafety.bm/site_images/inside_bg.jpg'}]
		}
	};
	
    $('#supersized').supersized(); 
});


// Form Validation

$(document).ready(function(){
  $("#contactForm").validate();
});




//
// This is where validation rules are assigned:
//
/*         
$(function() { 
                
	$("form").validity(function() {
                    
		$("#name")
			.require();
			
		$("#address")
			.require();
			
		$("#city")
			.require();
			
		$("#state")
			.require();
			
		$("#zip")
			.require()
			.match('zip');
			
		$("#phone")
			.require()
			.match('phone');
			
		$("#email")
			.require()
			.match('email');
			
		$("#comment")
			.require();
                            
	});
                    
});
*/             
//
// That's it!
// No more setup is necessary!
//


// Corporate Structure Chart

$('#quoteTop').hide();
$('#quoteLeft1').hide();
$('#quoteLeft2').hide();
$('#quoteLeft3').hide();
$('#quoteLeft4').hide();
$('#quoteLeft5').hide();
$('#quoteLeft6').hide();
$('#quoteLeft7').hide();
$('#quoteLeft8').hide();
$('#quoteRight1').hide();
$('#quoteRight2').hide();
$('#quoteRight3').hide();

$('#chartTop').mouseover(function() {
	$('#quoteTop').fadeIn(250);
});

$('#chartTop').mouseout(function() {
	$('#quoteTop').fadeOut(250);
});

	
$('#left1').mouseover(function() {
	$('#quoteLeft1').fadeIn(250);
});

$('#left1').mouseout(function() {
	$('#quoteLeft1').fadeOut(250);
});


$('#left2').mouseover(function() {
	$('#quoteLeft2').fadeIn(250);
});

$('#left2').mouseout(function() {
	$('#quoteLeft2').fadeOut(250);
});


$('#left3').mouseover(function() {
	$('#quoteLeft3').fadeIn(250);
});

$('#left3').mouseout(function() {
	$('#quoteLeft3').fadeOut(250);
});


$('#left4').mouseover(function() {
	$('#quoteLeft4').fadeIn(250);
});

$('#left4').mouseout(function() {
	$('#quoteLeft4').fadeOut(250);
});


$('#left5').mouseover(function() {
	$('#quoteLeft5').fadeIn(250);
});

$('#left5').mouseout(function() {
	$('#quoteLeft5').fadeOut(250);
});


$('#left6').mouseover(function() {
	$('#quoteLeft6').fadeIn(250);
});

$('#left6').mouseout(function() {
	$('#quoteLeft6').fadeOut(250);
});


$('#left7').mouseover(function() {
	$('#quoteLeft7').fadeIn(250);
});

$('#left7').mouseout(function() {
	$('#quoteLeft7').fadeOut(250);
});


$('#left8').mouseover(function() {
	$('#quoteLeft8').fadeIn(250);
});

$('#left8').mouseout(function() {
	$('#quoteLeft8').fadeOut(250);
});


$('#right1').mouseover(function() {
	$('#quoteRight1').fadeIn(250);
});

$('#right1').mouseout(function() {
	$('#quoteRight1').fadeOut(250);
});


$('#right2').mouseover(function() {
	$('#quoteRight2').fadeIn(250);
});

$('#right2').mouseout(function() {
	$('#quoteRight2').fadeOut(250);
});


$('#right3').mouseover(function() {
	$('#quoteRight3').fadeIn(250);
});

$('#right3').mouseout(function() {
	$('#quoteRight3').fadeOut(250);
});


// Mission Chart

$('#communicationQuote').hide();
$('#integrityQuote').hide();
$('#responsivenessQuote').hide();
$('#commitmentQuote').hide();
$('#loyaltyQuote').hide();
$('#excellenceQuote').hide();

$('#communicationLink').mouseover(function() {
	$('#communicationQuote').fadeIn(250);
});

$('#communicationLink').mouseout(function() {
	$('#communicationQuote').fadeOut(250);
});

	
$('#integrityLink').mouseover(function() {
	$('#integrityQuote').fadeIn(250);
});

$('#integrityLink').mouseout(function() {
	$('#integrityQuote').fadeOut(250);
});


$('#responsivenessLink').mouseover(function() {
	$('#responsivenessQuote').fadeIn(250);
});

$('#responsivenessLink').mouseout(function() {
	$('#responsivenessQuote').fadeOut(250);
});


$('#commitmentLink').mouseover(function() {
	$('#commitmentQuote').fadeIn(250);
});

$('#commitmentLink').mouseout(function() {
	$('#commitmentQuote').fadeOut(250);
});


$('#loyaltyLink').mouseover(function() {
	$('#loyaltyQuote').fadeIn(250);
});

$('#loyaltyLink').mouseout(function() {
	$('#loyaltyQuote').fadeOut(250);
});


$('#excellenceLink').mouseover(function() {
	$('#excellenceQuote').fadeIn(250);
});

$('#excellenceLink').mouseout(function() {
	$('#excellenceQuote').fadeOut(250);
});
