// first determine if there's a cid on the query string.

var theString = new Querystring;
var theCid = theString.get("cid");

if ( theCid != null ) { // a cid has been passed. set the cookie
	createCookie("shoppingEngine",theCid,7);
} 