// JavaScript Document

/*$(document).ready(function () {;
	setTimeout('survey_launch();',4000);
});*/

function survey_launch()
{
	//$('#basicModalContent').modal({overlay:0, close:false});
	var existing_cookie = readCookie('SURVEYS');
	if( existing_cookie != null && existing_cookie.charAt(existing_cookie.length-1) == 0 )
	{
		$('#basicModalContent').modal({overlay:50, close:false});
		/*mark the survey as having been viewed (the seen_survey flag is stored as a 1/0 field on the very end of the cookie*/
		existing_cookie = existing_cookie.substring(0,existing_cookie.length-1) + "1";
		createCookie('SURVEYS',existing_cookie,365*5);
	}
}

function survey_launch_preview(modal_content_div_id)
{
	
	$('#' + modal_content_div_id).modal({overlay:50, close:false});
}

function launchExitSurveyPopup(survey_id,refUrl,fromBackend)
{
	var existing_cookie = readCookie('SURVEYS');
	if( existing_cookie != null && existing_cookie.charAt(existing_cookie.length-1) == 0 )
	{	
		launchExitSurveyPopupPreview(survey_id,refUrl,fromBackend);
	}
}

function launchExitSurveyPopupPreview(survey_id,refUrl,fromBackend)
{
	var url = '/surveys/popup_survey.cfm?survey_id=' + survey_id + '&refurl=' + refUrl;
	if( fromBackend == 1 )
		url = '/private' + url;
	var windowName = 'windowExitSurvey';
	var toolbar = 0;
	var location = 0;
	var status = 0;
	var menubar = 0;
	var directories = 0;
	var resizable = 0;
	var scrollbars = 1;
	var height = 250;
	var width = 600;
	var winExitSurvey = window.open(url,windowName,"toolbar="+toolbar+",location="+location+",directories="+directories+",status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+",width="+width+",height="+height);

}