function fPopWait(hsh) {
	this.Hsh = hsh||{};
    this.formUrl = this.Hsh.formURL || 'default.asp?page=xLeadPop2';
    this.popup;
    this.popupLoaded = false;
    this.debug = false;
    this.constant = this.Hsh.constant||false;
    this.timerHandle = -1;
    this.waitTime = this.Hsh.waitTime==null?100:this.Hsh.waitTime;
    this.destinationUrl = '';
	this.popReceivers=this.Hsh.popReceivers || "ul.dropdown a, ul#nav a";
	var me= this;

    this.onPopupUnload  = function() {
		with(me){
			if (destinationUrl != '') {
				popupLoaded = false;
				try {
					setTimeout(function() { window.location = me.destinationUrl }, me.waitTime);
				} catch (e) { }
			}
		}
    }

    this.onPopupLoad = function () {
		if(me.Hsh.onLoad && typeof(me.Hsh.onLoad)=="function" )
			me.Hsh.onLoad();
        me.popupLoaded = true;
    }

    this.isValidPopup = function(pop) {
        var result;
        try { var url = pop.location.href; result = true; } catch (e) { result = false; }
        return result;
    }
	this.onClick=function (event) {
		with(me){
			if (popupLoaded) return;
			if (debug || me.constant || !(document.cookie.indexOf(me.Hsh.popReceivers||"dspopv1") != -1)) {
				var target = event.srcElement ? event.srcElement : event.originalTarget ? event.originalTarget : event.currentTarget;
				if ((event.which == 1 || (!event.which && event.button == 0)) && target && $(target).attr('href')) {
					me.popup = window.open(formUrl, 'LeadPop', 'top=5,left=15,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=1,width=600,height=750');
					me.onPopupLoad();
					if (isValidPopup(popup)) {
						event.preventDefault();
						destinationUrl = $(target).attr('href');
						popup.focus();
						if(!me.constant)
						{
							var dt = new Date();
							dt.setDate(dt.getDate() + 1)
							document.cookie = (me.Hsh.popReceivers||"dspopv1")+"=1; expires=" + dt.toGMTString();
						}
					}
				}
			}
		}
    }
    $(this.popReceivers).live('click', (me.Hsh.onClick && typeof(me.Hsh.onClick)=="function") ? me.Hsh.onClick : me.onClick);
    $(document).click(function(event) {
        if ((event.which == 1 || (!event.which && event.button == 0)) && me.popupLoaded && me.isValidPopup(me.popup)) {
            me.onPopupUnload();
        }
    });
	return this;
}

