function RemoveBad(InStr){
	typeInStr = typeof InStr;
	if ((InStr == "") || (typeInStr == 'undefined'))  {
		InStr = "MissingValue";
	} else {	
	    InStr = InStr.replace(/\W/g,"");
	}
	return InStr;
}

var Accept_Values = new Array("P_FormId", "P_Site", "P_Vanity", "P_Campaign", "P_Creative");
var splitUrl = document.location.href.split("?");
var str = splitUrl[1];
var tmp2 = "=";
var newstr = "";
var flag_nomatch = 0;

if (str != null) {
	var val = str.split("&");
//alert("val= " +val);
	for(i=0;i<val.length;i++){
//alert("val-length= " +val[i].length);
		if (val[i].length==0) {
		}
		else {
	    var tmp = val[i].indexOf(tmp2);
		if (tmp != -1) {
			var nvpair = val[i].split("=");
		} 
		else {
			val[i] = val[i] + "=MissingValue";
			var nvpair = val[i].split("=");
		}	
		}
		
//alert("nvpair= " +nvpair);			
		var no_match = 0;
		type = typeof nvpair;
		if (type == 'undefined') {
			flag_nomatch = 1;
		} else {		
			for(j=0;j<Accept_Values.length;j++){
				if(nvpair[0] != Accept_Values[j]){
					no_match++;
				}
				if (no_match == Accept_Values.length) {
					flag_nomatch = 1;
				}	
			}
			if(no_match < Accept_Values.length){
				nvpair[1] = RemoveBad(nvpair[1])
			    if ((i == 0) || (flag_nomatch == 1)) {
					newstr += (nvpair[0] + "=" + nvpair[1]);
					flag_nomatch = 0;
			    } else {
					newstr += ("&" + nvpair[0] + "=" + nvpair[1]);
				}
			}
	 	}	
	}
}
//alert("newstr= " + newstr);
if (newstr) {
	document.write('<img src=\"/innovation/us/ondemand.wss/tracking?'
	+ 'contid='
	+ document.tracking.contentid.value
	+ '&'
	+ 'contversion='
	+ document.tracking.contversion.value
	+ '&'
	+ 'locale='
	+ document.tracking.locale.value
	+ '&'
	+ newstr 
	+ '\" height=\"1\" width=\"1\" alt=\"\" />');
}
else {
	document.write('<img src=\"/innovation/us/ondemand.wss/tracking?'
	+ 'contid='
	+ document.tracking.contentid.value
	+ '&'
	+ 'contversion='
	+ document.tracking.contversion.value
	+ '&'
	+ 'locale='
	+ document.tracking.locale.value
	+ '\" height=\"1\" width=\"1\" alt=\"\" />');
}
