// Application Buttons //
var ISOCODE;
//Service & Body Shop
var imgOnAppointment = new Image(253,48);
imgOnAppointment.src = '/images/image.php?file=buttons/ENG/appointment2.gif';
var imgOffAppointment = new Image(253,48);
imgOffAppointment.src = '/images/image.php?file=buttons/ENG/appointment1.gif';

// MORE INFO BUTTON
var imgOnInfo = new Image(253,48);
imgOnInfo.src = '/images/image.php?file=buttons/ENG/more_info2.gif';
var imgOffInfo = new Image(253,48);
imgOffInfo.src = '/images/image.php?file=buttons/ENG/more_info1.gif';

//Parts
var imgOnPartsRequest = new Image(253,48);
imgOnPartsRequest.src = '/images/image.php?file=buttons/ENG/parts_request2.gif';
var imgOffPartsRequest = new Image(253,48);
imgOffPartsRequest.src = '/images/image.php?file=buttons/ENG/parts_request1.gif';

//Finance
var imgOnCreditApp = new Image(253,48);
imgOnCreditApp.src = '/images/image.php?file=buttons/ENG/credit_app2.gif';
var imgOffCreditApp = new Image(253,48);
imgOffCreditApp.src = '/images/image.php?file=buttons/ENG/credit_app1.gif';

function showStatus(sMsg) {//used often
	//setTimeout("window.status = \'" + sMsg + "\';", 0);
    window.status = sMsg ;
    return true ;
}
function openWindow(url,width,height){
	newWin = window.open(url, 'viewWin', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,left='+(screen.width-width)/2+',top='+(screen.height-height)/2+',width=' + width + ',height=' + height + '');
}		

function changeImg(imgName,imgPre) {
	if(document.images){
		document.images[imgName].src = eval(imgPre + '.src');
	}
}

function changeStyle(obj, new_style) {
    obj.className = new_style;
}

/*
Written by Kyle Somogyi
*/
var qs=false;
$(document).ready(function()
{
	var tn = $('#featuredContainer .tab.active').attr('tab');
	$('#'+tn).addClass('active');
	$('#featuredContainer .tab_content:not(.active)').hide();
	bindFeaturedEvents();

	var galleryHorizontal = new Shiftr(
	{
		bindTo: '#used',
		animation: 'slide_horizontal',
		jumpAmount: 3
	});
	
	//Used Inventory Search Drop-down Menu
	
	$('div#vehicle_search form select').click(function() {
		$('ul#child3').addClass("showAlways");
		$('ul#child3 #closeSearchIE').addClass("showIE");
	});
	$('ul#child3 #closeSearchIE').click(function() {
		$('ul#child3').removeClass("showAlways");
		$('ul#child3 #closeSearchIE').removeClass("showIE");
		$('ul#child3').hide();
	});
	$('ul#topMenu li #nav3').mouseover(function() {
		$('ul#child3').attr("style"," ");
	});
	
	$('ul#topMenu li').children('a').hover(function() {
		$('ul#child3').removeClass("showAlways");
	});
	
});

function bindFeaturedEvents()
{
	$('#featuredHeader .tab').click(function()
	{
		if($(this).hasClass('active') == false)
		{
			$('#featuredContainer .tab.active').removeClass('active').addClass('deactive');
			$(this).addClass('active').removeClass('deactive');
			var tt = $(this).attr('tab');
			$('#featuredBody .active').css('z-index', 20);
			$('#featuredBody #'+tt).css('z-index', 18).fadeIn('fast');
			$('#featuredBody .active').fadeOut('fast').removeClass('active');
			$('#'+tt).addClass('active');

			$('#featuredHeader .tab').unbind('click');
			bindFeaturedEvents();
		}
	});
}

function addBookmark(url, title)
{
	if(document.all)
		window.external.AddFavorite(url, title);
	else if(window.sidebar)
		window.sidebar.addPanel(title, url,'');
	else
		alert('To add a bookmark to this page, please press Ctrl+D.')
}
