// JavaScript Document
jQuery(document).ready(function(){
	jQuery('.bc li:last').addClass('last');							
});

function ajax( url, params )
{
	if ( (typeof(params)).toLowerCase() == 'object' )
		params._ajax_request = 'true';
	else {
		params = [];
		params.push({name:'_ajax_request', value:'true'});
	}
	
	$.get(url, params, function(obj, status){ ajaxResponse(obj, status); });
}

function ajaxResponse( obj, status )
{
	if ( (typeof(obj)).toLowerCase() == 'object' ) {
		eval($('js', obj).text());
	} else
		alert(obj);
}

function AjaxForm( form )
{
	var url = form.attr("action");
	var a = [];
	
    $('input,textarea,select,button', form).each(function() {
        var n = this.name;
        var t = this.type;
        if ( !n || this.disabled || t == 'reset' ||
            (t == 'checkbox' || t == 'radio') && !this.checked ||
            (t == 'submit' || t == 'image' || t == 'button') && this.form.clicked != this ||
            this.tagName.toLowerCase() == 'select' && this.selectedIndex == -1)
            return;
        if (t == 'image' && this.form.clicked_x)
            return a.push(
                {name: n+'_x', value: this.form.clicked_x},
                {name: n+'_y', value: this.form.clicked_y}
            );
        if (t == 'select-multiple') {
            $('option:selected', this).each( function() {
                a.push({name: n, value: this.value});
            });
            return;
        }
        a.push({name: n, value: this.value});
    });

	ajax(url, a)
}

/* Some custom functions */
function getDirections(dest)
{
	window.open('http://maps.google.com/maps?saddr=&daddr='+dest+'&hl=en', 'directions');
}