function generateGuid()
{
var result, i, j;
result = '';
for(j=0; j<32; j++)
{
if( j == 8 || j == 12|| j == 16|| j == 20)
result = result + '-';
i = Math.floor(Math.random()*16).toString(16).toUpperCase();
result = result + i;
}
return result
} 


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function NVSale(id,value)
{


var guid = readCookie('guid');
var host = document.location.hostname;
var protocol = (("https:" == document.location.protocol) ? "https://" : "http://");
var l 
l = protocol + "www.sweatband.com/tracksale.aspx?id=" + id

l = l + "&value=" + value + "&guid=" + guid + "&host="  + host

var i = new Image(1, 1);
i.src = l;
}



function NVTrack(id, productgroupid)
{
var guid = readCookie('guid');
if (guid==null)
{
guid=generateGuid();
createCookie('guid',guid,365)
}

var url = window.location.href;

var ref = document.referrer;

//document.writeln(navigator.userLanguage);
//document.writeln("<br>" );
//document.writeln(navigator.userAgent);
//document.writeln("<br>" );
//document.writeln(navigator.appCodeName  );
//document.writeln("<br>" );
//document.writeln(navigator.appMinorVersion );
//document.writeln("<br>" );
//document.writeln(navigator.appName );
//document.writeln("<br>" );
//document.writeln(navigator.appVersion );
//document.writeln("<br>" );
//document.writeln(screen.width );
//document.writeln("<br>" );
//document.writeln(screen.height );
var host = document.location.hostname;

var protocol = (("https:" == document.location.protocol) ? "https://" : "http://");
var l 


l = protocol + "www.sweatband.com/track3.aspx?id=" + id
//l = protocol + "localhost:50169/track3.aspx?id=" + id

l = l + "&url=" + encodeURIComponent(url) + "&referer=" + encodeURIComponent(ref) + "&guid=" 
+ guid + "&host="  + host + "&r=" + Math.floor(Math.random()*11);

if (productgroupid != undefined){l = l + "&productgroupid=" + productgroupid;}

var i = new Image(1, 1);
i.src = l;

}