// PRA Online Survey cookie routines
// prevents the survey from popping up if:
// a) you have filled in the survey in the last 3 months
// b) you have declined the survey already in the current session.
// #####################################
//  Coded by ACN for AHC 17/04/2003
//  Code base Sourced from Unilever website
//  Supports IE456 NS6/7 MOZ1.3+ NA: ns4.x
//  Does not support Opera 7
// #####################################


// Reads the survey status function cookie
// and launches the survey window if appropriate
function initSurveyCookie() {
	
	// 3mins timer
	var delay = 180000; 

	// get status OUT OF cookie
	var surveyStatus = getCookie("PRASurvey");
	// if flag is not set to " declined" then.. show form in 3mins, else.. don't. 
	if ((surveyStatus != "declined") && (surveyStatus != "submitted")){
		setTimeout ("window.open('survey/survey_popup.php','survey','width=365,height=200,scrollbars=no,resizable=no');",delay);
	}
} // End initSurveyCookie


// Loads a pop up window of fixed and specified dims
// to house the survey.
//  pPage   - string page to load
//  pTarget - string the name of the popup window
function launchSurvey(pageLocation,target){
	var flag = getCookie("PRASurvey");
	if (!"declined"){
		alert("Please note \n\n This personal computer has been used to complete the survey before.\n It is only necessary to submit one survey per person.");
	} 
	window.open(pageLocation,target,'height=500,width=525,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no');
} // End launchSurvey

// Delete the PRASurvey cookie
function nuke(){
	delCookie("PRASurvey");
} // End nuke

//EOF surveyFunctions.js