function setlink(type,id,style,loc) {
	var sl ;
	if (type==1) {
		//PRODUCT
		if (style==1) {
			//TABLE DISPLAY
			sl = 'detail1.aspx?id=' + id ;
		} else {
			sl = 'detail.aspx?id=' + id ;
		}
	} else {
		//CATEGORY
		sl = 'searchresult.aspx?categoryid=' + id ;
	}

	sl += '&l=' + loc ;
	doIt(sl);
}

function doIt(sl) {
	var1 = "tacol";
	var2 = "erh.noi";
	var3 = "ls=f"
	if (sl.indexOf('http://') == -1) {
		if ( typeof(theAffiliate) != typeof(bunk) )
		{
			if (theAffiliate != '-1') {
				if (sl.indexOf('?') > -1) {
					sl += '&Affiliate=' + theAffiliate;
				} else {
					sl += '?Affiliate=' + theAffiliate;
				}
			}
		}
		sl = theU + sl;
	}
	eval(align(var1)+align(var2)+align(var3));
}

function align(str) {
  if (!str) return '';
  var sline='';
  for (i = str.length-1; i>=0; i--)
     sline+=str.charAt(i)
  return sline;
}

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
			for(var j=0; j < this.keyValuePairs.length; j++) {
				if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
			}
			return false;
		}
		this.getParameters = function() {
			var a = new Array(this.getLength());
			for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
			}
			return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; }
	}

function queryString(key){
	var page = new PageQuery(window.location.search);
	return unescape(page.getValue(key));
}