function getParameters()
{
    var returnValue = '';        
    
    // category
    if (document.forms[0].c.value != null && document.forms[0].c.value != '')
        returnValue += '&c=' + document.forms[0].c.value;
    if (document.forms[0].c2.value != null && document.forms[0].c2.value != '')
        returnValue += '&c2=' + document.forms[0].c2.value;
    if (document.forms[0].c3.value != null && document.forms[0].c3.value != '')
        returnValue += '&c3=' + document.forms[0].c3.value;
    if (document.forms[0].c4.value != null && document.forms[0].c4.value != '')
        returnValue += '&c4=' + document.forms[0].c4.value;                
    if (document.forms[0].ca.value != null && document.forms[0].ca.value != '')
        returnValue += '&ca=' + document.forms[0].ca.value;
        
    // make    
    if (document.forms[0].m.value != null && document.forms[0].m.value != '')
        returnValue += '&m=' + document.forms[0].m.value;
    if (document.forms[0].m2.value != null && document.forms[0].m2.value != '')
        returnValue += '&m2=' + document.forms[0].m2.value;
    if (document.forms[0].m3.value != null && document.forms[0].m3.value != '')
        returnValue += '&m3=' + document.forms[0].m3.value;       
    if (document.forms[0].m4.value != null && document.forms[0].m4.value != '')
        returnValue += '&m4=' + document.forms[0].m4.value;        
            
    // model
    if (document.forms[0].d.value != null && document.forms[0].d.value != '')
        returnValue += '&d=' + document.forms[0].d.value;
    if (document.forms[0].d2.value != null && document.forms[0].d2.value != '')
        returnValue += '&d2=' + document.forms[0].d2.value;
    if (document.forms[0].d3.value != null && document.forms[0].d3.value != '')
        returnValue += '&d3=' + document.forms[0].d3.value;      
    if (document.forms[0].d4.value != null && document.forms[0].d4.value != '')
        returnValue += '&d4=' + document.forms[0].d4.value;          
        
    // year
    if (document.forms[0].y.value != null && document.forms[0].y.value != '')
        returnValue += '&y=' + document.forms[0].y.value;
    if (document.forms[0].y2.value != null && document.forms[0].y2.value != '')
        returnValue += '&y2=' + document.forms[0].y2.value;      
    if (document.forms[0].y3.value != null && document.forms[0].y3.value != '')
        returnValue += '&y3=' + document.forms[0].y3.value;    
    if (document.forms[0].y4.value != null && document.forms[0].y4.value != '')
        returnValue += '&y4=' + document.forms[0].y4.value;              
    
    // style
    if (document.forms[0].s.value != null && document.forms[0].s.value != '')
        returnValue += '&s=' + document.forms[0].s.value;   
    if (document.forms[0].s2.value != null && document.forms[0].s2.value != '')
        returnValue += '&s2=' + document.forms[0].s2.value;     
    if (document.forms[0].s3.value != null && document.forms[0].s3.value != '')
        returnValue += '&s3=' + document.forms[0].s3.value;
    if (document.forms[0].s4.value != null && document.forms[0].s4.value != '')
        returnValue += '&s4=' + document.forms[0].s4.value;                

    // vehicle id
    if (document.forms[0].vi.value != null && document.forms[0].vi.value != '')
        returnValue += '&vi=' + document.forms[0].vi.value;

    // colors        
    if (document.forms[0].cc1.value != null && document.forms[0].cc1.value != '')
        returnValue += '&cc1=' + document.forms[0].cc1.value;           
    if (document.forms[0].cc2.value != null && document.forms[0].cc2.value != '')
        returnValue += '&cc2=' + document.forms[0].cc2.value;                   
    if (document.forms[0].cc3.value != null && document.forms[0].cc3.value != '')
        returnValue += '&cc3=' + document.forms[0].cc3.value;
        
    // mileage
    if (document.forms[0].mi.value != null && document.forms[0].mi.value != '')
        returnValue += '&mi=' + document.forms[0].mi.value; 

    // options
    if (document.forms[0].o.value != null && document.forms[0].o.value != '')
        returnValue += '&o=' + document.forms[0].o.value; 

    // make letter
    if (document.forms[0].ml.value != null && document.forms[0].ml.value != '')
        returnValue += '&ml=' + document.forms[0].ml.value; 

    // comparison vehicle number
    if (document.forms[0].av.value != null && document.forms[0].av.value != '')
        returnValue += '&av=' + document.forms[0].av.value;        

    // comparison replace vehicle
    if (document.forms[0].rv.value != null && document.forms[0].rv.value != '')
        returnValue += '&rv=' + document.forms[0].rv.value;

    // year type        
    if (document.forms[0].yt.value != null && document.forms[0].yt.value != '')
        returnValue += '&yt=' + document.forms[0].yt.value;               
    if (document.forms[0].yt2.value != null && document.forms[0].yt2.value != '')
        returnValue += '&yt2=' + document.forms[0].yt2.value; 
    if (document.forms[0].yt3.value != null && document.forms[0].yt3.value != '')
        returnValue += '&yt3=' + document.forms[0].yt3.value;         
    if (document.forms[0].yt4.value != null && document.forms[0].yt4.value != '')
        returnValue += '&yt4=' + document.forms[0].yt4.value;         
    
    // vehicle type    
    if (document.forms[0].vt.value != null && document.forms[0].vt.value != '')
        returnValue += '&vt=' + document.forms[0].vt.value;         
    if (document.forms[0].vt2.value != null && document.forms[0].vt2.value != '')
        returnValue += '&vt2=' + document.forms[0].vt2.value;         
    if (document.forms[0].vt3.value != null && document.forms[0].vt3.value != '')
        returnValue += '&vt3=' + document.forms[0].vt3.value;            
    if (document.forms[0].vt4.value != null && document.forms[0].vt4.value != '')
        returnValue += '&vt4=' + document.forms[0].vt4.value;            
        
    // zipcode
    if (document.forms[0].z.value != null && document.forms[0].z.value != '')
        returnValue += '&z=' + document.forms[0].z.value;
        
    // transmission
    if (document.forms[0].t.value != null && document.forms[0].t.value !='')
        returnValue += '&t=' + document.forms[0].t.value;
        
    // color package
    if (document.forms[0].cp.value != null && document.forms[0].cp.value != '')
        returnValue += '&cp=' + document.forms[0].cp.value;
        
    // special Offer type
    if (document.forms[0].ot.value != null && document.forms[0].ot.value != '')
        returnValue += '&ot=' + document.forms[0].ot.value;
        
    // vendor id
    if (document.forms[0].v.value != null && document.forms[0].v.value != '')
        returnValue += '&v=' + document.forms[0].v.value;
    
    // review id
    if (document.forms[0].r.value != null && document.forms[0].r.value != '')
        returnValue += '&r=' + document.forms[0].r.value;

    // car-values
    if (document.forms[0].da.value != null && document.forms[0].da.value != '')
        returnValue += '&da=' + document.forms[0].da.value;
    
    // eVox
    if (document.forms[0].e.value != null && document.forms[0].e.value != '')
        returnValue += '&e=' + document.forms[0].e.value;
        
    // next car type
    if (document.forms[0].nx.value != null && document.forms[0].nx.value != '')
        returnValue += '&nx=' + document.forms[0].nx.value;        
        
    // next pageId
    if (document.forms[0].nx.value != null && document.forms[0].np.value != '')
        returnValue += '&np=' + document.forms[0].np.value;        
    
    // AdId
    if (document.forms[0].aid.value != null && document.forms[0].aid.value != '')
        returnValue += '&aid=' + document.forms[0].aid.value;
        
    // Item Id
    if (document.forms[0].iid.value != null && document.forms[0].iid.value != '')
        returnValue += '&iid=' + document.forms[0].iid.value;
        
    // MPG
    if (document.forms[0].mpg.value != null && document.forms[0].mpg.value != '')
        returnValue += '&mpg=' + document.forms[0].mpg.value;
    
    return returnValue;
}

