


/**************************************
 * Copyright 2008 Barkley 
 * Author: Kevin Parker <kparker@barkleyus.com>
 **************************************/
var ip = '38.107.191.111'; 
var check_cookies = true;
var user_survey_offered = 'cc_survey_29_2032_offered'; 
var user_survey_accepted = 'cc_survey_29_2032_accepted'; 
var user_survey_completed = 'cc_survey_29_2032_completed'; 
var user_survey_display_count = '1'; 
var contentStr = ''; 
var surveyURL = 'http://survey.barkleylabs.com/29/2032/flightcheck.htm'; 
var rootURL = 'http://survey.barkleylabs.com/bin/introot/29/2032/'; 
var surveyEnabled = false; 
var marginLeft = '0'; 
var marginTop = '0'; 
var tableWidth = '75%'; 
var divWidth = 500; 
var divHeight = 210; 
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=\"500\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\" bordercolor=\"#999999\">" +
"  <tr>" +
"    <td><table width=\"100%\"  border=\"0\">" +
"      <tr>" +
"        <td width=\"33%\">&nbsp;</td>" +
"        <td width=\"33%\" valign=\"top\"><div align=\"center\"><img src=\"" + rootURL + "images/header.png\"></div></td>" +
"        <td width=\"33%\" align=\"right\"><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.png\" alt=\"Close Window\"  border=\"0\" /></a></div></td>" +
"      </tr>" +
"    </table>" +
"      <table width=\"75%\"  border=\"0\" align=\"center\">" +
"        <tr>" +
"          <td>&nbsp;</td>" +
"        </tr>" +
"        <tr>" +
"          <td><div align=\"center\"><span class=\"ccHeading\">Thank you for visiting our website. </span></div></td>" +
"        </tr>" +
"        <tr>" +
"          <td><div align=\"center\"></div></td>" +
"        </tr>" +
"        <tr>" +
"          <td><span class=\"ccCopy\">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.</span></td>" +
"        </tr>" +
"        <tr>" +
"          <td>&nbsp;</td>" +
"        </tr>" +
"        <tr>" +
"          <td><div align=\"center\"><span class=\"ccSubHeading\">Would you like to participate?</span></div></td>" +
"        </tr>" +
"        <tr>" +
"          <td><table width=\"50%\"  border=\"0\" align=\"center\" cellpadding=\"5\">" +
"            <tr>" +
"              <td><div align=\"center\"><a class=\"ccOptionLinks\" href=\"#\" onClick=\"refuseSurvey();return false\" title=\"Click to return to the site.\">No</a></div></td>" +
"              <td><div align=\"center\"><a class=\"ccOptionLinks\" href=\"#\" onClick=\"acceptSurvey();return false\" title=\"Click to take our survey.\">Yes</a></div></td>" +
"            </tr>" +
"          </table>" +
"          <div align=\"center\"></div></td>" +
"        </tr>" +
"        <tr>" +
"          <td>&nbsp;</td>" +
"        </tr>" +
"      </table></td>" +
"  </tr>" +
"</table>" +
"</div>";

contentStr+= INVITE; 

if (check_cookies)
{
	if ( (getCookie(user_survey_offered) != '1') && (getCookie(user_survey_accepted) == null) )
	{ 
		if (user_survey_display_count == 1)
		{ 
			if (surveyEnabled)
			{ 
				document.write(contentStr);
			}
		}
	}
}
else
{
		if (user_survey_display_count == 1)
		{ 
			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/29/2032/cc_loader.jsp?sid=http://survey.barkleylabs.com/29/2032/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 ) );}