/*
 * common code to check for toolbar and relevant info
 *
 * As of version 2.2, we include support for detecting Facebook toolbars.
 *
 * bInstalled = Any of the MyWebSearch, XPI or Vicinio toolbars are installed
 * bMWSInstalled = The MyWebSearch Toolbar is installed
 * bXPIInstalled = The Firefox XPI Toolbar is installed
 * bVicinioInstalled = The Vicinio Toolbar is installed
 */

var TOOLBAR = {
	bInstalled: false,
	oActiveXCtl: null,
	sVersion: null,
	sUID: null,
	sPartnerID: null,
	sParentPartnerID: null,
	sChildPartnerID: null,
	sBucket: "",
	sPartnerSource: "",
	sHtmlMenuCtlId: null,
	iToolbarType: -1,
	sLatestVersion: "",
	bLatestVersion: false,
	bUpgradeRequired: false, // why was this true by default?
	bScreenSaverCtl: false,
	oScreenSaverInstaller: null,
	bToolbarErrorCaught: false,

	// debugging enabled/disabled
	debug_enabled: false,
    // code version for this object
    code_version: "2.0.2",

	//-- should not be using xpi specific vars anymore
	bXPIInstalled: false,
	bXPIErrorCaught: false,
	sXPIVersion: null,
	sXPILatestVersion: "",
	bXPILatestVersion: false,
	bXPIUpgradeRequired: false,

	//Specific toolbar installed booleans
	bMWSInstalled: false,
	bVicinioInstalled: false,

	// controller objects after instantiation
	oSettingsCtl: null,
	oHtmlMenuCtl: null,
    oScreenSaverCtl: null,
    oDataCtl: null,
    oChatCtl: null,

	xpi_interval: null,
	xpi_event: {
		TBCkElem: null,
		TBCkEvt: null
	},

	browser: {
		name: "",
		major_version: 0
	},

	toolbar_list: [
        'mws.settingsCtl',
        'mws.xpi',
        'vicinio.settingsCtl'
    ],
    facebook_toolbar_list: [
        'facebook_iwon_msie.settingsCtl',
        'facebook_retrogamer_msie.settingsCtl',
        'facebook_mfc_msie.settingsCtl',
        'facebook_webfetti_msie.settingsCtl',
        'facebook_iwonglobal_msie.settingsCtl',
        'facebook_mywebface_msie.settingsCtl',
        'facebook_kazulah_msie.settingsCtl',
        'facebook_girlsense_msie.settingsCtl',
        'facebook_zwinky_msie.settingsCtl',
        'facebook_pss_msie.settingsCtl',
        'facebook_cursormania_msie.settingsCtl',
        'facebook_smileycentral_msie.settingsCtl',
        'facebook_smileycreator_msie.settingsCtl',
        'facebook_iwon_firefox.settingsCtl',
        'facebook_retrogamer_firefox.settingsCtl',
        'facebook_mfc_firefox.settingsCtl',
        'facebook_webfetti_firefox.settingsCtl',
        'facebook_iwonglobal_firefox.settingsCtl',
        'facebook_mywebface_firefox.settingsCtl',
        'facebook_kazulah_firefox.settingsCtl',
        'facebook_girlsense_firefox.settingsCtl',
        'facebook_zwinky_firefox.settingsCtl',
        'facebook_pss_firefox.settingsCtl',
        'facebook_cursormania_firefox.settingsCtl',
        'facebook_smileycentral_firefox.settingsCtl',
        'facebook_smileycreator_firefox.settingsCtl'
    ],

	toolbar_test: true,

	//Keith, is this a good idea?
	toolbar_detectAll: false,

	cookie: {
		config: {
			name: "tsox_data",
			data: null
		}
	},

	winner: {},

	init: function( _opts )
	{
		this.get_browser();
		if ( _opts != undefined && _opts != null ){
            // If a custom toolbar list is provided, use it.
			if ( _opts.tb_list != undefined && _opts.tb_list != null ){
				this.toolbar_list = _opts.tb_list;
			}
            // If some products are listed as preferred, then they stand a
            // better chance of becoming the winner.
            if (_opts.preferred_products) {
                // Translate products to toolbars.
                var preferred_tb_list = [];
                for (var k = 0; k < _opts.preferred_products.length; k++) {
                    var preferred_product = _opts.preferred_products[k];
                    var preferred_tb = this._asControlName(preferred_product);
                    preferred_tb_list.push(preferred_tb);
                }

                this.toolbar_list = preferred_tb_list.concat(this.toolbar_list);
            }
            // If a custom toolbar test is provided, use it.
			if ( _opts.find != undefined && _opts.find != null && _opts.find != "" ){
				this.toolbar_test = _opts.find;
			}
			if ( _opts.detectAll != undefined && _opts.detectAll != null && _opts.detectAll != "" ){
				this.toolbar_detectAll = _opts.detectAll;
			}
		}
		// this.DEBUG("init: this.toolbar_list = " + this.toolbar_list);
		if ( this.toolbar_test ){ this.find_toolbar(); }
		if ( this.toolbar_detectAll ){ this.detect_toolbars(); }
	},

    isProductToolbarInstalled: function(productName) {
        var control = this._asControl(productName);
        return this.tb_exists(control);
    },

    isProductToolbarInstallable: function(productName, channel) {
        return productName == channel || productName.indexOf(channel + '.') == 0;
    },

    _normalizeProductName: function(productName) {
        var k = productName.length - '.current'.length;
        if (productName.indexOf('.current') == k) {
            productName = productName.substring(0, 1 + k) + this.browser.name;
        }
        return productName;
    },

    _asControlName: function(productName) {
        productName = this._normalizeProductName(productName);

        var object = this.get_toolbar_from_master(productName);
        if (!object.ctl) {
            throw 'Misconfigured product: ' + productName
                + '; must include main control name "ctl".';
        }
        var controlName = productName + '.' + object.ctl;
        return controlName;
    },

    _asControl: function(productName) {
        productName = this._normalizeProductName(productName);

        var object = this.get_toolbar_from_master(productName);
        if (!object.ctl) {
            throw 'Misconfigured product: ' + productName
                + '; must include main control name "ctl".';
        }
        return object[object.ctl];
    },

	find_toolbar: function()
	{
		// loop through toolbar_list, stop on first match
		for ( var idx=0; idx < this.toolbar_list.length; idx++ ){
			var oTb = this.get_toolbar_from_master( this.toolbar_list[idx] );
            var currentBrowserEnabled = !oTb.browser || oTb.browser == this.browser.name;
			if ( currentBrowserEnabled && this.tb_exists( oTb ) ){
				this.winner = oTb;
				this.bInstalled = true;
				return;
			}
		}
	},

	detect_toolbars: function()
	{
		// loop through toolbar_list, simply set toolbar installed booleans.  Do not pick a winner.  Leave that up to find_toolbar()
		for ( var idx=0; idx < this.toolbar_list.length; idx++ ){
			var oTb = this.get_toolbar_from_master( this.toolbar_list[idx] );
            var currentBrowserEnabled = !oTb.browser || oTb.browser == this.browser.name;
			if ( currentBrowserEnabled && this.tb_exists( oTb ) ){
				//this.winner = oTb;
				this.bInstalled = true;
				//Keith, I need some magic here... obviously this won't work.
				if (oTb == "mws") this.bMWSInstalled = true;
				else if (oTb == "xpi") this.bXPIInstalled = true;
				else if (oTb == "vicinio") this.bVicinioInstalled = true;
			}
		}
	},

	find_html_menu_ctl: function()
	{
		// this.DEBUG("find_html_menu_ctl: this.winner.toolbar = " + this.winner.toolbar);
		// this.DEBUG("find_html_menu_ctl: this.winner.xpi = " + this.winner.xpi);
		if ( this.winner.toolbar == null || this.winner.toolbar == undefined || this.winner.toolbar == "" ){
			return;
		}
		var oTb = this.get_toolbar_from_master( this.winner.toolbar + ".htmlMenuCtl" );
		this.get_toolbar_data( oTb );
	},

	get_toolbar_data: function( _ctl )
	{
		// this.DEBUG("get_toolbar_data: _ctl.xpi = " + _ctl.xpi);
		// this.DEBUG("get_toolbar_data: this.cookie.config.data = " + this.cookie.config.data);
		if ( _ctl.xpi && this.cookie.config.data == null ){
			// this.DEBUG("get_toolbar_data: xpi is true, coookie data is null");
			GetXpiConfig( this );
		} else if ( _ctl.xpi && this.cookie.config.data != null ){
			// this.DEBUG("get_toolbar_data: xpi is true, coookie data is NOT null");
			this.set_xpi_data();
		} else if ( _ctl.exe ){
			// this.DEBUG("get_toolbar_data: xpi is false, exe is true");
			// instantiate the control we want to use
			this.instantiate( _ctl );
		}
	},

	version_check: function( _ctl )
	{
		// this.DEBUG("version_check: _ctl.name = " + _ctl.name);
		// this.DEBUG("version_check: this.bInstalled = " + this.bInstalled);
		if ( this.bInstalled ){
			var versionCheck = this.check_versions( this.sVersion, _ctl.max_version, _ctl.required_version );
			this.bLatestVersion = versionCheck.latest;
			this.bUpgradeRequired = versionCheck.upgrade;
			if( this.bXPIInstalled ){
				this.bXPILatestVersion = this.bLatestVersion;
				this.bXPIUpgradeRequired = this.bUpgradeRequired;
			}
		}
	},

	set_xpi_data: function( _props )
	{
		if ( this.cookie.config.data != null ){
			// this.DEBUG("set_xpi_data: cookie data is NOT null");
			try {
				// this.DEBUG("set_xpi_data: this.cookie.config.data.gu = " + this.cookie.config.data.gu);
				this.sVersion = this.cookie.config.data.ver;
				this.sUID = this.cookie.config.data.gu;
				this.sPartnerID = this.cookie.config.data.cb;
				this.sBucket = this.cookie.config.data.trk;
				var partner = this.parse_partner( this.sPartnerID );

				this.sParentPartnerID = partner.parentid;
				this.sChildPartnerID = partner.childid;
				this.sBucket = partner.bucket;
				this.sPartnerSource = partner.source;
			} catch(Err){
				// this.DEBUG("set_xpi_data: woops! " + Err);
				this.bXPIErrorCaught = true;
			}
		} else {
			try {
				this.sUID = document.getElementsByTagName("TSOX_TBCk")[0].getAttribute("tbid");
				this.sPartnerID = document.getElementsByTagName("TSOX_TBCk")[0].getAttribute("cbid");
				this.sBucket = document.getElementsByTagName("TSOX_TBCk")[0].getAttribute("trkid");
				var partner = this.parse_partner( this.sPartnerID );

				this.sParentPartnerID = partner.parentid;
				this.sChildPartnerID = partner.childid;
				this.sBucket = partner.bucket;
				this.sPartnerSource = partner.source;
			} catch(Err){
				// this.DEBUG("set_xpi_data: woops! " + Err);
				this.bXPIErrorCaught = true;
			}
		}
	},

	get_settingsCtl_data: function()
	{
		try {
			this.sUID = this.oSettingsCtl.I;
			this.sPartnerID = this.oSettingsCtl.P;
			this.sVersion = this.oSettingsCtl.GetVersion('');
			var partner = this.parse_partner( this.sPartnerID );

			this.sParentPartnerID = partner.parentid;
			this.sChildPartnerID = partner.childid;
			this.sBucket = partner.bucket;
			this.sPartnerSource = partner.source;
			this.iToolbarType = this.oSettingsCtl.Type;
			// oToolbarController.iToolbarType = oToolbarController.oActiveXCtl.Type;
		} catch(Err){
			this.bToolbarErrorCaught=true;
		}
	},

	get_htmlCtl_data: function()
	{
        this.DEBUG("get_htmlCtl_data: this.oHtmlMenuCtl  = " + this.oHtmlMenuCtl );
		this.sHtmlMenuCtlId = this.oHtmlMenuCtl.GetUID('http://www.funwebproducts.com/');
		// this.DEBUG("get_htmlCtl_data: this.sHtmlMenuCtlId  = " + this.sHtmlMenuCtlId );
		// this.DEBUG("get_htmlCtl_data: this.winner.classid  = " + this.winner.classid );
		// this.DEBUG("get_htmlCtl_data: winner = " + this.winner.toolbar + "." + this.winner.name );
	},

	parse_partner: function( _partnerid )
	{
		var parentid = null;
		var childid = null;
		var bucket = null;
		var source = null;
		if ( _partnerid.indexOf("_") > -1 ){
			var parts = _partnerid.split("_");
			parentid = parts[1];
			childid = parts[0];
		} else {
			parentid = _partnerid;
		}
		bucket = ( parentid.length >= 10 ) ? parentid.substr(8,2) : null ;
		source = ( parentid.length >= 10 ) ? parentid.substr(2,6) : null ;
		return {
			parentid: parentid,
			childid: childid,
			bucket: bucket,
			source: source
		};
		//this.sParentPartnerID = parentid;
		//this.sBucket = ( bucket ) ? bucket : "" ;
	},

	instantiate: function( _props )
	{
		// switch
		switch ( _props.name ){
			case 'settingsCtl':
				this._instantiate_Ctl( _props );
				// this.DEBUG("instantiate: [settingsCtl] _props.html_id = " + _props.html_id);
				// this.DEBUG("instantiate: [settingsCtl] document.getElementById( _props.html_id ) = " + document.getElementById( _props.html_id ));
				this.oSettingsCtl = document.getElementById( _props.html_id );
				this.get_settingsCtl_data();
				this.check_update_flag();
				// this.DEBUG( "[TOOLBAR::instantiate] check for if FF and tb version < 2.3.50.21");
				// check for if FF and tb version < 2.3.50.21
				this.require_update(
					{
						require_firefox: true,
						required_version: "2.3.50.21",
						redirect_url: "http://help.mywebsearch.com/upgrade_now.jsp?p=" + this.sPartnerID + "&url=" + escape(document.location.href)
					}
				);
				// this.DEBUG( "[TOOLBAR::instantiate] after require_update");
				break;
			case 'htmlMenuCtl':
				this._instantiate_Ctl( _props );
				// this.DEBUG("instantiate: [htmlMenuCtl] _props.html_id = " + _props.html_id);
				// this.DEBUG("instantiate: [htmlMenuCtl] document.getElementById( _props.html_id ) = " + document.getElementById( _props.html_id ));
				this.oHtmlMenuCtl = document.getElementById( _props.html_id );
				this.get_htmlCtl_data( _props );
				break;
		}
	},

	_instantiate_Ctl: function( _props )
	{
		try {
			if ( window.ActiveXObject ){
				new ActiveXObject( _props.activeX_object );
				//var object_tag = "<object id=\""+_props.html_id+"\" classid=\"clsid:"+_props.classid+"\" width=1 height=1>&nbsp;</object>";
				var object_tag = this.get_tag_html( { tagname:"object", attribs: _props } );
				// this.DEBUG("_instantiate_Ctl: object_tag = " + object_tag);
				document.write(object_tag);
				//this.bInstalled = true;
			} else if ( this.plugin_exists( _props.mimetype ) ){
				/*
				var embed_tag = "<embed id=\""+_props.html_id+"\"" +
								" type=\""+_props.mimetype+"\"" +
								" ProgId=\""+_props.prog_id+"\"" +
								" width=2 height=2>&nbsp;</embed>";
				*/
				var embed_tag = this.get_tag_html( { tagname:"embed", attribs: _props } );
				document.write(embed_tag);
				//this.bInstalled = true;
			}
		} catch(Err){
			this.bToolbarErrorCaught=true;
		}
	},

	get_tag_html: function( _props )
	{
		if ( _props.tagname == undefined || _props.tagname == "" || _props.tagname == null ){ _props.tagname = "object"; }
		var html = "";
		if ( _props.tagname == 'embed' ){
			html = this._get_embed_tag_html( _props.attribs );
		} else {
			html = this._get_object_tag_html( _props.attribs );
		}
		return html;
	},

	_get_object_tag_html: function( _props )
	{
		var tag_html = "<object id=\""+_props.html_id+"\"" +
						" classid=\"clsid:"+_props.classid+"\"" +
                " width=1 height=1>";
        var params_html = "";
        if ( _props.params ){
            for ( var key in _props.params ){
                this.DEBUG("_get_object_tag_html: "+key+" = " + _props.params[key]);
                params_html += "<param name=\""+key+"\" value=\""+_props.params[key]+"\" />";
            }
            this.DEBUG("_get_object_tag_html: params_html = " + params_html);
            tag_html += params_html;
        }
        tag_html += "&nbsp;</object>";
		return tag_html;
	},

	_get_embed_tag_html: function( _props )
	{
		var tag_html = "<embed id=\""+_props.html_id+"\"" +
						" type=\""+_props.mimetype+"\"" +
						" ProgId=\""+_props.prog_id+"\"" +
                        " width=2 height=2";
        var params_html = "";
        if ( _props.params ){
            for ( var key in _props.params ){
                this.DEBUG("_get_embed_tag_html: "+key+" = " + _props.params[key]);
                params_html += " param_" + key + "=\"" + _props.params[key] + "\"";
            }
            this.DEBUG("_get_embed_tag_html: params_html = " + params_html);
            tag_html += params_html;
        }
        tag_html += ">&nbsp;</embed>";
		return tag_html;
	},

    get_toolbar_from_master: function( _key )
    {
        var parts = _key.split('.');
        //this.DEBUG("get_toolbar_from_master: _key = " + _key);
        //this.DEBUG("get_toolbar_from_master: parts = " + parts);
        //this.DEBUG("get_toolbar_from_master: parts[0] = " + parts[0]);
        //this.DEBUG("get_toolbar_from_master: parts[1] = " + parts[1]);

        var object = this.master_list;
        for (var k = 0; k < parts.length; k++) {
            var part = parts[k];
            object = object[part];
            if (typeof (object) == 'undefined') {
                throw 'Invalid master list key: ' + _key + '.';
            }
        }

        return object;
    },

	tb_exists: function( _props )
	{
        if (_props.tested) {
            return _props.installed;
        }

		// this.DEBUG("tb_exists: is it exe/xpi = " + _props.exe + "/" + _props.xpi);
		if ( _props.exe ){
			var bExe = this._exe_exists( _props );
			// this.DEBUG("tb_exists: bExe = " + bExe);
            _props.tested = true;
            _props.installed = bExe;
			return bExe;
		} else if ( _props.xpi ){
			var bXpi = this._xpi_exists( _props );
            _props.tested = true;
            _props.installed = bXpi;
			return bXpi;
		}
	},

	_exe_exists: function( _props )
	{
		try {
			if (window.ActiveXObject) {
				new ActiveXObject( _props.activeX_object );
				return true;
			} else {
				if ( this.plugin_exists( _props.mimetype ) ){
					return true;
				}
			}
		} catch(Err){
			// this.DEBUG("_exe_exists: Err = " + Err);
		}
		return false;
	},

	_xpi_exists: function( _props )
	{
		if ( this.browser.name == "firefox" ){
			var tsox_el = document.getElementById('tsox_ver_el');
			// this.DEBUG("_xpi_exists: tsox_el = " + tsox_el);
			if ( tsox_el ){
				try {
					this.bInstalled = this.bXPIInstalled = true;
					this.sVersion = this.sXPIVersion = tsox_el.getAttribute('ver');
					return true;
				} catch(Err){}
			} else {
				this.get_tsox_cookies();
				if ( this.cookie.config.data != null ){
					this.bInstalled = this.bXPIInstalled = true;
					this.bXPILatestVersion = this.bLatestVersion;
					return true;
				} else {
					return false;
				}
				//return ( this.cookie.config.data != null );
			}
		}
		return false;
	},

	get_tsox_cookies: function()
	{
		//var cookie_strings = document.cookie.split(";");
		var cookie = {};
		var start = document.cookie.indexOf(this.cookie.config.name + "=");
		if ( start < 0 ){ return; }
		var end = document.cookie.indexOf(";",start);
		if ( end < 0 ){ end = document.cookie.length; }
		start += ( this.cookie.config.name.length + 1 );
		// this.DEBUG("get_tsox_cookies: start = " + start);
		// this.DEBUG("get_tsox_cookies: end = " + end);
		var data = unescape( document.cookie.substring(start,end) );
		// this.DEBUG("get_tsox_cookies: data = " + data);
		var params = data.split("&");
		// this.DEBUG("get_tsox_cookies: params.length = " + params.length);
		for ( var kvp in params ){
			var key = params[kvp].split("=")[0];
			var val = params[kvp].split("=")[1];
			// this.DEBUG("get_tsox_cookies: " + key + " = " + val);
			cookie[key] = val;
		}
		this.cookie.config.data = cookie;
	},

	NeedsUpgrade: function( _compare )
	{
		// this.DEBUG("NeedsUpgrade: typeof(_compare) = " + typeof(_compare));
		if ( typeof(_compare) == "string" ){
			if ( this.sVersion != this.get_max_version( _compare, this.sVersion ) ){
		 		return true;
		    }
		} else if( _compare != null && _compare != undefined ) {
			// this.DEBUG("NeedsUpgrade: _compare.tb = " + _compare.tb );
			// this.DEBUG("NeedsUpgrade: _compare.ver = " + _compare.ver );
			try {
                var index = _compare.tb.lastIndexOf('.');
                var compareToolbar = _compare.tb.substring(0, index);
                var compareName = _compare.tb.substring(1 + index);
				var check = false;
				if ( this.winner.toolbar == compareToolbar && this.winner.name == compareName ) {
                    check = true;
                }
				// this.DEBUG("NeedsUpgrade: check = " + check );
				if ( check ){
					// this.DEBUG("NeedsUpgrade: version match = " + ( this.sVersion != this.get_max_version( _compare.ver, this.sVersion ) ) );
					return ( this.sVersion != this.get_max_version( _compare.ver, this.sVersion ) );
				}
			} catch(Err){}
		}

	    return false;
	},

	check_versions: function( _current, _latest, _required )
	{
		// this.DEBUG("check_versions: _current = " + _current);
		// this.DEBUG("check_versions: _latest = " + _latest);
		// this.DEBUG("check_versions: _required = " + _required);
		if ( _current == null || _current == undefined ){ _current = ""; }
		if ( _latest == null || _latest == undefined ){ _latest = ""; }
		if ( _required == null || _required == undefined ){ _required = ""; }
		var aToolbarVersion = ( _current != "" ) ? _current.split('.') : [];
		var aLatestVersion = ( _latest != "" ) ? _latest.split('.') : ['0','0'];
		var aRequiredVersion = _required.split('.');

		for (i=0; i < aToolbarVersion.length; i++){
			// this.DEBUG("check_versions: i = " + i);
			if ( aToolbarVersion[i].length == 1 ) aToolbarVersion[i] = "0" + aToolbarVersion[i];
			if ( aLatestVersion[i].length == 1 ) aLatestVersion[i] = "0" + aLatestVersion[i];
			if ( aRequiredVersion[i].length == 1 ) aRequiredVersion[i] = "0" + aRequiredVersion[i];
		}

		var iToolbarVersion = aToolbarVersion.join("");
		var iLatestToolbarVersion = aLatestVersion.join("");
		var iRequiredToolbarVersion = aRequiredVersion.join("");

		// this.DEBUG("check_versions: iToolbarVersion = " + iToolbarVersion);
		// this.DEBUG("check_versions: iLatestToolbarVersion = " + iLatestToolbarVersion);
		// this.DEBUG("check_versions: iRequiredToolbarVersion = " + iRequiredToolbarVersion);

		iToolbarVersion = iToolbarVersion - 0;
		iLatestToolbarVersion = iLatestToolbarVersion - 0;
		iRequiredToolbarVersion = iRequiredToolbarVersion - 0;

		return {
				latest:(iToolbarVersion >= iLatestToolbarVersion),
				upgrade:(iToolbarVersion < iRequiredToolbarVersion)
		};
	},

	get_max_version: function( _v1, _v2 )
	{
		// this.DEBUG("get_max_version: _v1 = " + _v1);
		// this.DEBUG("get_max_version: _v2 = " + _v2);
		var aVersion1 = _v1.split('.');
		var aVersion2 = _v2.split('.');
		if ( aVersion1.length < aVersion2.length ){
			aVersion1 = this._pad_version_number( aVersion1, aVersion2.length );
		} else if ( aVersion1.length > aVersion2.length ){
			aVersion2 = this._pad_version_number( aVersion2, aVersion1.length );
		}
		for (i=0; i < aVersion1.length; i++){
			if (aVersion1[i].length == 1) aVersion1[i] = "0" + aVersion1[i];
			if (aVersion2[i].length == 1) aVersion2[i] = "0" + aVersion2[i];
		}
		// this.DEBUG("get_max_version: aVersion1 = " + aVersion1.join("."));
		// this.DEBUG("get_max_version: aVersion2 = " + aVersion2.join("."));

		var iToolbarVersion = aVersion1.join("");
		var iLatestToolbarVersion = aVersion2.join("");
		iToolbarVersion = iToolbarVersion - 0;
		iLatestToolbarVersion = iLatestToolbarVersion - 0;

		return ( iToolbarVersion >= iLatestToolbarVersion ) ? _v1 : _v2 ;
	},

	_pad_version_number: function( _value_array, _max )
	{
		// this.DEBUG("_pad_version_number: _value_array.length = " + _value_array.length);
		// this.DEBUG("_pad_version_number: _max = " + _max);
		for( var idx=_value_array.length; idx < _max; idx++ ){
			_value_array[idx] = "0";
		}
		return _value_array;
	},

	plugin_exists: function( _mimetype )
	{
		navigator.plugins.refresh(false);
		var numPlugins = navigator.plugins.length;
		for (var i = 0; i < numPlugins; i++) {
			var plugin = navigator.plugins[i];
			var numTypes = plugin.length;
	        var mimetype;
	        var enabled;
	        var enabledPlugin;
	        for (var j = 0; j < numTypes; j++) {
	            mimetype = plugin[j];
	            if (mimetype) {
	                if (mimetype.type == _mimetype) {
	                	return true;
	                }
	            }
	        }
		}
		return false;
	},

	get_browser: function()
	{
		if ( navigator.userAgent.search(/Firefox/i) > -1 ){
			this.browser.name = "firefox";
			try {
				this.browser.major_version = navigator.userAgent.match(/Firefox\/(\d+(\.\d*)*)/i)[1].split(".")[0];
			} catch(err){}
			return;
		}
		// make sure it's not Opera which sometimes reports itself as IE
		if ( navigator.appName.search(/Internet Explorer/i) > -1 ){
			if ( navigator.userAgent.search(/Opera\s/i) < 0 ){
				this.browser.name = "msie";
				try {
					this.browser.major_version = navigator.userAgent.match(/msie\s(\d+(\.\d*)*)/i)[1].split(".")[0];
				} catch(err){}
				return;
			}
		}
	},

	get_property: function( _prop, _alt )
	{
		if ( _prop == undefined || _prop == null || _prop == "" ){ return ""; }
		if ( _alt == undefined ){ _alt = ""; }
		var pvalue = ( this[_prop] ) ? this[_prop] : _alt ;
		// this.DEBUG("get_property: this["+_prop+"] = " + this[_prop]);
		return pvalue;
	},

	check_disable: function( _ctl, productCode, bReturnValue, successURL )
	{
		try {
			//Check if IE8+ has the Toolbar Enabled
			if (! this.oSettingsCtl.IsObjectEnabled("{07B18EA9-A523-4961-B6BB-170DE4475CCA}")) {
				// this.DEBUG("disabled");
				if(typeof(urchinTracker)=="function")urchinTracker('/toolbar/detect/disabled/viewdialog');
				if(bReturnValue) {
					return true;
				} else {
					showModal(productCode,this.sPartnerID,"disabled",successURL);
				}
			//Check if IE5+ has the Toolbar visible
			} else if (! this.oSettingsCtl.ToolbarVisible) {
				// this.DEBUG("not visible");
				if(typeof(urchinTracker)=="function")urchinTracker('/toolbar/detect/hidden/viewdialog');
				if(bReturnValue) {
					return true;
				} else {
					showModal(productCode,this.sPartnerID,"hidden",successURL);
				}
			} else {
				// this.DEBUG("enabled");
				if(typeof(urchinTracker)=="function")urchinTracker('/toolbar/detect/enabled');
				if(bReturnValue) return false;
			}
		} catch(e) {
			// this.DEBUG("method not available");
			if(bReturnValue) return false;
		}
	},

	check_update_flag: function()
	{
		// this.DEBUG( "[TOOLBAR::check_update_flag]");
		try {
			// this.DEBUG( "[TOOLBAR::check_update_flag] check for au");
			if (! this.oSettingsCtl.GetRegistryToggle("au") ) {
				// this.DEBUG( "[TOOLBAR::check_update_flag] au = " + this.oSettingsCtl.GetRegistryToggle("au") );
				this.oSettingsCtl.SetRegistryToggle("ua",false);
				this.oSettingsCtl.SetRegistryToggle("au",true);
				if (this.oSettingsCtl.GetRegistryToggle("au")) {
					var pxUAUrl='http://imgfarm.com/images/nocache/tr/tb/ua.gif?uid='+this.sUID+'&p='+this.sPartnerID+'&v='+this.sVersion+'&url='+escape(window.location.href);
					var pxUAImage = new Image();
					pxUAImage.src = pxUAUrl;
				}
			}
		} catch(Err){
			// this.DEBUG( "[TOOLBAR::check_update_flag] Err.msg = " + Err.msg );
		}
	},

	require_update: function( _opts )
	{
		var bReqFF = false;
		var bReqIE = false;
		var sTbReqVer = "";
		var sRedirect = "";

		// this.DEBUG( "[TOOLBAR::require_update] _opts.require_firefox = " + _opts.require_firefox );
		// this.DEBUG( "[TOOLBAR::require_update] _opts.required_version = " + _opts.required_version );
		this.DEBUG( "[TOOLBAR::require_update] _opts.redirect_url = " + _opts.redirect_url );

		// check for values passed in
		if ( _opts == undefined ){ _opts = {} }
		if ( typeof _opts.require_firefox == 'boolean' ){
			bReqFF = _opts.require_firefox;
		}
		// not needed now, but for future use
		if ( typeof _opts.require_ie == 'boolean' ){
			bReqIE = _opts.require_ie;
		}

		if ( _opts.required_version != null && _opts.required_version != undefined ){
			sTbReqVer = _opts.required_version;
		}

		if ( _opts.redirect_url != null && _opts.redirect_url != undefined ){
			sRedirect = _opts.redirect_url;
		}

		if ( bReqFF && this.browser.name == "firefox" && this.sVersion!=null && this.sVersion!="undefined" && this.sVersion!=""){
			// check_versions: function( _current, _latest, _required )

			var vcheck = this.check_versions( this.sVersion, this.winner.max_version, "2.3.50.21" );
			// this.DEBUG( "[TOOLBAR::RequiredUpdate] vcheck.latest = " + vcheck.latest );
			// this.DEBUG( "[TOOLBAR::require_update] vcheck.upgrade = " + vcheck.upgrade );
			if ( vcheck.upgrade && sRedirect != "" ){
				this.send_to_upgrade( { url: sRedirect } );
			}
		}

	},

	send_to_upgrade: function( _opts )
	{
		// this.DEBUG( "[TOOLBAR::send_to_upgrade] _opts.url = " + _opts.url );
		// check for values passed in
		if ( _opts == undefined ){ _opts = {} }
		if ( _opts.url != null && _opts.url != undefined ){
			window.location.replace( _opts.url );
		}
	},

	check_search_asst: function()
	{
		var sa = ( this.oSettingsCtl.GetRegistryToggle("mwssrcas.dll") ) ? true : false;
		return sa;
	},

	check_hp: function( _domains )
	{
		var hp = true;
		if ( _domains == null || _domains == undefined || _domains == "" ){
			return true;
		}

		var browser = 1; // 1 = ie, 2 = ff
		if ( navigator.userAgent.toLowerCase().indexOf("firefox") > -1 ){ browser = 2; }
		try {
			hp = this.oSettingsCtl.IsHomePageOnOurDomain( _domains, browser );
		} catch(err){
			hp = null;
			return null;
		}
		return (hp != 0) ;
	},

	feature_detect: function( _domains )
	{
		// check_disable: function( _ctl, productCode, bReturnValue, successURL )
		// this.oSettingsCtl.IsObjectEnabled("{07B18EA9-A523-4961-B6BB-170DE4475CCA}")
		var features = {
			enabled: true,
			search: true,
			home: true,
			track: {
				t: "1",
				s: "1",
				h: "1"
			},
			track_str: ""
		};

		features.enabled = !this.check_disable( "","",true,"" );
		features.search = this.check_search_asst();
		features.home = this.check_hp( _domains );


		//if ( window.location.href.split("?")[0].indexOf('smileycentraldev.com') > -1 ){
		//	features.search = true;
		//	features.track.s = "X";
		//}
		//features.track.t = ( features.enabled === true ) ? "1" : "0" ;
		//features.track.s = ( features.search === true ) ? "1" : "0" ;
		//features.track.h = ( features.home === true ) ? "1" : "0" ;

		if ( features.enabled === false ){
			features.track.t = "0";
		} else if ( features.enabled == null ){
			features.track.t = "X";
		}

		if ( features.search === false ){
			features.track.s = "0";
		} else if ( features.search == null ){
			features.track.s = "X";
		}

		if ( features.home === false ){
			features.track.h = "0";
		} else if ( features.home == null ){
			features.track.h = "X";
		}

		features.track_str = "t" + features.track.t
							+"s" + features.track.s
							+"h" + features.track.h;

		return features;
	},

	get_segment: function()
	{
		var legend = "0123456789abcdefghijklmnopqrstuvwxyz_";
		var key = this.sUID.substr(-1).toLowerCase();
		return legend.indexOf(key);
	},

/*
possible key/value pairs for _options
control (object)      : similar to master_list objects, will be used if present, else winner is used
tbtype (string)       : mws|vicinio|mindspark|xpi
element (object)      : html element to write to
element_id (string)   : id of htmle element to write to (if object not provided)
override (object)     : override the default values for select properties of a control object
		ex: override { html_id: "SettingsControl", min_version: "2.4.0.1" }
		excludes name,toolbar,exe,xpi
write_to_client (boolean) : write object/embed tag to client
write_to_element (boolean) : write object/embed tag to innerHTML of html element
*/

    // generic get data from toolbar
    // uses settingsCtl to get data
    GetDataFromToolbar: function( _options )
    {
        this.DEBUG("GetDataFromToolbar: _options = " + _options);
        if ( _options == undefined || _options == null ){
            _options = {
                control: this.winner,
                element: null,
                element_id: "",
                override: {},
                write_to_element: false
            };
        }
        if ( _options.control.xpi && this.cookie.config.data == null ){
            this.DEBUG("GetDataFromToolbar: xpi is true, coookie data is null");
            GetXpiConfig( this );
        } else if ( _options.control.xpi && this.cookie.config.data != null ){
            this.DEBUG("GetDataFromToolbar: xpi is true, coookie data is NOT null");
            this.set_xpi_data();
        } else if ( _options.control.exe ){
            // init the settingsCtl via instantiating it and reading data from it
            this.DEBUG("GetDataFromToolbar: _options.control.exe = " + _options.control.exe);
            this.InitSettingsCtl( _options );
        }
    },

    // get data from xpi toolbar
    InitXpiToolbar: function( _options )
    {

    },

    CreateInstance: function( _options )
    {
        this.DEBUG("CreateInstance: _options.control = " + _options.control);
        var html = "";
        try {
            if ( window.ActiveXObject ){
                this.DEBUG("CreateInstance: activeX_object = " + _options.control.activeX_object);
                if ( _options.control.activeX_object ) { new ActiveXObject( _options.control.activeX_object ); }
                html = this.get_tag_html( { tagname:"object", attribs: _options.control } );
                this.DEBUG("CreateInstance: html = " + html);
            } else if ( this.plugin_exists( _options.control.mimetype ) ){
                html = this.get_tag_html( { tagname:"embed", attribs: _options.control } );
            }

            //this.DEBUG("CreateInstance: _options.write_to_element = " + _options.write_to_element);
            if ( _options.write_to_element ){
                var html_element = ( _options.element ) ? _options.element : document.getElementById( _options.element_id ) ;

                if ( html_element ){
                    html_element.innerHTML = html;
                } else {
                    document.write( html );
                }
            } else {
                document.write( html );
            }

        } catch(Err){
            this.DEBUG("CreateInstance: catch(Err) = " + Err.message);
            this.bToolbarErrorCaught=true;
        }
    },

    // instantiate settings control
    InitSettingsCtl: function( _options )
    {
        if ( _options == undefined || _options == null ){
            _options = {};
        }
        this.DEBUG("InitSettingsCtl: _options.control [1] = " + _options.control);
        this.DEBUG("InitSettingsCtl: _options.write_to_element = " + _options.write_to_element);
        //this.DEBUG("InitSettingsCtl: _options.control [2] = " + _options.control);
        if ( _options.control ){
            this.DEBUG("InitSettingsCtl: _options.control exists and is not null or undefined");
            this.CreateInstance( _options );
            this.oSettingsCtl = document.getElementById( _options.control.html_id );
            this.get_settingsCtl_data();
        } else if( this.winner.exe ){
            var control = this.get_toolbar_from_master( this.winner.toolbar + ".settingsCtl" );
            this.DEBUG("InitSettingsCtl: control = " + control);
            if ( control ){
                _options.control = control;
                this.CreateInstance( _options );
                this.oSettingsCtl = document.getElementById( control.html_id );
                this.get_settingsCtl_data();
            }
        }
    },

    InitHtmlMenuCtl: function( _options )
    {
        if ( _options == undefined || _options == null ){
            _options = {};
        }
        if ( _options.control ){
            this.DEBUG("InitHtmlMenuCtl: _options.control exists and is not null or undefined");
            this.CreateInstance( _options );
            this.oHtmlMenuCtl = document.getElementById( _options.control.html_id );
            this.get_htmlCtl_data();
        } else if( this.winner.exe ){
            var control = this.get_toolbar_from_master( this.winner.toolbar + ".htmlMenuCtl" );
            this.DEBUG("InitHtmlMenuCtl: control = " + control);
            if ( control ){
                _options.control = control;
                this.DEBUG("InitHtmlMenuCtl: control.html_id = " + control.html_id);
                this.CreateInstance( _options );
                this.oHtmlMenuCtl = document.getElementById( control.html_id );
                this.get_htmlCtl_data();
            }
        }
        /*
        if ( this.winner.toolbar == null || this.winner.toolbar == undefined || this.winner.toolbar == "" ){
            return;
        }
        var oTb = this.get_toolbar_from_master( this.winner.toolbar + ".htmlMenuCtl" );
        */
    },

    InitChatCtl: function( _options )
    {
        this.DEBUG("InitSettingsCtl: _options = " + _options);
        if ( _options == undefined || _options == null ){
            _options = {};
        }

        if( this.winner.exe ){
            var control = this.get_toolbar_from_master( this.winner.toolbar + ".chatCtl" );
            this.DEBUG("InitChatCtl: control = " + control);
            if ( control ){
                _options.control = control;
                this.CreateInstance( _options );
                this.DEBUG("InitChatCtl: control.html_id = " + control.html_id);
                this.oChatCtl = document.getElementById( control.html_id );
                this.DEBUG("InitChatCtl: oChatCtl = " + oChatCtl);
            }
        }

    },

    InitScreenSaverCtl: function( _options )
    {
        this.DEBUG("InitScreenSaverCtl: _options = " + _options);
        if ( _options == undefined || _options == null ){
            _options = {};
        }
        if ( _options.control ){
            this.DEBUG("InitScreenSaverCtl: _options.control exists and is not null or undefined");
            this.CreateInstance( _options );
            this.oScreenSaverCtl = document.getElementById( _options.control.html_id );
        } else if( this.winner.exe ){
            var control = this.get_toolbar_from_master( this.winner.toolbar + ".screenSaverCtl" );
            this.DEBUG("InitScreenSaverCtl: control = " + control);
            if ( control ){
                _options.control = control;
                this.DEBUG("InitScreenSaverCtl: control.html_id = " + control.html_id);
                this.CreateInstance( _options );
                this.oScreenSaverCtl = document.getElementById( control.html_id );
                //this.get_htmlCtl_data();
            }
        }
        this.DEBUG("InitScreenSaverCtl: oScreenSaverCtl = " + this.oScreenSaverCtl);
        this.DEBUG("InitScreenSaverCtl: oScreenSaverCtl.version = " + this.oScreenSaverCtl.version);


    },

    InitDataCtl: function( _options )
    {
        this.DEBUG("InitDataCtl: _options = " + _options);
        if ( _options == undefined || _options == null ){
            _options = {};
        }
        if ( _options.control ){
            this.DEBUG("InitDataCtl: _options.control exists and is not null or undefined");
            this.CreateInstance( _options );
            this.oDataCtl = document.getElementById( _options.control.html_id );
        } else if( this.winner.exe ){
            var control = this.get_toolbar_from_master( this.winner.toolbar + ".dataCtl" );
            this.DEBUG("InitDataCtl: control = " + control);
            if ( control ){
                _options.control = control;
                this.DEBUG("InitDataCtl: control.html_id = " + control.html_id);
                this.CreateInstance( _options );
                this.oDataCtl = document.getElementById( control.html_id );
            }
        }
    },

    DataCtl_SetFileName: function( _name )
    {
        this.DEBUG("DataCtl_SetFileName: _name = " + _name);
        try {
            this.oDataCtl.DataFileName = _name;
        } catch(Err) {
            this.DEBUG("DataCtl_SetFileName: catch(Err) = " + Err.message);
        }
    },

    DataCtl_Set: function( _data )
    {
        this.DEBUG("DataCtl_Set: _data = " + _data);
        try {
            this.oDataCtl.SetData( _data );
            //this.DEBUG("DataCtl_Set: _data = " + _data);
        } catch(Err) {
            this.DEBUG("DataCtl_Set: catch(Err) = " + Err.message);
        }
    },

    DataCtl_Get: function()
    {
        var data = "";
        try {
            data = this.oDataCtl.GetData();
            this.DEBUG("DataCtl_Get: data = " + data);
        } catch(Err) {
            this.DEBUG("DataCtl_Get: catch(Err) = " + Err.message);
        }
        return data;
    },

	DEBUG: function( _msg )
	{
		if ( !this.debug_enabled ){ return; }
		try {
			console.log( _msg );
		}catch(err){
			/*
			try {
				document.getElementById('data_output').innerHTML += _msg + "<br />\n";
			} catch(err2){
				debug_string += _msg + "<br />\n";
			}
			*/
		}
	}
};

