var ADM_formatPostTAGString = function(str)
{
	var principal = str.split("||"), secundario,data = [], names = {}, ret = '';
	for(var i=0; i<principal.length; i++)
	{
		secundario = principal[i].split("**");
		var nombre = secundario[0].replace(/[\W]/g, "").substring(0, 15);
		if(names[nombre]!=undefined)
			names[nombre]++;
		else
			names[nombre]=1;
		data.push({name: nombre, value: escape(secundario[1].substring(0, 40)), id: names[nombre]});
	}
	for(i=0; i<data.length; i++)
		ret += data[i].name + (names[data[i].name] > 1 ? data[i].id : '') + '!' + data[i].value + '|';
	return ret.substring(0, ret.length-1);
}

var ADM_callPostTAG = function(_ptCode, _ptValue, _ptStrings){
	if (_ptCode)
	{
		window['ADM_post_'+_ptCode] = new Image();
		var ptURL = 'http://ia.nspmotion.com/ptag/?pt='+_ptCode+'&r=' + Math.round(Math.random()*9999);
		if (_ptValue)
			ptURL += '&v='+_ptValue;
		if (_ptStrings){
			_ptStrings = ADM_formatPostTAGString(_ptStrings);
			ptURL += '&cvalues='+ _ptStrings.replace(/%/g,'$');
		}
		window['ADM_post_'+_ptCode].src = ptURL;
	}
}