/*$(document).ready(function(){
    $('#dialog').click(function() {
        $('#dialog').dialog('open');
    });

    $('#dialog').dialog({
        autoOpen: false,
        height: 200,
        width: 270,
        modal: true,
        resizable: false,
        buttons: {
            'Tracking': function() {
                $(this).dialog('close'),
                // Open Kings Tracking in new window
                window.open('http://www.talcasoft.com.au/tracking/nz/');
            },
            'Reports': function() {
                $(this).dialog('close'),
                // Open Kings Report in new window
                window.open('http://trackme.kingstransport.co.nz/GPSReports/index.aspx');
            }
        }
    });
});

function redirect(url)
{	
    if(url.value == 'auckland') {
        $('#dialog').dialog('open');
    } else {
        window.location.href= (url.value);
    }
}*/

var selectedLocation;
$(document).ready(function(){
    $('#dialog').click(function() {
        $('#dialog').dialog('open');
    });

    $('#dialog').dialog({
        autoOpen: false,
        height: 200,
        width: 300,
        modal: true,
        resizable: false,
        buttons: {
            'Tracking': function() {
                $(this).dialog('close');
                // Open Kings Tracking in new window
                if(selectedLocation == 'auckland')
	                window.open('http://www.talcasoft.com.au/tracking/nz/');
	        else if(selectedLocation == 'australia')
	        	window.open('http://www.talcasoft.com.au/tracking/');
            },
            'Reports': function() {
                $(this).dialog('close');
                // Open Kings Report in new window
                if(selectedLocation == 'auckland')
	                window.open('http://trackme.kingstransport.co.nz/GPSReports/index.aspx');
	        else if(selectedLocation == 'australia')
	        	window.open('http://austrack.kingstransport.com.au/');
            }
        }
    });
});

function redirect(url)
{	

    if(url.value == 'auckland') 
    {
    	selectedLocation = 'auckland'
        $('#dialog').dialog('open');
    } 
    else if(url.value == 'australia')
    {
    	selectedLocation = 'australia';
    	$('#dialog').dialog('open');
    }
    else 
    {
        window.location.href= (url.value);
    }
}







