function cpnhotAdd(ADID,LOCID) {
    var CookieString = document.cookie;
    var CookieSet = CookieString.split (';');
    var SetSize = CookieSet.length;
    var CookiePieces
    var ReturnValue = "";
    var x = 0;
	var expiredays = 30 // set the max number of days for cookie here
	var ExpireDate = new Date ();
  	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
    for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++){
		CookiePieces = CookieSet[x].split ('=');
    	if (CookiePieces[0].substring (0,1) == ' '){
        	CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
      	}
      	if (CookiePieces[0] == "CPNHOT"){ //cpnhot IS THE NAME OF THE COOKIE THAT YOU WANT TO RETRIEVE
        	ReturnValue = CookiePieces[1];
      	}
    }	 		  
	if(ReturnValue != ""){
		var ListA = unescape(ReturnValue);
		if (ListA == "undefined" || ListA.length == 0){
			ListA = "";
			var ListB = ADID + '|' + LOCID;
		}
		else{
			ListA = ListA;
			var ListB = ListA + ',' + ADID + '|' + LOCID;//adid id number will go inplace of 22
		} 
		document.cookie = "CPNHOT" + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
		document.cookie = "CPNHOT" + "=" + escape(ListB) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
	}
	else{
		document.cookie = "CPNHOT" + "=" + ADID + '|' + LOCID + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
	}									
 }
 
 
 function cpnhotDel(ADID) {
    var CookieString = document.cookie;
    var CookieSet = CookieString.split (';');
    var SetSize = CookieSet.length;
    var CookiePieces
    var ReturnValue = "";
    var x = 0;
	var expiredays = 30 // set the max number of days for cookie here
	var ExpireDate = new Date ();
  	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
    for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++){
    	CookiePieces = CookieSet[x].split ('=');
      	if (CookiePieces[0].substring (0,1) == ' '){
        	CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
     	}
      	if (CookiePieces[0] == "CPNHOT"){ //cpnhot IS THE NAME OF THE COOKIE THAT YOU WANT TO RETRIEVE
        	ReturnValue = CookiePieces[1];
      	}
    }
	if(ReturnValue != ""){
		var ListA = unescape(ReturnValue);
		rgsetup = ADID + "\\|[0-9]+";
		rg = new RegExp (rgsetup, "g");
		tempa = ListA.replace(rg, '');
		tempb = tempa.replace(/,,/g,',');
		tempc = tempb.replace(/,$/,'');
		tempd = tempc.replace(/^,/,'');
		if (tempd != ""){
			document.cookie = "CPNHOT" + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
			document.cookie = "CPNHOT" + "=" + escape(tempd) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
		}
		else if (tempd == ""){
		 	document.cookie = "CPNHOT" + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
		}
	}
 }