YAHOO.namespace('gaia.app.Arena');
YAHOO.gaia.app.Arena.Unsetcookie = function() {
        
            this._settings = null;
            this._ajaxRequest= null;
};


YAHOO.gaia.app.Arena.Unsetcookie.prototype.init = function(settings){
        this._settings = {
                    href_prefix1: settings.href_prefix1,
                    ajax_url : "/arena/collection-set-cookie/",
                    ids: eval( settings.ids )
       };
       this._attach_handlers(); 
};

YAHOO.gaia.app.Arena.Unsetcookie.prototype._attach_handlers = function() {
     for (var i in this._settings.ids) {
         YAHOO.util.Event.addListener(YAHOO.util.Dom.get( this._settings.href_prefix1 + this._settings.ids[i] ), 'click', this._unset, this,true);
     }
}
YAHOO.gaia.app.Arena.Unsetcookie.prototype._unset = function(e, obj){
	YAHOO.util.Event.preventDefault(e);
    if(navigator.appName == 'Microsoft Internet Explorer')
    {
       href = window.event.srcElement.parentElement.href;
       if(  href == undefined ) href = window.event.srcElement; 
    }else{
       href = e.target.parentNode.href;
       if(  href == undefined ) href = e.target.href ; 
   }
   var callback = {
         success: function(o){
              location.href = o.responseText;
        },
		failure: function(o){
		},
		scope: this
	}
	var param = "referalPageURL=&redirectionLink="+escape(href);
	this._ajaxRequest =  YAHOO.util.Connect.asyncRequest('POST',this._settings.ajax_url, callback, param);
};
function initUnsetcookie(settings) {
  unsetcookieobj = new YAHOO.gaia.app.Arena.Unsetcookie();
  unsetcookieobj.init(settings);
}

