
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 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 hidediv(id){
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}else{
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}else{ // IE 4
			document.all.id.style.display = 'none';
		}
	}
}
function showdiv(id){  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}else{
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}else{ // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function hideclass(id){
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'features_off';
	}else{
		if (document.layers) { // Netscape 4
			document.id.className = 'features_off';
		}else{ // IE 4
			document.all.id.className = 'features_off';
		}
	}
}
function showclass(id){
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'features_on';
	}else{
		if (document.layers) { // Netscape 4
			document.id.className = 'features_on';
		}else{ // IE 4
			document.all.id.className = 'features_on';
		}
	}
}

function showNewCars(){
	var req = new Ajax.Updater("newcars_view", "/?view=new_cars", {method: "get", evalScripts: true});
}

function showFeaturedCars(){
	var req = new Ajax.Updater("featuredcars_view", "/?view=featured_cars", {method: "get", evalScripts: true});
}

function getList(elem, make){
	var req = new Ajax.Updater("vmap1", "/inventory/vehiclemap?vmap1=1&elem="+elem+"&make="+make, {method: "get", evalScripts: true});
}

function go(page_num){
	$('search').action = "/inventory/browse?page="+page_num;
	$('search').submit();
}

function parseNavigation(ob){
	toBeBrokenDown = ob.options[ob.selectedIndex].value.split("|");
	targetURL    = toBeBrokenDown[1];
	window.open(targetURL,'_top')
}

function openLink(type){
	$('search').action = "/inventory/browse?view="+type;
	$('search').submit();
}

function submitForm(url){
	$('search').action = url;
	$('search').submit();
}

function tabselect(tab,idName){
  var tablist = $(idName).getElementsByTagName('li');
  var nodes = $A(tablist);

  nodes.each(function(node){
    if (node.id == tab.id) {
      tab.className='selected';
    } else {
      node.className='unselected';
    };
  });
}



