

var expiredays = "30d";
var showexpiredays = "30";
var cookiename = "wishlist";

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return null
}


function setCookie(c_name,value)
{
var exdate=new Date()
exdate.setDate(expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate)
}



function updateWishlist(snumber)
{

var vehicleid = snumber;
var newlist="";
vehiclelist=getCookie(cookiename);
if (vehiclelist!=null)
  {
  var newlist=vehiclelist +'::'+ vehicleid;
  setCookie(cookiename,newlist,expiredays);
  alert('This vehicle will be stored in your wishlist for ' +showexpiredays+ ' days. ');
}else 
  {
  // vehiclelist=prompt('Adding this vehicle to your wishlist',vehicleid)
  alert('This vehicle will be stored in your wishlist for ' +showexpiredays+ ' days. ');
  if (vehiclelist!=null||vehiclelist!="")
    {
    setCookie(cookiename,vehicleid,expiredays);
    }
  }
}

function customerAction(route) {

var checkroute= route;

if(route == 'finance'){
document.location= 'guaranteed-financing.php';
return true;
}

if(route == 'profile'){
print(this);
return true;

}

if(route == 'directions'){
document.location= 'visit-our-showroom.php';
return true;
}
		 
}

