// ---VERSION: 20050606------------------------------------

// ---SETUP VARIABLES--------------------------------------

var TheURLa = "http://www.sprint.com/business/scripts/survey/stepchild_2.html"; 	//<--SET THIS TO THE URL OF THE CHILD WINDOW
var TheURLb = "http://www.sprint.com/business/scripts/survey/stepchild5_2.html"; 	//<--SET THIS TO THE URL OF THE CHILD WINDOW FOR IE5 AND ABOVE
var expDays = 45; 				//<--SET THIS TO EXPIRE COOKIE IN WHATEVER # OF DAYS
var Path = "/";				//<--SET THIS TO THE COOKIE PATH
var Dom = null;				//<--SET THIS TO THE COOKIE DOMAIN
var Mode = 2; 					//<--SET THIS TO 1 TO MAKE IT POPUP EVERYTIME FOR TESTING - BACK TO 2 FOR ONE TIME POPUP ONLY
var Chance = 10; 				//<--SET THIS TO THE TOP OF THE CHANCE EQUATION. FOR A 1 IN 100 CHANCE SET IT TO 100

// ---INITIALIZATION---------------------------------------

var exp = new Date();

if (Roulette() == 1){

	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

	if (!GetCookie('survey')) { //CHECKS IF COOKIES ARE ON

		SetCookie('survey','1',exp,Path,Dom);

		if (GetCookie('survey') != null) {

			if (GetCookie('survey') == 2) {

				SetCookie('survey',Mode,exp,Path,Dom);

			} else {

				PopuP();
				SetCookie('survey',Mode,exp,Path,Dom);
			}
		}

	} else if (GetCookie('survey') != "2") {

		PopuP();
		SetCookie('survey',Mode,exp,Path,Dom);

	} else {

		SetCookie('survey',Mode,exp,Path,Dom);
	}
}

// ---FUNCTIONS--------------------------------------------

function PopuP () { //OPENS THE CHILD WINDOW

	//IE VERSION IDENTIFICATION. THE stepchild5 SCRIPT DOES NOT WORK WITH IE VERSIONS BELOW 5 OR NS
	var BrowserString = navigator.appName + " " + navigator.appVersion; SetCookie('tm','x1y2zf7',exp,Path,Dom);
	if (BrowserString.indexOf("MSIE 3") > -1) {var IE5 = "below" } else if (BrowserString.indexOf("MSIE 4") > -1) {var IE5 = "below";} else if (BrowserString.indexOf("MSIE 5") > -1) {var IE5 = "above";} else if (BrowserString.indexOf("MSIE 6") > -1) {var IE5 = "above";} else if (BrowserString.indexOf("MSIE 6") > -1) {var IE5 = "above";} else if (BrowserString.indexOf("MSIE 7") > -1) {var IE5 = "above";} else {var IE5 = "below";}
	if (IE5 == "above") {
 		var StepChild = window.open(TheURLb, "baby", "width=1,height=1,top=6000,left=6000");
 	} else {
 		var StepChild = window.open(TheURLa, "baby", "width=1,height=1,top=6000,left=6000");
 	}
}

function GetCookie(name) { //GETS THE COOKIE VALUE FROM THE BROWSER
	var StartpoinT = document.cookie.indexOf(name+"=");
	var NameLenghT = StartpoinT+name.length+1;
	if ((!StartpoinT) && (name != document.cookie.substring(0,name.length))) return null;
	if (StartpoinT == -1) return null;
	var EnD = document.cookie.indexOf(";",NameLenghT);
	if (EnD == -1) EnD = document.cookie.length;
	return unescape(document.cookie.substring(NameLenghT,EnD));
}

function SetCookie (name, value) { //THIS FORMATS AND SETS THE COOKIE IN THE BROWSER
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

function Roulette() {
	return Math.floor( 1 + Math.random() * Chance);
}

// ---Copyright� 2005 By Survey.com. All Rights Reserved.--
