/*
 *		plik:		js/scripts.css
 *		autor: 		Technetium [Tc]
 *							Kamil Zawada
 *							28 maj 2009
 *		system:		T.CMS-4.0-SEO
 */

var ajax_loading = '<h3 class="green center"> trwa ładowanie </h3>';
var ajax_error = '<h3 class="center"> błąd ładowania </h3>';

function getSamochody(id_marka)
{

    advAJAX.get({
        timeout : 3000,
        retry: 2,
        retryDelay: 2000,
        url: BASE_URL+'/ajax-zabudowy.html?action=get-samochody&id='+id_marka,
        onInitialization : function()
        {
           // $('#top-model-ajax').html(ajax_loading);
        },
        onSuccess : function(obj)
        {
            $('#top-model-ajax').html(obj.responseText);
        },
        onError : function(obj)
        {
           // $('#top-model-ajax').html(ajax_error);
        }
    });
}

function getPodlogi(id_sam, id_seg, id_grub)
{
    

    advAJAX.get({
        timeout : 3000,
        retry: 2,
        retryDelay: 2000,
        url: BASE_URL+'/ajax-zabudowy.html?action=get-podlogi&id='+id_sam+'&id_seg='+id_seg+'&id_grub='+id_grub,
        onInitialization : function()
        {
           // $('#content').html(ajax_loading);
        },
        onSuccess : function(obj)
        {
            $('#content').html(obj.responseText);
            
        },
        onError : function(obj)
        {
           // $('#content').html(ajax_error);
        }
    });
}


function updateSegment(id_seg, otw) {


    advAJAX.get({

        timeout : 3000,
        retry: 2,
        retryDelay: 2000,
        url: BASE_URL+'/ajax-zabudowy.html?action=get-segment&id='+id_seg+'&otw='+otw,
        onRetry : function() { alert("Retry connection..."); },
        onRetryDelay : function() { alert("Awaiting retry..."); },
        onInitialization : function()
        {
           // $('#left-podloga').html(ajax_loading);
        },
        onSuccess : function(obj)
        {
            $('#left-podloga').html(obj.responseText);
            updateCena();
        },
        onError : function(obj)
        {
           // $('#left-podloga').html(ajax_error);
        }
    });



}
