// JavaScript Document for:
// COLRUYT.FR
// created by Colruyt Group Services Belgium

function showFeaturesspeel(id){
if(id){ jQuery('.datsbox').each(function(){jQuery(this).hide();}); jQuery('#infospeel'+id).slideDown("normal"); }
};


	(function () {
		
				
			try {   
				_gaq = _gaq || [];
				_gaq.push(['_setAccount', 'UA-12072168-1']);
				_gaq.push(['_trackPageview']);
  
				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';
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  
	  $(document).ready(function(){	
	  		//IE6 DETECTION
	  		var _MSIE6 = (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<8) ? true : false;

			if (_MSIE6 === true){
				jQuery("body").append('<div id="overlayIE6Notification" class="overlay"></div>');
				jQuery("#overlayIE6Notification").load("ie6fr.html").css({'display':'block','position':'absolute','top':'100px','left':'25%'});
			}
	  	
	  	
	  		// Google Analytics fix 
			$("#breadCrumb #social .addthis_toolbox a").click(function(){
				var xx = $(this).attr('class');
		
				_gaq.push(['_trackEvent', 'Social Media', 'Social_Clicks', xx]);
						
				var filetypes = /\.doc$|\.xls$|\.exe$|\.zip$|\.pdf$|\.mp3$|\.psd$/i;
				jQuery("a").each(function(){
					var hrefa, url1, url2, pathname;
					if((hrefa = jQuery(this).attr("href"))){
					if (hrefa.match(/^mailto\:/i)) {
						url1 = jQuery(this).attr("href").replace(/^mailto\:/i, "");
						pathname = window.location.pathname;
						url2 = pathname.replace(/^http\:\/\/(www\.)*/i, "");
						jQuery(this).click(function () {
						_gaq.push(['_trackEvent', url2, 'Email', url1]);
					});
				} else if (location.host != this.host.replace(/\:80$/i, "")) {
					url1 = hrefa.replace(/^http\:\/\/(www\.)*/i, "");
					pathname = window.location.pathname;
					url2 = pathname.replace(/^http\:\/\/(www\.)*/i, "");
					jQuery(this).click(function () {
						_gaq.push(['_trackEvent', url2, 'Outgoing link', url1]);
					});
				} else if (hrefa.match(filetypes)) {
					url1 = hrefa.replace(/^(http\:\/\/)*(www\.)*(colruyt\.fr")*\//i, "");
					pathname = window.location.pathname;
					url2 = pathname.replace(/^http\:\/\/(www\.)*/i, "");
					jQuery(this).click(function () {
						_gaq.push(['_trackEvent', url2, 'Download', url1]);
					});
				}
			}
		});
		
	});
	/*
				$("#fbLink").click(function(){
					_gaq.push(['_trackEvent', 'Social Media', 'Facebook', 'Facebook Button Share']);
				});
				
				$("#twitLink").click(function(){
					_gaq.push(['_trackEvent', 'Social Media', 'Twitter', 'Twitter Button Share']);
				});
	*/
				
				$(".recommend").contents().find(".connect_widget_like_button").click(function(){
					_gaq.push(['_trackEvent', 'Social Media', 'Facebook', 'Facebook Button Recommend']);
				});
				
		});
				
			} catch(err) {}
								
		
	})();
	
	$(".doHoverForCS").hover(
									   function(){
										   $("#menu .collishopMenu").css({"background":"url(assets/menu_back_nav_blue.jpg) right center repeat-x"});
										   },
										   function(){
											   $("#menu .collishopMenu").css({"background":"url(assets/menu_back_nav_0.jpg) right center repeat-x"});
											   });
/*********************/
/** GAnalytics plug **/
/*********************/
jQuery.fn.GAnalytics = function(){
	if(window._gaq) {		
	jQuery(this).bind("click",function(){
		try {
			var gatrack = jQuery(this).attr('data-gatrack');
			gatrack = gatrack.split('-');
			
			
			// "homepageCulinairNL","right","weekmenu" example.
			// <data-ganame>, <data-gapos>,<data-gatopic>

			// Push it to analytics
			_gaq.push(['_trackEvent', gatrack[0], gatrack[1], gatrack[2]]);
			
		} catch(e){
			
			// Something went wrong?
			
		}
		
	});
	}

};