/*  validation functions*/

function validZip(value){	
	var zipexp = /^\d{5}$|^\d{5}[\-\s]?\d{4}$/	
	return zipexp.test(value)
}


/*Image functions */

function swapImage(imgName, imgPath){
    if (document.images) {
        document.getElementById(imgName).src = imgPath;
    }
}

function ImageLoadFailed(theParent,imgHeight,imgWidth) {
	var isIE=document.all;
	if(isIE){
		window.event.srcElement.style.display = "None";
		document.getElementById(theParent).style.cssText = "border:1px solid #999999;height:" + imgHeight + "px;width:" + imgWidth + "px;background-color:#E3E8EF;text-align:center;";
		document.getElementById(theParent).innerHTML = "<div style='height:24px;margin-top:" + (imgHeight/2-12) +"px'><b>Photo not available</b></div>";
	}	
}
function ImageLinkLoadFailed(theParent,imgHeight,imgWidth) {
	var isIE=document.all;
	if(isIE){
		window.event.srcElement.style.display = "None";
		document.getElementById(theParent).style.cssText = "cursor:pointer;border:1px solid #999999;height:" + imgHeight + ";width:" + imgWidth + ";background-color:#E3E8EF;vertical-align: middle;text-align:center;";
		document.getElementById(theParent).innerHTML = "<br><b>Photo not available</b>";
	}	
}
function HideOnImageLoadFail()
{
	var isIE=document.all;
	if(isIE)	
		window.event.srcElement.style.display = "None";	
}
function calculateAfford(){
		
		var rate = document.forms[0].InterestRate.options[document.forms[0].InterestRate.selectedIndex].value/100/12;
		var nPer = document.forms[0].LoanTerm.options[document.forms[0].LoanTerm.selectedIndex].value;
		var pmt = Math.round(document.forms[0].Monthly_Payment.value);
		var amt = pmt * (1-Math.pow(1/(1+rate), nPer)) / rate;
		var dnPmt = Math.round(document.forms[0].Down_Payment.value);
		if (dnPmt=="") dnPmt = 0;
		var totalCost = amt + dnPmt;
		
		document.forms[0].Afford_Amount.value = Math.abs((Math.round(totalCost*100)/100));
		
}

