var sb={
	tags: [], //this sets up a place holder for the tags
	id: 0,
	cv: "n",
	domain: "www.dialogmgr.com",
	https: false,
	url: "tag/tag",
	v_id: 0,
	ScriptTag: null,
	referrer: "",
	params: [],

	SetTags: function() {
		this.domain=this.domain.replace(/^\s+|\s+$/g,"");
		if (this.https) {
			this.url="https://"+this.domain+"/"+this.url;
		} else {
			this.url="http://"+this.domain+"/"+this.url;
		}

		if (this.tags!=null && this.tags.length>0) {
			this.url+="?";
			for (i=0; i<this.tags.length; i++) {
				this.url+="tags[]="+this.tags[i]+"&";
			}
			this.url += "id="+this.id ;
			if( this.cv ) {
				this.url += "&cv="+this.cv ;
			} else {
				this.url += "&cv=n";
			}
			if( this.pf ) {
				this.url += "&pf="+this.pf ;
			}
			if (this.v_id>0) {
				this.url+="&v_id="+this.v_id;
			}
            for (i=0; i< this.params.length; i++) {
                this.params[i]=this.params[i].replace(/\+/g, "ADD");
            }
			if (this.params.length>0) {
				this.url+="&"+this.params.join("&");
			}

			if (this.referrer=="") {
				if (document.referrer!="") {
					this.url+="&referrerURL="+escape(document.referrer);
				}
			} else {
				this.url+="&referrerURL="+escape(this.referrer);
			}

			this._SendTags();
		} else {
			return false;
		}
	},

	LinkTags: function(tags) {
		this._ResetObj();
		this.tags=tags;
		this.SetTags();
		return true;
	},

	SetTagsList: function(sbtagslist) {
		var CurPath=window.location.pathname;
		for (domain in sbtagslist) {
			var domain_tags={};
			var sbtagslist_domain=sbtagslist[domain];
			for (path in sbtagslist_domain) {
				var sbtagslist_domain_path=sbtagslist_domain[path];
				if (CurPath.indexOf(path)>0) {
					for (i=0; i<sbtagslist_domain_path.length; i++) {
						domain_tags[sbtagslist_domain_path[i]]=1;
					}
				}
			}
			for (tag in domain_tags) {
				this.tags=this.tags.concat(tag);
			}
			this.domain=domain;
			this.SetTags();
			this._ResetObj();
		}
	},

	_ResetObj: function() {
		this.url="tag/tag.php";
		this.tags=[];
		this.ScriptTag=null;
	},

	_SendTags: function() {
		var e = document.createElement("script");
		e.src=this.url;
		e.type="text/javascript";
		this.ScriptTag=e;
		document.getElementsByTagName("head")[0].appendChild(e);
	},

	_CleanUp: function() {}
}