/* javascript */

var g_map_config= new google_map_config_v2();
var g_center    = false;;
var g_map       = false;;

function
map_start()
{
    if ( !GBrowserIsCompatible() ) {
        alert( "Sorry. Google map is not available. Because \n\nThe browser is not able to connect to Google map server at this moment.\n\nOr your browser is not compatible with Google map." );
        return;
    }

    g_center = g_map_data_list.shift();
    g_map = google_map_v2( g_center, g_map_data_list, g_map_config );
}

function
map_center( id )
{
    if ( !g_map ) return;

    var zoom_level = 14;
    var o = false;

    if ( g_center.id == id ) {
        o = g_center;
    } else if ( g_map_data_list ) {
        for (var i=0; i<g_map_data_list.length; i++ ) {
            if ( g_map_data_list[ i ].id == id ) {
                o = g_map_data_list[ i ];
                break;
            }
        }
    }

    if ( o ) {
        google_map_center( g_map, o, zoom_level );
    }

    return;
}

function
map_stop()
{
    GUnload();
}

function
smart_table_type_1( table_class_name )
{
    var elem = "TD";
    var rClick;
    var x=0;

    if ( document.getElementsByTagName ) {
        var el = document.getElementsByTagName( elem );
        for( var i=0; i<el.length; i++ ) {
        if( el[i].parentNode.parentNode.parentNode.className.indexOf( table_class_name ) != -1 ) {
                x++;
                if( x%2 == 1 ) {
                    el[i].className = "on";
                    el[i].oldClassName = "on";
                    el[i].onmouseout  = function() {
                        this.className = "on";
                    }
                } else {
                    el[i].className = "off";
                    el[i].oldClassName = "off";
                    el[i].onmouseout  = function() {
                        this.className = "off";
                    }
                }

                el[i].onmouseover = function() {
                    if ( this.className == this.oldClassName ) {
                        this.className = "hover";
                    }
                    if ( this.onmouseout == null && this.className != "click" ) {
                        this.onmouseout = function() {
                            this.className = this.oldClassName;
                        }
                    }
                }

                el[i].onclick = function() {
                    if ( this.className != "click" ) {
                        this.className = "click";
                    } else {
                        this.className = this.oldClassName;
                    }
                    this.onmouseout = null;
                }
            }
        }
    }
}

function
smart_table()
{
    smart_table_type_1( "listing_list" );
}

function
bl_www_start()
{
    smart_table();
    if ( typeof g_map_data_list != 'undefined' ) {
        map_start();
    }
}

function
bl_www_stop()
{
    if ( typeof g_map_data_list != 'undefined' ) {
        map_stop();
    }
}

/* vim: set expandtab sw=4 ts=4 sts=4: */
