function googleTranslateElementInit() {
  new google.translate.TranslateElement({
	pageLanguage: 'en'
  }, 'google_translate_element');
}	

$(document).ready(function(){
	// reveal addthis if exists
	if ($('.addthis_toolbox').length != 0) {	
		if($('#show-add-this').length != 0) {
			$('.addthis_toolbox').show();
		}
	}	
});

$(function() {
	
	if (document.getElementById("translate-to")) { 
		gTranslateWait();		
	} 
	
});

function gTranslateWait() {
	if ($('.goog-te-combo').length == 0) { 
		window.setTimeout(gTranslateWait, 100);
	} else {
		gTranslateFix();
	}
} //end gTranslateWait
					
function gTranslateFix() {
	
		$('.goog-te-gadget')
			.append('Google Translate <div id="revert-to-original"><a href="http://labor.ny.gov/home/messages/translation-disclaimer.page">disclaimer</a></div>')
			.css("cssText", "color: #6491B0 !important");
	
/*			$('#revert-to-original a').click(function(){
				$('#translate-to').hide();

				var thisURL = window.location.href.toString();
				//Remove anchor from url
				var anchor_index = thisURL.indexOf('#');
				if (anchor_index != -1) {
					thisURL = thisURL.substring(0, anchor_index);
				}

				// refresh page
				window.location.href = thisURL;
			});	*/
			
} //end gTranslateFix

// GOOGLE ANALYTICS

 var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11036518-3']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();