/* Vehicle Search results submit */
function VS2_0ResultSubmit(actionurl, d, yt)
{
    alert("hi");	
	location.href = actionurl + "&d=" + d + "&yt=" + yt;
	/*form.action=actionurl;
	form.d.value = d;
	form.vt.value = yt;

	form.submit();*/
	
}

/* FLASH DETECTION */
var WM_startTagFix = '<\/';

var msie_windows = 0;

if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)){
  msie_windows = 1;
  document.writeln('<script language="VBscript">');
  document.writeln('Dim WM_detect_through_vb');
  document.writeln('WM_detect_through_vb = 0');
  document.writeln('If ScriptEngineMajorVersion >= 2 then');
  document.writeln('  WM_detect_through_vb = 1');
  document.writeln('End If');
  document.writeln('Function WM_activeXDetect(activeXname)');
  document.writeln('  on error resume next');
  document.writeln('  If ScriptEngineMajorVersion >= 2 then');
  document.writeln('     WM_activeXDetect = False');
  document.writeln('     WM_activeXDetect = IsObject(CreateObject(activeXname))');
  document.writeln('     If (err) then');
  document.writeln('        WM_activeXDetect = False');
  document.writeln('     End If');
  document.writeln('   Else');
  document.writeln('     WM_activeXDetect = False');
  document.writeln('   End If');
  document.writeln('End Function');
  document.writeln(WM_startTagFix+'script>');
}

function WM_pluginDetect(plugindescription, pluginxtension, pluginmime, activeXname){
  var i,plugin_undetectable=0,detected=0, daPlugin=new Object();
  
  if (msie_windows && WM_detect_through_vb){
      plugin_undetectable = 0;
  } 
  
  else {
      plugin_undetectable = 1;
  }  
  
  if(navigator.plugins) {
      numPlugins = navigator.plugins.length;
      if (numPlugins > 1) {
	  if (navigator.mimeTypes && navigator.mimeTypes[pluginmime] && navigator.mimeTypes[pluginmime].enabledPlugin && (navigator.mimeTypes[pluginmime].suffixes.indexOf(pluginxtension) != -1)) { // seems like we have it, let's just make sure and check the version (if specified)
	      if ((navigator.appName == 'Netscape') && (navigator.appVersion.indexOf('4.0') != -1)) { // stupid, stupid Netscape can't handle the references to navigator.plugins by number, sooo...
		  for(i in navigator.plugins) {
		      if ((navigator.plugins[i].description.indexOf(plugindescription) != -1) || (i.indexOf(plugindescription) != -1)) { // some versions of quicktime have no description. feh!
			  detected=1;
			  break;
		      }
		  }
	      } else {
		  for (i = 0; i < numPlugins; i++) {
		      daPlugin = navigator.plugins[i];
		      if ((daPlugin.description.indexOf(plugindescription) != -1) || (daPlugin.name.indexOf(plugindescription) != -1)) {
			  detected=1;
			  break;
		      }
		  }
	      }	      // Mac weirdness
      if (navigator.mimeTypes[pluginmime] == null) {
		  detected = 0;
	      }
	  }
	  return detected;
      } 
	  
	  else if((msie_windows == 1) && !plugin_undetectable){
	  return WM_activeXDetect(activeXname);
      } 
	  
	  else { 		
	  return 0;
      }
  } 
  
  else {
      return 0;
  }
}

var isItThere  = WM_pluginDetect('Flash', 'swf', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash');

function number_check(value) 
{ 
	return ( 1 - (value%2) ) 
}
