function DcsDynamicSearch(cid){
	// private members
	var clientId=cid;
	var cname="WT_DSAI";
	var wt=(typeof(WT)=="object")?WT:{};

	// private methods
	function SetAdInfo(){
		var value=GetQueryParam("cshift_ck");
		if (value.length>0){
			var cur=new Date();
			var exp=new Date(cur.getTime()+315360000000);
			document.cookie=cname+"="+value+"; expires="+exp.toGMTString()+"; path=/";
		}
	}
	function GetQueryParam(key){
		var qry=window.location.search.substring(1);
		if (qry.length>0){
			var params=qry.split("&");
			var count=params.length;
			for (var i=0;i<count;i++){
				var p=params[i].split("=");
				if (p[0]==key){
					return p[1];
				}
			}
		}
		return "";
	}

	// privileged methods
	this.GetClientId=function(){
		return clientId;
	};
	this.GetProductInfo=function(){
		var info="";
		try{
			var id=wt.tx_sku.split(";");
			var price=wt.tx_s.split(";");
			var qty=wt.tx_u.split(";");
			for (var i=0;i<id.length;i++){
				info+=(i?",":"")+id[i]+"#"+((parseFloat(price[i])*100)/parseInt(qty[i]))+"*"+qty[i];
			}
		}
		catch(e){
		}
		return info;
	};
	this.GetOrderInfo=function(){
		return wt.tx_i||"";
	};
	this.GetIsNew=function(){
		return 1;
	};
	this.GetAdInfo=function(){
		return dcsGetCookie(cname)||"";
	};
	this.GetAttribution=function(){
		return "";
	};
	this.IsConvPage=function(){
		return ((typeof(wt)=="object")&&(typeof(wt.tx_sku)=="string"))?true:false;
	};

	// read query parameter, set cookie
	SetAdInfo();
}

//WTDS account
var dcsDS=new DcsDynamicSearch(3194);
if (dcsDS.IsConvPage()){
	f2convert(dcsDS.GetClientId(),dcsDS.GetProductInfo(),dcsDS.GetOrderInfo(),dcsDS.GetIsNew(),dcsDS.GetAdInfo());
}
