//Temporarily hide the container div for the Flash
var dc = document;
dc.write('<s' + 'tyl'+ 'e media="screen">#main_flash {d' + 'isp' + 'lay:n' + 'one;}</style>');

//Temporarily hide flash data for non Flash 8 users till they download flash
dc.write('<s' + 'tyl'+ 'e media="screen">#homepage_flash_content {d' + 'isp' + 'lay:n' + 'one;}</style>');

//Look for Safari Browser
 var isSafari = "";
 navigator.userAgent.indexOf("Safari")>= 0 ? isSafari = true : isSafari = false; 
  
if(!cleanMLC) { 
    var cleanMLC = ""; 
}

/* homepage session cookie code */
function setSessionCookie(val){
    document.cookie="saw_car_intro="+val;
}

function getSessionCookie(){
    var beginindex;
    var endindex;
    var result;

    beginindex=document.cookie.indexOf("saw_car_intro")+14;

    endindex=beginindex;

    while (document.cookie.charAt(endindex)!=";"&& endindex<=document.cookie.length){
        endindex++
    }

    var result=document.cookie.substring(beginindex,endindex);
    return result;
}

function setIntroCookie(){
    setSessionCookie('intro_played');
}

function introCookieExists(){
    var introCookieReturnValue = getSessionCookie();
    var introCookieOutput = '0';
    
    if(introCookieReturnValue == 'intro_played'){
        introCookieOutput = '1';
    }
    
    return introCookieOutput;
}
/* end homepage session cookie code */

//Global site config values
//alert('coooookie'+introCookieExists());
var site_config = {
    'host':location.host,
	'src':location.href,
	'title':document.title,
	'mlc':cleanMLC,
   	'brand':'geeksquad',
    'brand_name':'Geek Squad',
    'brand_domain':'www.geeksquad.com',
    'isSafari':isSafari,
    'EOF':'EOF',
    'id' :'rich-media-header',
    'name': 'rich-media-header',
    'intro_cookie': introCookieExists()
};

// Build the Flash variables string from site config settings available.
function build_flash_vars() {
	var flash_vars = '';
	for(k in site_config) {
		if (k != "toJSONString") {
    		flash_vars += "&" + k + "=" + encodeURIComponent(site_config[k]);
		}
	}
	flash_vars_built(flash_vars);
	var render_foo = document.getElementById("main_flash");
	render_foo.style.display = 'block';
}