
function popup(Percent)
{
  
  if (document.cookie != null) {
    	
	document.cookie = "name=value";  // cookies enabled?
    	if (document.cookie != "") {

	   var exp = new Date()
	   var RanNum =Math.round(Math.random()*99)+1 

	   var oneYearFromNow = exp.getTime() + (365 * 24 * 60 * 60 * 1000)
	   exp.setTime(oneYearFromNow)

	   var SeenPopup 	= getCookieData("popupSeen")

	   document.forms[0].ranbox.value 	= RanNum

	   document.forms[0].seen.value 	= SeenPopup

	   if (RanNum <= Percent && (SeenPopup == "1" || SeenPopup == "0"))
	   {

		var strURL = document.location;
		document.cookie = "popupSeen=1; expires=" + exp.toGMTString()
		window.open("http://survey.vertical.net/search/default.htm?referer=" + strURL, "Survey","scrollbars,status,resizable,width=640,height=420")
	   }
	}	
  }
}

function getCookieData(label) {
	var labelLen = label.length
	var cLen = document.cookie.length
	var i = 0
	var cEnd
	while (i < cLen) {
		var j = i + labelLen
		if (document.cookie.substring(i,j) == label) {
			cEnd = document.cookie.indexOf(";",j)
			if (cEnd == -1) {
				cEnd = document.cookie.length
			}
			return unescape(document.cookie.substring(j+1,cEnd))
		}
		i++
	}
	return ""
}

function resetCookie()
{
	var exp = new Date()
	var oneYearFromNow = exp.getTime() + (365 * 24 * 60 * 60 * 1000)
	exp.setTime(oneYearFromNow)

	document.cookie = "popupSeen=0; expires=" + exp.toGMTString()

	var SeenPopup 	= getCookieData("popupSeen")
	document.forms[0].seen.value 	= SeenPopup
}
