//AJAX functions
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

function hyperlink(linkID){
	var ajx1 = createRequestObject();
	ajx1.open('get', 'includes/actions.php?act=countLink&id=' + linkID);
    ajx1.onreadystatechange = function() {
		if(ajx1.readyState == 4){
			var response = ajx1.responseText;
			var update = new Array();
			if(response.indexOf('|' != -1)) {
				switch(linkID){
					case "mainBottomLink":
						document.location = "http://www.vwsouthtowne.com/?cs:e=g&cs:gn=s&cs:cid=2916500914&cs:kw=south%20towne%20volkswagen&cs:p=&cs:tv=33&cs:ki=16607344";
						break;
					case "website":
						document.location = "http://www.vwsouthtowne.com/";
						break;
					case "contact":
						document.location = "http://www.vwsouthtowne.com/ContactUsForm";
						break;
					case "map":
						document.location = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=VW+Southtowne&sll=40.551619,-111.897109&sspn=0.001637,0.003487&ie=UTF8&z=17&iwloc=A";
						break;
					case "about":
						document.location = "http://www.vwsouthtowne.com/Welcome";
						break;
				
				}
			}
		}
	}
    ajx1.send(null);
}

// JavaScript Document

function $(id) {
	return document.getElementById(id);
}
	
	
function changeButton(act, ele){
	if(act == 1){
		$('button' + ele).style.backgroundPosition = "top";	
	} else {
		$('button' + ele).style.backgroundPosition = "bottom";
	}
}

function submitForm(){
	document.contactSubmit.submit();
}
