
//** COPYRIGHT 2005 - Clickpath Media, Inc. **

/**
 * Read the JavaScript cookies tutorial at:
 *   http://www.netspade.com/articles/javascript/cookies.xml
 */

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
/*
 * Perform a javascript replace (capable of reg expressions)
 */
function JSreplace(Source,regex,ReplaceWith)
{
	var re = new RegExp(regex,"g");
	var result = Source.replace(re,ReplaceWith);
	return result;
}
//
// QueryString
//

function RObj(ea){
	var LS="";
	var QS=new Object();
	var un="undefined";
	var f="function";
	var n="number";
	var r="string";
	var e1="ERROR:Index out of range in\r\nRequest.QueryString";
	var e2="ERROR:Wrong number of arguments or invalid property assignment\r\nRequest.QueryString";
	var e3="ERROR:Object doesn't support this property or method\r\nRequest.QueryString.Key";
function Err(arg){
	if(ea) alert("Request Object:\r\n"+arg)
};
function URID(t){
	var d="";
	if(t){
		for(var i=0;i<t.length;++i){
			var c=t.charAt(i);
			d+=(c=="+"?" ":c);
		};
	};
	return unescape(d);
};
function OL(o){
	var l=0;
	for(var i in o){
		if(typeof(o[i])!=f) l++;
	};
	return l;
};
function AK(key){
	var auk=true;
	for(var u in QS){
		if(typeof(QS[u])!=f&&u.toString().toLowerCase()==key.toLowerCase()){
			auk=false;
			return u;
		}
	};
	if(auk){
		QS[key]=new Object();
		QS[key].toString=function(){
			return TS(QS[key])
		};
		QS[key].Count=function(){
			return OL(QS[key])
		};
		QS[key].Count.toString=function(){
			return OL(QS[key]).toString()
		};
		QS[key].Item=function(e){
			if(typeof(e)==un) 
				return QS[key];
			else {
				if(typeof(e)==n){
					var a=QS[key][Math.ceil(e)];
					if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");
					return a;
				}
				else Err("ERROR:Expecting numeric input in\r\nRequest.QueryString(\""+key+"\").Item(\""+e+"\")");
			}
		};
		QS[key].Item.toString=function(e){
			if(typeof(e)==un) return QS[key].toString();
			else {
				var a=QS[key][e];
				if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");
				return a.toString();
			};
		};
		QS[key].Key=function(e){
			var t=typeof(e);
			if(t==r){
				var a=QS[key][e];
				return(typeof(a)!=un&&a&&a.toString()?e:"");
			}
			else Err(e3+"("+(e?e:"")+")");
		};
		QS[key].Key.toString=function(){
			return un
		};
	};
	return key
};
function AVTK(key,val){
	if(key!=""){
		var key=AK(key);
		var l=OL(QS[key]);
		QS[key][l+1]=val;
	}
};
function TS(o){
	var s="";
	for(var i in o){
		var ty=typeof(o[i]);
		if(ty=="object") s+=TS(o[i]);
		else if(ty!=f) s+=o[i]+", ";
	};
	var l=s.length;
	if(l>1)return(s.substring(0,l-2));
	return(s==""?un:s);
};
function KM(k,o){
	var k=k.toLowerCase();
	for(var u in o){
		if(typeof(o[u])!=f&&u.toString().toLowerCase()==k) return u;
	};
}
//if(window.location&&window.location.search){
//	LS=window.location.search;
if(top.document.location&&top.document.location.search){
	LS=top.document.location.search;
	var l=LS.length;
	if(l>0){
		LS=LS.substring(1,l);
		var preAmpAt=0;
		var ampAt=-1;
		var eqAt=-1;
		var k=0;
		var skip=false;
		for(var i=0;i<l;++i){
			var c=LS.charAt(i);
			if(LS.charAt(preAmpAt)=="="||(preAmpAt==0&&i==0&&c=="=")) skip=true;
			if(c=="="&&eqAt==-1&&!skip) eqAt=i;
			if(c=="&"&&ampAt==-1){
				if(eqAt!=-1) ampAt=i;
				if(skip) preAmpAt=i+1;
				skip=false;
			};
					if(ampAt>eqAt){
				AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,ampAt)));
				preAmpAt=ampAt+1;
				eqAt=ampAt=-1;++k;
			};
		};
		if(LS.charAt(preAmpAt)!="="&&(preAmpAt!=0||i!=0||c!="=")){
			if(preAmpAt!=l){
				if(eqAt!=-1) AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,l)));
				else if(preAmpAt!=l-1) AVTK(URID(LS.substring(preAmpAt,l)),"");
			};
			if(l==1) AVTK(LS.substring(0,1),"");
		};
	};
};
var TC=OL(QS);
if(!TC) TC=0;
QS.toString=function(){
	return LS.toString()
};
QS.Count=function(){
	return(TC?TC:0)
};
QS.Count.toString=function(){
	return(TC?TC.toString():"0")
};
QS.Item=function(e){
	if(typeof(e)==un) return LS;
	else {
		if(typeof(e)==n){
			var e=Math.ceil(e);
			var c=0;
			for(var i in QS){
				if(typeof(QS[i])!=f&&++c==e) return QS[i];
			};
			Err(e1+"().Item("+e+")");
		}else return QS[KM(e,QS)];
	};
	return un;
};
QS.Item.toString=function(){
	return LS.toString()
};
QS.Key=function(e){
	var t=typeof(e);
	if(t==n){
		var e=Math.ceil(e);
		var c=0;
		for(var i in QS){
			if(typeof(QS[i])!=f&&++c==e) return i;
		}
	}else if(t==r){
		var e=KM(e,QS);
		var a=QS[e];
		return(typeof(a)!=un&&a&&a.toString()?e:"");
	}else 		Err(e2+"().Key("+(e?e:"")+")");
	Err(e1+"().Item("+e+")");
};
QS.Key.toString=function(){
	Err(e2+"().Key");
};
this.QueryString=function(k){
	if(typeof(k)==un) return QS;
	else {
		var k=KM(k,QS);
		if(typeof(QS[k])==un){
			t=new Object();
			t.Count=function(){
				return 0
			};
			t.Count.toString=function(){
				return "0"
			};
			t.toString=function(){
				return un
			};
			t.Item=function(e){
				return un
			};
			t.Item.toString=function(){
				return un
			};
			t.Key=function(e){
				Err(e3+"("+(e?e:"")+")");
			};
			t.Key.toString=function(){
				return un
			};
			return t;
		}
		if(typeof(k)==n) return QS.Item(k);
		else return QS[k];
	}
};
this.QueryString.toString=function(){
	return LS.toString();
};
this.QueryString.Count=function(){
	return(TC?TC:0)
};
this.QueryString.Count.toString=function(){
	return(TC?TC.toString():"0")
};
this.QueryString.Item=function(e){
	if(typeof(e)==un) return LS.toString();
	else {
		if(typeof(e)==n){
			var e=Math.ceil(e);
			var c=0;
			for(var i in QS){
				if(typeof(QS[i])!=f&&++c==e) return QS[i];
			};
			Err(e1+".Item("+e+")");
		}else return QS[KM(e,QS)];
	}if(typeof(e)==(n)) Err(e1+".Item("+e+")");
	return un;
};
this.QueryString.Item.toString=function(){
	return LS.toString()
};
this.QueryString.Key=function(e){
	var t=typeof(e);
	if(t==n){
		var e=Math.ceil(e);
		var c=0;
		for(var i in QS){
			if(typeof(QS[i])=="object"&&(++c==e)){
				return i;
			}
		}
	}else if(t==r){
		var e=KM(e,QS);
		var a=QS[e];
		return(typeof(a)!=un&&a&&a.toString()?e:"");
	}else Err(e2+".Key("+(e?e:"")+")");
	Err(e1+".Item("+e+")");
};
this.QueryString.Key.toString=function(){
	Err(e2+".Key");
};
this.Version=1.2;
this.Author="TC (www.121crossmedia.com)";
};
var Request=new RObj(false);

