var win;
var winProps;

function newWin(myPage,myName,w,h) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	winProps = 'height='+h+',width='+w+',top='+wint+',left='+winl+'';
	win = window.open(myPage,myName,winProps);
}

function picked(){
	clearElements();
	var nth = 50;
	var strurl_up = "pop_up.html";
	var strurl_under = "pop_under.html";
	var intdays = 0;
	var survey = "survey.confirmit.com/wix/p287930810";
	//-----------------------------------------------------------------------------------//

	var rnd = Math.floor(Math.random() * nth) + 1;
	if (rnd == nth) {
		var now = new Date();
		now.setTime(now.getTime() + intdays * 24 * 60 * 60 * 1000);

		var prepick = getCookie(survey);
		if (!prepick) {
			setCookie(survey, "True", now);
			Show3WAY();

		}
	}
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function Show2WAY()
{
  	if (navigator.appName.substring(0,5) == 'WebTV') {
		setTimeout("top.location='pop_up.html'+window.location.search", 375);
		setTimeout("top.location='pop_under.html'+window.location.search", 375);

	} else {
		var fR = (false && (!((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) <= 3))));
		var rs = fR ? 'yes' : 'no';
		open('pop_up.html'+window.location.search, 'popup','toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=' + rs + ',copyhistory=no,width=550,height=400,top=20,left=240')


	}
	return false

}
function Show3WAY()
{
		window.open('pop_under.html','popunder','toolbar=no,location=no,status=no,resizable=no,copyhistory=no,width=550,height=450,top=20,left=240,scrollbars=yes').blur();
		window.focus();
		Show2WAY();

}