// The complete list includes all the Facebook toolbars.
TOOLBAR.toolbar_list = TOOLBAR.toolbar_list.concat(TOOLBAR.facebook_toolbar_list);

TOOLBAR.master_list = {
    facebook_iwon_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_iwon_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-id-iwonieplugin', prog_id: 'iWonIE.SettingsPlugin', activeX_object: 'iWonIE.SettingsPlugin', classid: '4adfbab0-94f3-4dea-a509-9beffee52c4c', html_id: 'iwonSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_iwon_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_iwon_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-jf-iwonplugin', prog_id: 'iWon.SettingsPlugin', activeX_object: 'iWon.SettingsPlugin', classid: 'c94072e9-9edf-423f-b8ca-a4c95bbd15d7', html_id: 'iwonSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_retrogamer_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_retrogamer_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-6h-retrogamerieplugin', prog_id: 'RetrogamerIE.SettingsPlugin', activeX_object: 'RetrogamerIE.SettingsPlugin', classid: 'bd95583c-30c9-4799-a068-8de08913cbb6', html_id: 'retrogamerSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_retrogamer_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_retrogamer_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-k7-retrogamerplugin', prog_id: 'Retrogamer.SettingsPlugin', activeX_object: 'Retrogamer.SettingsPlugin', classid: '3d397062-cc5d-4248-b9d7-c9bdcfb1463f', html_id: 'retrogamerSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_mfc_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_mfc_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-c8-myfuncardsbarieplugin', prog_id: 'MyFunCardsBarIE.SettingsPlugin', activeX_object: 'MyFunCardsBarIE.SettingsPlugin', classid: 'fc1857f0-7f42-4206-b939-1f65daa8d547', html_id: 'mfcSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_mfc_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_mfc_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-79-myfuncardsbarplugin', prog_id: 'MyFunCardsBar.SettingsPlugin', activeX_object: 'MyFunCardsBar.SettingsPlugin', classid: 'f9483bd5-166a-46a4-b8d6-bafa9f70876d', html_id: 'mfcSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_webfetti_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_webfetti_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-yb-webfettiieplugin', prog_id: 'WebfettiIE.SettingsPlugin', activeX_object: 'WebfettiIE.SettingsPlugin', classid: 'e231159c-31ac-4d3e-b2f1-96765ffe296b', html_id: 'webfettiSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_webfetti_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_webfetti_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-7d-webfettiplugin', prog_id: 'Webfetti.SettingsPlugin', activeX_object: 'Webfetti.SettingsPlugin', classid: '438b5c1d-0e9e-4548-a2e1-3ea0b9daa937', html_id: 'webfettiSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_iwonglobal_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_iwonglobal_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-vr-iwongieplugin', prog_id: 'IWONGIE.SettingsPlugin', activeX_object: 'IWONGIE.SettingsPlugin', classid: '92b978e8-af43-4d1a-887f-233c034ed189', html_id: 'iwonglobalSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_iwonglobal_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_iwonglobal_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-9u-iwongplugin', prog_id: 'IWONG.SettingsPlugin', activeX_object: 'IWONG.SettingsPlugin', classid: 'bf2f395d-8edb-4a01-9b04-cbaae0a0f69e', html_id: 'iwonglobalSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_mywebface_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_mywebface_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-4q-mywebfacebarieplugin', prog_id: 'MyWebFaceBarIE.SettingsPlugin', activeX_object: 'MyWebFaceBarIE.SettingsPlugin', classid: '3cc99ff0-c726-49ca-a404-014af0f9ab8d', html_id: 'mywebfaceSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_mywebface_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_mywebface_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-9a-mywebfacebarplugin', prog_id: 'MyWebFaceBar.SettingsPlugin', activeX_object: 'MyWebFaceBar.SettingsPlugin', classid: 'db1a5d13-7f0f-420a-a6f9-c477c7629a73', html_id: 'mywebfaceSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_kazulah_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_kazulah_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-k1-kazulahbarieplugin', prog_id: 'KazulahBarIE.SettingsPlugin', activeX_object: 'KazulahBarIE.SettingsPlugin', classid: '64264c50-12a0-46a5-a811-614d025ed431', html_id: 'kazulahSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_kazulah_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_kazulah_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-n5-kazulahbarplugin', prog_id: 'KazulahBar.SettingsPlugin', activeX_object: 'KazulahBar.SettingsPlugin', classid: '95c55ad5-6298-47e6-b24c-2bc08855634f', html_id: 'kazulahSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_girlsense_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_girlsense_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-zr-girlsensebarieplugin', prog_id: 'GirlSenseBarIE.SettingsPlugin', activeX_object: 'GirlSenseBarIE.SettingsPlugin', classid: 'ebdc002d-485e-4d89-90c8-b0bdd83cff89', html_id: 'girlsenseSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_girlsense_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_girlsense_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-pr-girlsensebarplugin', prog_id: 'GirlSenseBar.SettingsPlugin', activeX_object: 'GirlSenseBar.SettingsPlugin', classid: '7ef73410-c7d9-4506-b094-c969d3ef2d60', html_id: 'girlsenseSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_zwinky_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_zwinky_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-ry-zwinkyieplugin', prog_id: 'ZwinkyIE.SettingsPlugin', activeX_object: 'ZwinkyIE.SettingsPlugin', classid: '4685ae68-c9fb-4889-ae70-abf7ff17ff2f', html_id: 'zwinkySettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_zwinky_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_zwinky_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-zx-zwinkyplugin', prog_id: 'Zwinky.SettingsPlugin', activeX_object: 'Zwinky.SettingsPlugin', classid: '1a5f5642-2ed9-440d-94e4-75b0cb6ac252', html_id: 'zwinkySettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_pss_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_pss_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-fl-popularscreensaversieplugin', prog_id: 'PopularScreenSaversIE.SettingsPlugin', activeX_object: 'PopularScreenSaversIE.SettingsPlugin', classid: 'fea39c01-d69a-4180-8756-e24a52aaacc9', html_id: 'pssSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_pss_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_pss_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-jk-popularscreensaversplugin', prog_id: 'PopularScreenSavers.SettingsPlugin', activeX_object: 'PopularScreenSavers.SettingsPlugin', classid: '1dbbffca-ef0c-443d-8881-87acd2eac0ea', html_id: 'pssSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_cursormania_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_cursormania_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-bv-cursormaniaieplugin', prog_id: 'CursorManiaIE.SettingsPlugin', activeX_object: 'CursorManiaIE.SettingsPlugin', classid: '35d3f52f-e6d8-4675-925c-35752ae7c520', html_id: 'cursormaniaSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_cursormania_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_cursormania_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-yv-cursormaniaplugin', prog_id: 'CursorMania.SettingsPlugin', activeX_object: 'CursorMania.SettingsPlugin', classid: '15d6ba7e-9ba6-46c0-808c-f39c57317644', html_id: 'cursormaniaSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_smileycentral_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_smileycentral_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-8z-smileycentralieplugin', prog_id: 'SmileyCentralIE.SettingsPlugin', activeX_object: 'SmileyCentralIE.SettingsPlugin', classid: 'cccf53e3-85dc-4c6b-acc9-cb48502e24f0', html_id: 'smileycentralSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_smileycentral_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_smileycentral_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-ly-smileycentralplugin', prog_id: 'SmileyCentral.SettingsPlugin', activeX_object: 'SmileyCentral.SettingsPlugin', classid: 'a753c63a-66f6-44cd-9fe4-9cec52c90d6c', html_id: 'smileycentralSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },
    facebook_smileycreator_msie: { ctl: 'settingsCtl', settingsCtl: { browser: 'msie', toolbar: 'facebook_smileycreator_msie', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-z6-smileycreatorieplugin', prog_id: 'SmileyCreatorIE.SettingsPlugin', activeX_object: 'SmileyCreatorIE.SettingsPlugin', classid: 'f6bc63ca-3037-4a1d-a88a-20dd8b8d4d3b', html_id: 'smileycreatorSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } }, facebook_smileycreator_firefox: { ctl: 'settingsCtl', settingsCtl: { browser: 'firefox', toolbar: 'facebook_smileycreator_firefox', name: 'settingsCtl', exe: true, xpi: false, mimetype: 'application/x-7w-smileycreatorplugin', prog_id: 'SmileyCreator.SettingsPlugin', activeX_object: 'SmileyCreator.SettingsPlugin', classid: '7e1c3003-b8d1-43ab-9028-841a4162c1f5', html_id: 'smileycreatorSettingsCtl', min_version: '', max_version: '2.3.68.10', required_version: '2.3.68.10', params: {} } },

	mws: {
        ctl: 'settingsCtl',

		settingsCtl: {
			name: "settingsCtl",
			toolbar: "mws",
			exe: true,
			xpi: false,
			mimetype: "application/x-mws-mywebsearchplugin",
			prog_id: "MyWebSearchToolBar.SettingsPlugin",
			activeX_object: "MyWebSearchToolBar.SettingsPlugin",
			classid:"07B18EAB-A523-4961-B6BB-170DE4475CCA",
			html_id: "ToolbarCtlMWS",
			min_version: "",
			max_version: "2.3.67.1",
			required_version: "2.0.4.16",
			params: {}
		},
		htmlMenuCtl: {
			name: "htmlMenuCtl",
			toolbar: "mws",
			exe: true,
			xpi: false,
			mimetype: "application/x-mws-mywebsearchplugin",
			prog_id: "FunWebProducts.HTMLMenu.2",
			activeX_object: "MyWebSearchToolBar.SettingsPlugin",
			classid:"3DC201FB-E9C9-499C-A11F-23C360D7C3F8",
			html_id: "HTMLMenuCtl",
			min_version: "",
			max_version: "2.3.67.1",
			required_version: "2.0.4.16",
			params: {}
		},
		screenSaverCtl: {
			name: "screenSaverCtl",
			toolbar: "mws",
			exe: true,
			xpi: false,
			mimetype: "application/x-mws-mywebsearchplugin",
			prog_id: "ScreenSaverControl.ScreenSaverInstaller",
			activeX_object: "ScreenSaverControl.ScreenSaverInstaller",
			classid:"9FF05104-B030-46FC-94B8-81276E4E27DF",
			html_id: "ScreenSaverInstaller",
			min_version: "",
			max_version: "2.3.67.1",
			required_version: "2.0.4.16",
			params: {
				PM: "efkfpetrqjgksgnteltlofgnoiiiiqkngkmimlfhsnfeogokhehfhghhhihjhkhlhmhnifigihiiijik",
				L: "psnllmmrkrgosmekokerjsohgneknhpehjfhpnlqsqgnokhohehfhghhhihjhkhlhmhnifigihiiijik"
			}
		},
        chatCtl: {
            name: "chatCtl",
            toolbar: "mws",
            exe: true,
            xpi: false,
            mimetype: "",
            prog_id: "",
            activeX_object: "",
            classid:"E79DFBCA-5697-4fbd-94E5-5B2A9C7C1612",
            html_id: "chatcontrol",
            min_version: "",
            max_version: "2.3.50.45",
            required_version: "2.0.4.16",
            params: {
                Category: "Chat",
                Capabilities: "0x14",
                SignOutDelay: "10"
            }
        },
		dataCtl: {
			name: "dataCtl",
			toolbar: "mws",
			exe: true,
			xpi: false,
			mimetype: "application/x-mws-mywebsearchplugin",
			prog_id: "FunWebProducts.DataControl",
			activeX_object: "FunWebProducts.DataControl",
			classid:"25560540-9571-4D7B-9389-0F166788785A",
			html_id: "DataControl",
			min_version: "",
			max_version: "2.3.67.1",
			required_version: "2.0.4.16",
			params: {}
		},
		xpi: {
			name: "xpi",
			toolbar: "mws",
			exe: false,
			xpi: true,
			min_version: "",
			max_version: "1.3",
			required_version: "1.0",
			element: "tsox_ver_el"
		}
	},
	vicinio: {
        ctl: 'settingsCtl',

		settingsCtl: {
			name: "settingsCtl",
			toolbar: "vicinio",
			exe: true,
			xpi: false,
			mimetype: "application/x-selfserviceplugin",
			prog_id: "SelfServiceToolBar.SettingsPlugin",
			activeX_object: "SelfServiceToolBar.SettingsPlugin",
			classid:"4971362f-8e35-11dd-88bb-000d562c920a",
			html_id: "SettingsCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		},
		htmlMenuCtl: {
			name: "htmlMenuCtl",
			toolbar: "vicinio",
			exe: true,
			xpi: false,
			mimetype: "application/x-selfserviceplugin",
			prog_id: "SelfService.HTMLMenu",
			activeX_object: "SelfService.HTMLMenu",
			classid:"4971365c-8e35-11dd-88bb-000d562c920a",
			html_id: "HTMLMenuCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		},
		screenSaverCtl: {
			name: "screenSaverCtl",
			toolbar: "vicinio",
			exe: true,
			xpi: false,
			mimetype: "application/x-selfserviceplugin",
			prog_id: "SelfService.ScreenSaverInstaller",
			activeX_object: "SelfService.ScreenSaverInstaller",
			classid:"49713669-8e35-11dd-88bb-000d562c920a",
			html_id: "screenSaverCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {
				PM: "efkfpetrqjgksgnteltlofgnoiiiiqkngkmimlfhsnfeogokhehfhghhhihjhkhlhmhnifigihiiijik",
				L: "psnllmmrkrgosmekokerjsohgneknhpehjfhpnlqsqgnokhohehfhghhhihjhkhlhmhnifigihiiijik"
			}
		},
        chatCtl: {
            name: "chatCtl",
            toolbar: "vicinio",
            exe: true,
            xpi: false,
            mimetype: "",
            prog_id: "",
            activeX_object: "",
            classid:"E79DFBCA-5697-4fbd-94E5-5B2A9C7C1612",
            html_id: "chatcontrol",
            min_version: "",
            max_version: "2.3.50.45",
            required_version: "2.0.4.16",
            params: {
                Category: "Chat",
                Capabilities: "0x14",
                SignOutDelay: "10"
            }
        },
		dataCtl: {
			name: "dataCtl",
			toolbar: "vicinio",
			exe: true,
			xpi: false,
			mimetype: "application/x-selfserviceplugin",
			prog_id: "SelfService.DataControl",
			activeX_object: "SelfService.DataControl",
			classid:"49713653-8e35-11dd-88bb-000d562c920a",
			html_id: "DataControl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		}
	},
	mindspark: {
        ctl: 'settingsCtl',

		settingsCtl: {
			name: "settingsCtl",
			toolbar: "mindspark",
			exe: true,
			xpi: false,
			mimetype: "application/x-m5-mindsparkplugin",
			prog_id: "MindSpark.SettingsPlugin",
			activeX_object: "MindSpark.SettingsPlugin",
			classid:"21DBA35B-05C1-4339-9694-13D8D9133339",
			html_id: "SettingsCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		},
		htmlMenuCtl: {
			name: "htmlMenuCtl",
			toolbar: "mindspark",
			exe: true,
			xpi: false,
			mimetype: "application/x-m5-mindsparkplugin",
			prog_id: "MindSpark.HTMLMenu",
			activeX_object: "MindSpark.HTMLMenu",
			classid:"288FEAAB-B810-40ad-9AAC-310230590855",
			html_id: "HTMLMenuCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		},
		screenSaverCtl: {
			name: "screenSaverCtl",
			toolbar: "mindspark",
			exe: true,
			xpi: false,
			mimetype: "application/x-m5-mindsparkplugin",
			prog_id: "MindSpark.ScreenSaverSettings",
			activeX_object: "MindSpark.ScreenSaverSettings",
			classid:"C51F4A54-EBD1-4e21-AC05-1CCF7E8849E8",
			html_id: "screenSaverCtl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {
				PM: "efkfpetrqjgksgnteltlofgnoiiiiqkngkmimlfhsnfeogokhehfhghhhihjhkhlhmhnifigihiiijik",
				L: "psnllmmrkrgosmekokerjsohgneknhpehjfhpnlqsqgnokhohehfhghhhihjhkhlhmhnifigihiiijik"
			}
		},
		dataCtl: {
			name: "dataCtl",
			toolbar: "mindspark",
			exe: true,
			xpi: false,
			mimetype: "application/x-m5-mindsparkplugin",
			prog_id: "MindSpark.DataControl",
			activeX_object: "MindSpark.DataControl",
			classid:"0AB15BD0-37D5-4567-9238-9781EF77E890",
			html_id: "DataControl",
			min_version: "",
			max_version: "2.3.50.19",
			required_version: "2.3.50.19",
			params: {}
		}
	}
};

function GetXpiConfig( _tb_object )
{
	var tsox_el = document.getElementById('tsox_ver_el');
	// this.DEBUG("GetXpiConfig: tsox_el = " + tsox_el);
	if ( tsox_el ) {
		try {
			TBCkElem = document.createElement("TSOX_TBCk");
			document.getElementsByTagName('head')[0].appendChild(TBCkElem);
			TBCkEvt = document.createEvent('Events');
			TBCkEvt.initEvent('TSOX_TBChkHandlerEvent', true, false);
			TBCkElem.dispatchEvent(TBCkEvt);
			(
				function(){
					if ( document.getElementsByTagName("TSOX_TBCk")[0].getAttribute("tbid")==null ){
						setTimeout( arguments.callee,50 );
					} else {
						_tb_object.set_xpi_data( { event: TBCkEvt, element: TBCkElem } );
					}
				}
			)();
		} catch(ERR){
			// this.DEBUG("GetXpiConfig: ERR = " + ERR);
		}
	} else if( this.cookie.config.data != null ) {

	}
}

function hoverButton(btn,pos){
	btn.style.backgroundPosition = pos;
}

function enableToolbar( disableType, successURL ) {
	var url=document.location.href;
	if(typeof(successURL)!="undefined"&&successURL!="undefined"&&successURL!="") url=successURL;
	if(typeof(urchinTracker)=="function")urchinTracker('/toolbar/detect/'+disableType+'/clickenabled');
	if(document.location.href.indexOf("local") != -1 || document.location.href.indexOf("dev") != -1){
		window.location.replace("http://edits.dev.mywebsearch.com/toolbaredits/barenable.jhtml?successURL="+url);
	} else {
		window.location.replace("http://edits.mywebsearch.com/toolbaredits/barenable.jhtml?successURL="+url);
	}
}

function showModal( productCode, partnerId, disableType, successURL ) {
	var wbHtml = new Array();
	wbHtml.push("<div style='color:#009900;font-family:Trebuchet MS;font-weight:bold;font-size:36px;'>Welcome back!</div>");
	wbHtml.push("<div style='color:#333333;font-family:Trebuchet MS;font-weight:bold;font-size:15px;'>To restore access to this free feature, click the button below:</div>");
	wbHtml.push("<div style='margin-top:20px;background-image:url(http://ak.imgfarm.com/images/mindspark/toolbar/yellow_bar.png);width:522px;height:91px;'><div style='float:left;display:inline;margin: 17px 0px 0px 118px; background-image:url(http://ak.imgfarm.com/images/mindspark/toolbar/btn_enable.png);background-position:top;width:285px;height:57px;cursor:pointer;cursor:hand;' onclick='enableToolbar(\""+disableType+"\",\""+successURL+"\")' onmouseover='hoverButton(this,\"bottom\")' onmouseout='hoverButton(this,\"top\")'></div></div>");
	wbHtml.push("<div style='margin-top:25px;color:#333333;font-family:Trebuchet MS;font-weight:bold;font-size:14px;'>How did I lose access?</div>");
	wbHtml.push("<div style='width:500px;color:#333333;font-family:Trebuchet MS;font-size:14px;'>It appears your MyWebSearch toolbar has been disabled. By re-enabling the toolbar, your access to this feature will be instantly restored.</div>");

	var welcomeHtml = new Array();
	welcomeHtml.push("<div style='color:#009900;font-family:Trebuchet MS;font-weight:bold;font-size:36px;'>Welcome!</div>");
	welcomeHtml.push("<div style='color:#333333;font-family:Trebuchet MS;font-weight:bold;font-size:15px;'>To get unlimited access to this free feature, just click the button below:</div>");
	welcomeHtml.push("<div style='margin-top:20px;background-image:url(http://ak.imgfarm.com/images/mindspark/toolbar/yellow_bar.png);width:522px;height:91px;'><div style='float:left;display:inline;margin: 17px 0px 0px 118px; background-image:url(http://ak.imgfarm.com/images/mindspark/toolbar/btn_click_here.png);background-position:top;width:285px;height:57px;cursor:pointer;cursor:hand;' onclick='enableToolbar(\""+disableType+"\",\""+successURL+"\")' onmouseover='hoverButton(this,\"bottom\")' onmouseout='hoverButton(this,\"top\")'></div></div>");
	welcomeHtml.push("<div style='margin-top:25px;color:#333333;font-family:Trebuchet MS;font-weight:bold;font-size:14px;'>How do I access this feature in the future?</div>");
	welcomeHtml.push("<div style='width:500px;color:#333333;font-family:Trebuchet MS;font-size:14px;'>It's easy! By keeping your MyWebSearch toolbar enabled in your browser, you can access this feature directly from your toolbar - from anywhere on the web!</div>");

	var modalHtml = welcomeHtml.join("");
	if(partnerId.indexOf(productCode) != -1 ) {
		modalHtml = wbHtml.join("");
	}

	var oOverlay=document.createElement('div');
	var iDisplayHeight=0;
	iDisplayHeight=Math.max(iDisplayHeight,document.body.offsetHeight);
	iDisplayHeight=Math.max(iDisplayHeight,document.body.scrollHeight);
	iDisplayHeight=Math.max(iDisplayHeight,document.body.parentNode.offsetHeight);
	iDisplayHeight=Math.max(iDisplayHeight,document.body.parentNode.scrollHeight);
	oOverlay.style.height=(iDisplayHeight)+'px';
	var iDisplayWidth=0;
	iDisplayWidth=Math.max(iDisplayWidth,document.body.scrollWidth);
	iDisplayWidth=Math.max(iDisplayWidth,document.body.offsetWidth);
	oOverlay.style.width=(iDisplayWidth)+'px';
	oOverlay.style.backgroundColor = "black";
	oOverlay.style.display = "block";
	oOverlay.style.position = "absolute";
	oOverlay.style.top = "0";
	oOverlay.style.left = "0";
    oOverlay.style.opacity = (75 / 100);
    oOverlay.style.filter = "alpha(opacity=75)";
	document.body.appendChild(oOverlay);

	var oDiv=document.createElement('div');
	oDiv.innerHTML=modalHtml;
	oDiv.style.backgroundImage = "url(http://ak.imgfarm.com/images/mindspark/toolbar/back.png)";
	oDiv.style.backgroundRepeat = "no-repeat";
	oDiv.style.width = "614px";
	oDiv.style.height = "364px";
	oDiv.style.position = "absolute";
	var viewPortWidth = document.body.clientWidth;
	var viewPortHeight = document.body.clientHeight;
	if (self.innerHeight){ // all except Explorer
		viewPortWidth = self.innerWidth;
		viewPortHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		viewPortWidth = document.documentElement.clientWidth;
		viewPortHeight = document.documentElement.clientHeight;
	}
	var scrollT = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	var top = Math.floor(viewPortHeight/2) - 157;//placing in middle minus modal offsetX
	var left = Math.floor(viewPortWidth/2) - 307;//placing in middle minus modal offsetY
	top += scrollT;
	oDiv.style.top = top + "px";
	oDiv.style.left = left + "px";
	oDiv.style.padding = "50px";
	document.body.appendChild(oDiv);

	document.body.style.overflowX = "hidden";
	document.documentElement.style.overflowX = "hidden";
}

