// JavaScript Document
// Google Event Tracking Script
jQuery(function () {
	 jQuery('a').click(function () {
		// tell analytics to save event
		try {
			_gaq.push(['_trackEvent', thisel.parents('[id!=""]:first').get(0).id, 'clicked', (thisel.text() || thisel.children('img:first').attr('alt'))]);
		}
		catch (err) {}
		// pause to allow google script to run
		var date = new Date();
		var curDate = null;
		do {
			curDate = new Date();
		} while(curDate-date < 300);
	});
});

jQuery(document).ready(function() {
	jQuery('#pg-locations.page-child .entry p a:children(img)').css({display: 'inline'}).addClass('thickbox').attr('rel', 'thickbox[slideshow]');
    jQuery('').addClass('thickbox')
    // add google event tracking to submit buttons
    
    var formstatus = jQuery('<div class="formstatus"></div>');
    //jQuery('form.wpcf7').prepend(formstatus);
    jQuery('input.wpcf7-submit').submit(function() {
            try { 
                jQuery('.formstatus').append(jQuery('.wpcf7-response-output'));
                
            }                   
            catch(err) {  }
    })	
    jQuery('form').bind('success', function() {
        try {
            console.log('success!')
        } catch(err) {/* Silence is golden */ }
    });
    jQuery('#header-mkt-newsletter a').addLightBoxTrigger();						
});


jQuery.fn.addLightBoxTrigger = function() {
    if (jQuery(this).attr('href') != '') { // determine if it is a valid link
        if (jQuery(this).attr('rel') != '') { 
            return jQuery(this).addClass('thickbox').attr('rel', 'lightbox');
        } else { return false; }
    } else { return false; }
}
