var resizeTimer = null;
$(document).ready(function(){
	$(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(setFlashPos, 100);		
	});
		
	var cook = readCookie('ccmb_video');
	var so = new SWFObject("images/ccmb-live.swf", "ccmb_live", "158", "245","9","#FFFFFF");
	
	if (cook && cook=='video_ccmb'){
		so.addVariable("noplay","yes");
	} else {
		createCookie('ccmb_video','video_ccmb',3);		
	}
	
	so.addParam("wmode", "transparent");  
	so.addParam("bgcolor", "#FFFFFF");
    so.write("flashdiv");
	setFlashPos();
});

function setFlashPos() {
	ofs = $('#options_container').offset();
	topofs = 83;
	if ($.browser.msie) topofs+=2;
	$('#flashdiv').css({'top': (ofs.top+topofs)+"px", 'left': ((ofs.left)-158)+"px"}).show();
};

function createCookie(name,value,hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}



