function Survey_goToURL_0674(URL) {
  mywindow = window.open( URL, "Survey", "height=380,width=558,top=480,scrollbars=yes,toolbar=yes,resizable");
  Survey_HideIframe()
}

function kbbInternalReport( showSurvey, showid ) {
  Survey_HideIframe();
  parent.document.getElementById( "InstructionDiv" ).style.visibility="visible";
}

function doSurveyDisplay( showSurvey, id, showid, type, body, dest, winheight, winwidth, header, background, top, left, cookie_name, days_to_expire, project ) {
  if( showSurvey ) {
	if( id == showid ) {
	  SmartShow( type, body, dest, winheight, winwidth, header, background );
    }
  } else {
    displaySurvey( top, left, id, cookie_name, days_to_expire, project );
  }
}

function isNCPR( curpage ) {
  return ( curpage == "nchuboverview" );
}

function isUCPR( curpage ) {
  return ( curpage == "uchubtrade" || curpage == "uchubprivateparty" || curpage == "uchubretail" );
}

function isNCSLP( curpage ) {
  return ( curpage == "nchome" || curpage == "ncmkmdcat" || curpage == "ncmake" );
}

function isUCSLP( curpage ) {
  return ( curpage == "uchome" || curpage == "uccathome" );
}

function isSLP( curpage ) {
	return ( isNCSLP( curpage ) || isUCSLP( curpage ) || curpage == "comparehome" || curpage == "comparencmake" || curpage == "revrathome" || curpage == "advhome" || curpage == "fininshome" );
}

function getTop( curpage ) {
	if( isNCPR( curpage ) ) {
		return "213";
	} else if( curpage == "nchome" || curpage == "ncmkmdcat" || curpage == "comparehome" || curpage == "comparencmake" || curpage == "revrathome" || curpage == "advhome" || curpage == "fininshome" ) {
		return "225";
	} else if( isUCPR( curpage ) ) {
		return "213";
	} else if ( isNCSLP( curpage ) ){
		return "225";
	} else if ( isUCSLP( curpage ) ){
		return "250";
	} else {
		return "210";
	}
}

function getLeft( curpage ) {
	if( isNCPR( curpage ) || curpage == "nchome" || curpage == "ncmkmdcat"  || curpage == "uchome" || curpage == "comparehome" || curpage == "revrathome" || curpage == "advhome" || curpage == "fininshome" ) {
		return "120";
	} else if( isUCPR( curpage ) ) {
		return "60";
	} else if( curpage == "ncmake" || curpage == "uccathome" || curpage == "comparencmake" ) {
		return "200";
	} else {
		return "275";
	}
}

function GetSurveys( showSurvey, showid ) {
	if( !showSurvey ) {
		server = "";
	}
  /* default values */
    var cookie_name = "mastercookie";
    var days_to_expire = 7;
    var header = "/survey/header.gif";
    var background = "/survey/background-wsr2.gif";
    var winwidth = 820;
    var winheight = 450;
    var type = "survey";
    var top = getTop( curpage );
    var left = getLeft( curpage );
    var project = "";
  /* End default values */




  

}

function getRandom(min,max,showSurvey) {
	if( showSurvey ) {
		return 1;
  }
  if (max == 0 || min == 0) {
    return 0;
  } else  {
    return(Math.round(Math.random()*(max-min)))+min;
  }
}

function displaySurvey( top, left, id, cookie_name, days_to_expire, project ) {
  var expiration_date = new Date();
  expiration_date.setTime(expiration_date.getTime()+ days_to_expire *(24 * 60 * 60 * 1000));
  expiration_date.toGMTString();
  if( days_to_expire <=0 )  days_to_expire=1;
  if(document.cookie) {
    index = document.cookie.indexOf(cookie_name);
  } else {
    index = -1;
  }

  if (index == -1) {
	  var agt       = navigator.userAgent.toLowerCase();
      var is_major  = parseInt(navigator.appVersion);
	  var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	  var is_ie3    = (is_ie && (is_major < 4));
	  var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
	  var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);

	  if( is_ie5up ) {
	    document.write( "<div id='SurveyDiv' style='position:absolute; top:" + top + "; left:" + left + "; z-index:100'>" );
	    document.write( "<iframe id='myId' src='/kb/ki.dll/ke.kb.sp?kbb;;" + county + "&" + zip + "&&showsurvey;surveys&" + curpage + ";" + cat + ";" + year + ";" + make + ";" + model + ";" + id + "' height='403' width='282' noresize scrolling='no' frameborder='0' allowtransparency='true'></iframe>" );
	    document.write( "</div>" );

			if( id == "05-37" || id == "05-44" || id == "05-71" || id == "06-04" ) {
	      document.write( "<div id='InstructionDiv' style='visibility:hidden; position:absolute; top:0; left:120; z-index:100'>" );
	      document.write( "<iframe name='instructionFrame' src='/kb/ki.dll/ke.kb.sp?kbb&&&instructionWindow;surveys&" + curpage + ";" + project + "' height='87' width='261' noresize scrolling='no' frameborder='0' allowtransparency='true'></iframe>" );
	      document.write( "</div>" );
			}
	  }

	  if( s_server != "TEST1" ) {
			// dont set cookie on kbb2000
	  	document.cookie = cookie_name + "=1234;expires=" + expiration_date + ";path=/";
		}
	  return true;
  }
}

function SmartShow( type, body, dest, winheight, winwidth, header, background ) {
  document.write( "<style>" );
  document.write( "BODY {" );
  document.write( "background-image: url('" + background + "');" );
  document.write( "background-color: #FFFFFF;" );
  document.write( "background-position: 0 0;" );
  document.write( "background-repeat: no-repeat;" );
  document.write( "}" );
  document.write( "</style>" );
  document.write( "<table class='body_01' border='0' cellpadding='0' cellspacing='0' width='275' height='133'><tr valign='top'>" );
  document.write( "<td><a href='Javascript:Survey_HideIframe();'><img src='/images/wsr/spacer.gif' align='right' width='16' height='14' border='0' style='margin-top:5px;'></a></td></tr><tr>" );
 
  if ( type == "CenteredButtons" )  {
    document.write( "<td class='body_01' style='padding-top:11px;padding-left:0'><div style='width: 100%;'>" );
    document.write( body );
    document.write( "</div></td></tr><tr><td border=0 style='padding-top:5px;padding-left:57'>" );
  } else  {
    document.write( "<td class='body_01' style='padding-top:11px;padding-left:16'><div style='width: 234px;'>" );
    document.write( body );
    document.write( "</div></td></tr><tr><td border=0 style='padding-top:5px;padding-left:16'>" );
  }  

  document.write( "<a href='Javascript:Survey_HideIframe();' value='Close'><img src='/survey/nothanks.gif' border='0' style='margin-top:10px;margin-right:30;'></a>" );
  
  if( type == "survey" ) {
	document.write( "<a href='Javascript:Survey_goToURL(\"" + dest + "\"," + winwidth + "," + winheight + ");' value='Survey'><img src='/survey/submit.gif' border='0'></a>" );
  } else if( type == "CenteredButtons") {
	document.write( "<a href='Javascript:Survey_goToURL_0674(\"" + dest + "\"" + ");' value='Survey'><img src='/survey/submit.gif' border='0'></a>" );
  } else if( type == "kbbInternalReport" ) {
	document.write( "<a href='Javascript:kbbInternalReport(" + false + ");' value='Survey'><img src='/survey/submit.gif' border='0'></a>" );
  }

  document.write( "</td></tr></table>" );

}