//
// end querystring
//


var cpao
var cpca
var cpag
var cptl
var cpkw
var CPMnewvisit = "0";
var CPMsession = "0";
var CPMclickthru = "0";
var CPMovkey
var CPMovmtc
var CPMovraw
var cpns=(navigator.appName=="Netscape");
var cpie=(navigator.appName.substring(0,9)=="Microsoft");
var cpdt=new Date();



var cpip
cpip = '64.180.34.134';

if (typeof CPBlockList == 'undefined') {
	var CPBlockList = new String('');
} else {
	CPBlockList = new String(CPBlockList);
}

if (CPBlockList.indexOf(cpip) == -1) {



if( typeof CPMCookies == 'undefined') {
	var CPMCookies = 'true';
}

if (CPMCookies != 'false') {
	CPMCookies = 'true';
}

if (CPMCookies == 'true') {
	document.cookie="CPc=yes";
	if (getCookie("CPc") == null) {
		CPMCookies = 'false';
	}
}



if( typeof PAGERESULT == 'undefined') {
	var PAGERESULT = '888';
}
if( typeof CPMSTEPVAL == 'undefined') {
	var CPMSTEPVAL = '888';
}
if( typeof CPMPAGEVAL == 'undefined') {
	var CPMPAGEVAL = '0.00';
}


var CPAOparam
if (typeof CPAOoverride == 'undefined') {
	CPAOparam = 'cpao';
} else {
	CPAOparam = CPAOoverride;
}

var CPCAparam
if (typeof CPCAoverride == 'undefined') {
	CPCAparam = 'cpca';
} else {
	CPCAparam = CPCAoverride;
}

var CPAGparam
if (typeof CPAGoverride == 'undefined') {
	CPAGparam = 'cpag';
} else {
	CPAGparam = CPAGoverride;
}

var CPTLparam
if (typeof CPTLoverride == 'undefined') {
	CPTLparam = 'cptl';
} else {
	CPTLparam = CPTLoverride;
}

var CPKWparam
if (typeof CPKWoverride == 'undefined') {
	CPKWparam = 'kw';
} else {
	CPKWparam = CPKWoverride;
}



var CPMscc
var CPMsccarr = new Array();

CPMscc = new String(Request.QueryString('scc'));
if (CPMscc == 'undefined') {
	cpao = new String(Request.QueryString(CPAOparam));
	if (cpao == 'undefined') {
		cpca = '888';
		cpag = '888';
		cptl = '888';
		CPMovkey = new String(Request.QueryString('OVKEY'));
		CPMovmtc = new String(Request.QueryString('OVMTC'));
		CPMovmtc = CPMovmtc.toLowerCase();
		CPMovraw = new String(Request.QueryString('OVRAW'));
		switch(CPMovmtc) {
			case 'content':
				cpao = '110';
				cpkw = CPMovkey;
				break;
			case 'standard':
				cpao = '112';
				cpkw = CPMovkey;
				break;
			case 'advanced':
				cpao = '112';
				cpkw = CPMovkey;
				break;
			default:
				cpao = '888';
				break;
		}
	}
	else {
		cpca = Request.QueryString(CPCAparam);
		cpag = Request.QueryString(CPAGparam);
		cptl = Request.QueryString(CPTLparam);
	}
} else  {
	CPMsccarr = CPMscc.split('|');
	cpao = CPMsccarr[1];
	cpca = CPMsccarr[2];
	cpag = CPMsccarr[3];
	cptl = CPMsccarr[4];
}

if (typeof cpkw == 'undefined') {
	cpkw = Request.QueryString(CPKWparam);
}

if (cpao == 'undefined' || cpao == '') {
	cpao = '888';
}

if (cpkw == '') {
	cpkw = 'undefined';
}


if (typeof CPAOvalue != 'undefined') {
	cpao = CPAOvalue;
}

if (typeof CPCAvalue != 'undefined') {
	cpca = CPCAvalue;
}

if (typeof CPAGvalue != 'undefined') {
	cpag = CPAGvalue;
}

if (typeof CPKWvalue != 'undefined') {
	cpkw = CPKWvalue;
}



var CPurl = "http://merchantwarehouse.com/";
var CPbd
var CPcp
var CPep
var CPrd

if (CPurl.indexOf("http://") == -1) {
	CPurl = top.document.location;
}
CPurl = CPurl + "?";

if (CPurl.length > 0) {
	var CPurlarray = new Array();

	CPurlarray = CPurl.split('/');

	CPbd = CPurlarray[2] + "?";
	CPbd = CPbd.substring(0,CPbd.indexOf('?'));

	var reCPIPaddress = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
	var isCPIPaddress = reCPIPaddress.exec(CPbd);
	if (isCPIPaddress) {
		CPrd = CPbd;
	} else {
		CPrd = CPbd.substring(CPbd.substring(0,CPbd.lastIndexOf('.')).lastIndexOf('.')+1,CPbd.length);
	}

	CPcp = CPurl.substring(CPurl.indexOf('//')+2,CPurl.length);
	CPcp = CPcp.substring(CPcp.indexOf('/'),CPcp.length);
	CPcp = CPcp.substring(0,CPcp.indexOf('?'));
	if (CPcp == CPbd) {
		CPcp = "/";
	}
	CPep = CPcp;
}



var CPref = document.referrer;

if (CPref.indexOf("http://") == -1) {
	CPref = "";
}

if (CPref.substring(0,(CPref+'?').indexOf('?')).indexOf(CPrd) != -1) {
	CPref = "";
}



if (cpao == 'undefined' || cpao == '') {
	cpao = '888';
}
if (cpca == 'undefined' || cpca == '') {
	cpca = '888';
}
if (cpag == 'undefined' || cpag == '') {
	cpag = '888';
}
if (cptl == 'undefined' || cptl == '') {
	cptl = '888';
}
if (cpkw == '') {
	cpkw = 'undefined';
}
if (CPep == '') {
	CPep = 'undefined';
}
if (CPref == '') {
	CPref = 'undefined';
}
if (CPbd == '') {
	CPbd = 'undefined';
}
if (CPcp == '') {
	CPcp = 'undefined';
}



var CPlc = getCookie("CPl"+CPMACCOUNTID);
if (CPlc != null) {
	var CPlca = CPlc.split("|");
}
var CPsc = getCookie("CPs"+CPMACCOUNTID);
if (CPsc != null) {
	var CPsca = CPsc.split("|");
}

if (CPsc == null) {
	CPMsession = "1";
	CPMclickthru = "1";
} else {
	//use cookie if session values match
	if (cpao == unescape(CPsca[0]) && unescape(JSreplace(String(cpca),"[\+]"," ")) == unescape(JSreplace(String(CPsca[1]),"[\+]"," ")) && unescape(JSreplace(String(cpag),"[\+]"," ")) == unescape(JSreplace(String(CPsca[2]),"[\+]"," ")) && unescape(JSreplace(String(cpkw),"[\+]"," ")) == unescape(JSreplace(String(CPsca[4]),"[/+]"," ")) && unescape(JSreplace(String(CPref),"[\+]"," ")) == unescape(JSreplace(String(CPsca[5]),"[\+]"," "))) {
		CPMclickthru = "0";
		cpao = unescape(CPsca[0]);
		cpca = unescape(CPsca[1]);
		cpag = unescape(CPsca[2]);
		cptl = unescape(CPsca[3]);
		cpkw = unescape(CPsca[4]);
		CPref = unescape(CPsca[5]);
		CPep = unescape(CPsca[6]);
	} else {
		if (cpao == '888') {
			cpao = unescape(CPsca[0]);
			cpca = unescape(CPsca[1]);
			cpag = unescape(CPsca[2]);
			cptl = unescape(CPsca[3]);
			cpkw = unescape(CPsca[4]);
			CPref = unescape(CPsca[5]);
			CPep = unescape(CPsca[6]);
			CPMclickthru = "0";
		} else {
			CPMclickthru = "1";
		}
	}
}



if (CPlc == null) {
	CPMnewvisit = "1";
} else {
	if (cpao == "888" && cpkw == "undefined" && CPref == "undefined" && CPMCookies == 'true') {
		cpao = unescape(CPlca[0]);
		cpca = unescape(CPlca[1]);
		cpag = unescape(CPlca[2]);
		cptl = unescape(CPlca[3]);
		cpkw = unescape(CPlca[4]);
		CPref = unescape(CPlca[5]);
		CPep = unescape(CPlca[6]);
	}
}

document.write('<SCR' + 'IPT type="text/javascript" LANGUAGE="JavaScript" SRC="');
document.write(CPMUrl + '/JS/DNI_Q.js');
document.write('?aid=' + CPMACCOUNTID);
document.write('&ip=' + escape(cpip));
document.write('&ao=' + escape(cpao));
document.write('&ca=' + escape(cpca));
document.write('&ag=' + escape(cpag));
document.write('&tl=' + escape(cptl));
document.write('&kw=' + escape(cpkw));
document.write('&pr=' + PAGERESULT);
document.write('&pv=' + CPMPAGEVAL);
if( typeof CPMSessionOverride != 'undefined') {
	document.write('&sid=' + escape(CPMSessionOverride));
}
if (typeof CPMOffices != 'undefined') {
	var CPMDelimOfficeList = '';
	for (CPofc in CPMOffices) CPMDelimOfficeList = CPMDelimOfficeList + CPofc + '|';
	CPMDelimOfficeList = CPMDelimOfficeList.substring(0,CPMDelimOfficeList.length-1);
	document.write('&ofc=' + escape(CPMDelimOfficeList));
}
document.write('&clk=' + CPMclickthru);
document.write('&new=' + CPMnewvisit);
document.write('&ses=' + CPMsession);
document.write('&bd=' + escape(CPbd));
document.write('&cp=' + escape(CPcp));
document.write('&ep=' + escape(CPep));
document.write('&ref=' + escape(CPref));
document.write('&co=' + ((CPMCookies=='true')?'Y':'N'));
document.write('&la=' + escape(cpns?navigator.language:navigator.userLanguage));
document.write('&ja=' + escape((navigator.javaEnabled()?'Y':'N')));
document.write('&sr=' + escape(screen.width+'x'+screen.height));
document.write('&cd=' + escape((cpie)?screen.colorDepth:screen.pixelDepth));
document.write('&tz=' + cpdt.getTimezoneOffset());
document.write('&ua=' + escape(navigator.userAgent));
document.write('&pl=' + escape(navigator.platform));
document.write('&an=' + escape(navigator.appName));
document.write('"><\/SC' + 'RIPT>');

} //end ip blocking




top.status=defaultStatus;