//set this to name of your flash object/embed
var cookie_id  = 'CBCookie';

var CB_Cookie =
{
	init: function(cookie_id)
	{
		this.cookie_id  		= cookie_id;
		this.flash_cookie_ready = false;
		this.flash_cookie_able  = false;
		this.flash_cookie  		= null;
		this.flash_alert  		= false;

		this.flash_is_ready();
	},

	flash_is_ready: function()
	{
		if(!document.getElementById || !document.getElementById(this.cookie_id)) return;
		if(!this.get_movie(this.cookie_id)) return;

		this.flash_cookie_ready = true;
		this.flash_cookie_able  = this.flash_cookie.f_cookie_able();
	},


	is_able: function()
	{
		if(!this.flash_alert && !(this.flash_cookie_ready && this.flash_cookie_able))
		{
			//alert("CB_Cookie not initialized correctly.");
			//this.flash_alert = true;
			return false;
		}
		return (this.flash_cookie_ready && this.flash_cookie_able);
	},

	del: function(key)
	{
		if(!this.is_able()) return;
		this.flash_cookie.f_delete_cookie(key);
	},

	get: function(key)
	{
		if(!this.is_able()) return;
		var ret = this.flash_cookie.f_get_cookie(key);
		return ((ret == 'null') ? '' : ret);
	},

	set: function(key,val)
	{
		if(!this.is_able()) return;
		this.flash_cookie.f_set_cookie(key,val);
	},

	get_movie: function()
	{
    	if (navigator.appName.indexOf("Microsoft") != -1)
    	{
    		this.flash_cookie = window[this.cookie_id];
    	}
    	else
    	{
    		this.flash_cookie =  document[this.cookie_id];
    	}

    	return ((this.flash_cookie) ? true : false);
	}

};

function flash_ready()
{
	CB_Cookie.init(cookie_id);
	if (yscbkey2) {		
		CB_Cookie.set('yscbkey2', yscbkey2);
	}
}

function submit_donation(box_id) {
	dkey1=CB_Cookie.get('yscbkey1');	
	dkey2=CB_Cookie.get('yscbkey2');	
	key1_obj=document.getElementById("yscbkey1_id");
	key2_obj=document.getElementById("yscbkey2_id");
	boxid_obj=document.getElementById("boxid_id");
	if (!key1_obj || !key2_obj || !boxid_obj) return;
	
	key1_obj.value=dkey1;
	key2_obj.value=dkey2;
	boxid_obj.value=box_id;
	key1_obj.form.submit();
}
