


/**************************************
 * Copyright 2008 Barkley 
 * Author: Kevin Parker <kparker@barkleyus.com>
 **************************************/
var ip = '38.107.191.85'; 
var check_cookies = true;
var user_survey_offered = 'cc_survey_19_2015_offered'; 
var user_survey_accepted = 'cc_survey_19_2015_accepted'; 
var user_survey_completed = 'cc_survey_19_2015_completed'; 
var user_survey_display_count = '1'; 
var contentStr = ''; 
var surveyURL = 'http://survey.barkleylabs.com/19/2015/flightcheck.htm'; 
var rootURL = 'http://survey.barkleylabs.com/bin/introot/19/2015/'; 
var surveyEnabled = false; 
var marginLeft = '0'; 
var marginTop = '0'; 
var tableWidth = '75%'; 
var divWidth = 550+5; 
var divHeight = 210; 
//var offHeight = (document.body.offsetHeight / 2) + 80; 
var offHeight = 420; 
var offWidth = document.body.offsetWidth; 
var lPos = (offWidth /2)- (divWidth/2); 
var tPos = (offHeight /2)-(divHeight/2); 
divWidth = divWidth + 'px'; 
divHeight = divHeight + 'px'; 
var browser=navigator.userAgent.toLowerCase(); 
var docReferrer = top.document.referrer; 
var isIE = true; 
var isFireFox = false;

INVITE = "<div id=\"wrapper_pane\" style=\"position:absolute;width:" + divWidth + ";left:" + lPos + "px;top:" + tPos + "px;margin-left=" + marginLeft + "px;margin-top=" + marginTop + "px;border-style:solid;border-left-width:1px;border-right-width:1px;border-bottom-width:1px;border-top-width:1px;border-color:#000000;background:#FFFFFF;z-index:200;\">" + "<link href=\"" + rootURL + "css/invite.css\" rel=\"stylesheet\" type=\"text/css\">" + "<table width=\"550\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bordercolor=\"#003399\" bgcolor=\"#FFFFFF\">" + "<tr>" + "<td><table width=\"550\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#000066\">" + "<tr>" + "<td bgcolor=\"#FFFFFF\"><img src=\"" + rootURL + "images/header.gif\"  border=\"0\"></td>" + "</tr>" + "<tr>" + "<td><table width=\"100%\"  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">" + "<tr>" + "<td width=\"48%\">&nbsp;</td>" + "<td width=\"52%\">&nbsp;</td>" + "</tr>" + "<tr>" + "<td rowspan=\"4\"><div align=\"center\"><img src=\"" + rootURL + "images/left_hand.gif\" width=\"164\" height=\"204\"></div></td>" + "<td valign=\"top\"><p class=\"heading\">Thank you for visiting<br>the Minute Rice website. </p></td>" + "</tr>" + "<tr>" + "<td valign=\"top\" class=\"copy\">" + "<table width=\"95%\" border=\"0\"><tr><td valign=\"top\" class=\"copy\">" + "We would like to ask you a few questions to help us improve the website for you and future visitors. Your participation is " + "completely anonymous and the survey will only take you about 5 minutes." + "  You can quit at any time.<br></td>" + "</tr></td></tr></table>" + "<tr>" + "<td valign=\"top\" class=\"copyheader\">Would you like to participate? </td>" + "</tr>" + "<tr>" + "<td valign=\"middle\" class=\"copy\"><div align=\"center\">" + "<table width=\"30%\"  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">" + "<tr>" + "<td><div align=\"center\"><a class=\"link\" href=\"#\" onClick=\"acceptSurvey();return false\" title=\"Click to take our survey.\">Yes</a></div></td>" + "<td><div align=\"center\"><a class=\"link\" href=\"#\" onClick=\"refuseSurvey();return false\" title=\"Click to return to site.\">No</a></div></td>" + "</tr>" + "</table>" + "</div></td>" + "</tr>" + "<tr>" + " <td>&nbsp;</td>" + "<td>&nbsp;</td>" + "</tr>" + "</table></td>" + "</tr>" + "</table></td>" + "</tr>" + "</table>" + "<div id=\"btn_menu\" style=\"position:absolute; width:51px; left:470px; top:17px; visibility:show; height: 19px;;\">" + "<a href=\"#\" onClick=\"refuseSurvey();return false\" style=\"font-family:Arial,Helvetica,sans-serif;font-size:10px;color:#ffffff;text-decoration:underline;\"><img src=\"" + rootURL + "images/close_btn.gif\" alt=\"Close Window\"  border=\"0\" /></a>" + "</div>" + "</div>";


contentStr+= INVITE; 

if (check_cookies)
{
	if ( (getCookie(user_survey_offered) != '1') && (getCookie(user_survey_accepted) == null) )
	{ 
		if (user_survey_display_count == 2)
		{ 
			if (surveyEnabled)
			{ 
				document.write(contentStr);
			}
		}
	}
}
else
{
		if (user_survey_display_count == 2)
		{ 
			if (surveyEnabled)
			{ 
				document.write(contentStr);
			}
		}

}

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
function offerSurvey() { setCookie(user_survey_offered, '1', 120, '/', '', '');}
function acceptSurvey() { setCookie(user_survey_accepted, '1', 120, '/', '', ''); closeInvite(); openSurveyWin();}
function completeSurvey() { setCookie(user_survey_completed, '1', 120, '/', '', '');}
function refuseSurvey() { setCookie(user_survey_accepted, '0', 120, '/', '', ''); closeInvite();}
function showSurvey()
{ }
function popSurvey()
{ if (surveyEnabled)
{ if ( (getCookie(user_survey_accepted) == "1") )
{ if ( (getCookie(user_survey_completed) == null) )
{ openSurveyWin();}
}
}
}
function closeInvite(){ crossobj=ns6? document.getElementById("wrapper_pane") : document.all.wrapper_pane
if (ie4||ns6)
{ crossobj.style.visibility="hidden"
}
else if (ns4)
{ document.wrapper_pane.visibility="hide"
}
}
function openSurveyWin()
{ 
	setCookie(user_survey_completed, '1', 120, '/', '', ''); 
	var sW=screen.Width;
	var sH=screen.Height;
	var windowHandle;
		
	windowHandle = window.open('http://survey.barkleylabs.com/bin/introot/19/2015/cc_loader.jsp?sid=http://survey.barkleylabs.com/19/2015/flightcheck.htm','windowName', 'location=no, resizable=yes, top=40, width=800, height=700,3');	
	
	if (document.all) 
	{
//		   windowHandle.moveTo(0,0);
//		   windowHandle.resizeTo(800,700);
		   windowHandle.focus();
	}
	else if (document.layers||document.getElementById) 
	{
		if (windowHandle.outerHeight<screen.availHeight||windowHandle.outerWidth<screen.availWidth)
		{
			windowHandle.outerHeight = screen.availHeight;
			windowHandle.outerWidth = screen.availWidth;
			windowHandle.moveTo(0,0);
			windowHandle.resizeTo(screen.width,screen.height);
			windowHandle.focus();
		}
	}

}


function setCookie( name, value, expires, path, domain, secure )
{ var today = new Date(); today.setTime( today.getTime() ); if ( expires )
{ expires = expires * 1000 * 60 * 60 * 24;}
var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" );}
function getCookie( name )
{ var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{ return null;}
if ( start == -1 ) return null; var end = document.cookie.indexOf( ";", len ); if ( end == -1 ) end = document.cookie.length; return unescape( document.cookie.substring( len, end ) );}