var pitchpopup = true;
var tagName = "";
var isFlash = "";
var isExitSurveyEnabled = false;

function Get_Cookie(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 ) );
}

function Set_Cookie(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 pop(url, width, height, popName, resize)
{
	if (!Get_Cookie("SpotRunnerExitPop")) {
		Set_Cookie("SpotRunnerExitPop","triggered", 365, "/", "", "" );
		var winName = "mypop";
		if (popName){
			winName = popName;
			if (popName == "1"){
				var date = new Date();
				winName = date.getTime();
			}
		}
		if (!resize) resize="yes";
		var args = "width="+width+",height="+height;
		window.open(url,winName,"resizable=" + resize + ",scrollbars=yes,toolbar=no,"+args);
		window.focus();
	}
}

function pageExit2() 
{
    if (!isExitSurveyEnabled) return;
	if (pitchpopup) {
		pop("http://www.surveymonkey.com/s.asp?U=439112773815&Popup=15505","750","570","exitPop");
	}
}

function pageExit()
{
    if (!isExitSurveyEnabled) return;
	if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0)
	{	    
		if (tagName != "A" && tagName != "INPUT" && tagName != "SELECT" && tagName != "IMG" && isFlash != "true")
		{
		pop("http://www.surveymonkey.com/s.asp?U=439112773815&Popup=15505","750","570","exitPop");
		}
	}
}

function saveExitEvent()
{
    if (!isExitSurveyEnabled) return;
	if (window.event)
	{
		tagName=window.event.srcElement.tagName;
	}
}

function flashHref(url)
{
	isFlash='true';
	window.location.href=url;
}