jQuery(document).ready(function() {
 if(jQuery.cookie('opTInToCookie') != 2 ) { 
		jQuery("#cookieOptIn").show();
 } else {
	jQuery("#cookieOptIn").hide();
	loadGA();
 }
 $("#optIn").click(function() {
    $("#cookieOptIn").fadeTo("slow", 0.00, function(){
        $(this).slideUp("slow", function() { 
            jQuery(this).remove();
			jQuery.cookie('opTInToCookie',2,{path : '/', expires : 300 });  
		 	loadGA();
         });
     });
  });
function loadGA()
{
    if(typeof _gat == 'function')
    {
    	return;
    }
    var hostname = 'google-analytics.com';
    var protocol = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', protocol+hostname+'/ga.js');
    document.body.appendChild(js);
    loaded = false; 
    js.onreadystatechange = function () {
    	if (js.readyState == 'loaded') 
    	{ 
    		if(!loaded)
    		{
    			innitGA();
    		}
    		loaded = true;
    	}
    };
    js.onload = function () 
    {
    	if(!loaded)
    	{			
    		innitGA();
    	}
    	loaded = true;
    };
}
function innitGA()
{
    var pageTracker = _gat._createTracker('UA-10725850-1');
    pageTracker._initData();
    pageTracker._trackPageview();
    //alert('track!');
}
});
