function load_url(str)
{
this.top.location=str;
}


//-------------------------
var oGMap = null;
var oMarker = null;
var sSearchAddress = "";
var sDisplayAddress = "";
//---------------------------------------------------------------------------------------
function initMap(sStreet, sPostalCode, sCity, trigger, land) {
    if (GBrowserIsCompatible()) {
        oGMap = new GMap2(document.getElementById("map_canvas"));
        oGMap.addControl(new GLargeMapControl());
        oGMap.addControl(new GMapTypeControl());
        oGMap.addControl(new GOverviewMapControl());
        
        sSearchAddress = sStreet + "," + sPostalCode + "," + sCity;
        if(!trigger || trigger == '') {
            sDisplayAddress  = "<p><strong>Berlitz Sprachschule " + sCity + "</strong><br />";
            sDisplayAddress += "<br />" + sStreet + "<br />" + sPostalCode + " "+ sCity + "</p>";
        } else {
            sDisplayAddress  = "<p style='font-size:11px;line-height:12px;'><strong>"+trigger+" </strong><br />";
            sDisplayAddress += "<br />" + sStreet + "<br />" + sPostalCode + " "+ sCity + "</p>";
        }
        var oGeocoder = new GClientGeocoder();
        oGeocoder.getLocations(sSearchAddress, addAddressToMap);
    }
}
//---------------------------------------------------------------------------------------
function createMarker(latlng) {
    /*
    var icon = new GIcon();
    icon.image = "http://www.berlitz.de/Berlitz_DE/images/berlitz.png";
    //icon.shadow = "http://www.berlitz.de/Berlitz_DE/images/berlitz.PNG";
    icon.iconSize = new GSize(98, 52);
    //icon.shadowSize = new GSize(66, 33);
    icon.iconAnchor = new GPoint(20, 40);
    icon.infoWindowAnchor = new GPoint(0, 20);
    oMarker = new GMarker(latlng, icon);
    */
    oMarker = new GMarker(latlng);
    var oInfoWin = oGMap.getInfoWindow();
    GEvent.addListener(oMarker, "click", function() {
        (oInfoWin.isHidden()) ? oMarker.openInfoWindowHtml(sDisplayAddress) : oMarker.closeInfoWindow();
    });
    return oMarker;
}
//---------------------------------------------------------------------------------------
function addAddressToMap(response) {
    if (!response || response.Status.code != 200) {
        alert("Diese Adresse kann momentan nicht geographisch ermittelt werden.");
    } else {
        place = response.Placemark[0];
        oPoint = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
        oGMap.setCenter(oPoint, 15);
        oGMap.addOverlay(createMarker(oPoint));
        oMarker.openInfoWindowHtml(sDisplayAddress);
    }
}
//---------------------------------------------------------------------------------------
function cleanUp() {
    if (oGMap) {
        GUnload();
    }
}
//---------------------------------------------------------------------------------------
function subform(sStrasse, sPlz, sOrt)
{
    strasse = document.getElementById('strasse').value;
    plz = document.getElementById('plz').value;
    ort = document.getElementById('ort').value;

    if(strasse != "")
    {
        strasse += "+";
    }
    if(plz != "")
    {
        plz += "+";
    }

    document.getElementById('relink').value = "http://maps.google.ch/maps?f=d&hl=de&geocode=&saddr="+strasse+plz+ort+"&daddr="+sStrasse+",+"+sPlz+"+"+sOrt;
    //document.getElementById('strasse').value = document.getElementById('Anfahrt').action;
    //alert(document.getElementById('Anfahrt').action);
    return true;
}

function switchflash(xmlfile,wid,hei,dela,water,watery,waterx)
{
var hs=document.getElementById('flashplaceholder');

var fl="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + wid + "' height='" + hei + "' id='LightX' align='middle' name='santa'><param name='allowScriptAccess' value='always' /><param name='movie' value='lightx.swf' /><param name='menu' value='false' /><param name='quality' value='high' /><param name='scale' value='noscale' /><param name='salign' value='lt' /><param name='wmode' value='transparent' /><param name='bgcolor' value='#000000' /><param name='flashVars' value='XMLPath="+xmlfile+"&watermark="+water+"&posx="+waterx+"&posy="+watery+"' /><embed src='lightx.swf' flashVars='XMLPath=" + xmlfile + "&watermark="+water+"&posx="+waterx+"&posy="+watery+"' menu='false' quality='high' scale='noscale' salign='lt' wmode='transparent' bgcolor='#ffffff' width=" + wid + " height=" + hei + " name='santa' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";

hs.innerHTML = fl;	

}


function callxml1(pt)
{

//document.getElementById('menu1').src = pt + '/images/menuh1.png';
//document.getElementById('menu2').src = pt + '/images/menu2.png';
//document.getElementById('menu3').src = pt + '/images/menu3.png';
//document.getElementById('menu4').src = pt + '/images/menu4.png';
//document.getElementById('menu5').src = pt + '/images/menu5.png';

	switchflash('siteimages/gallery1.xml',860,289,2500,"","bottom","right");
}

function callxml2(pt)
{
//document.getElementById('menu1').src = pt + '/images/menu1.png';
//document.getElementById('menu2').src = pt + '/images/menuh2.png';
//document.getElementById('menu3').src = pt + '/images/menu3.png';
//document.getElementById('menu4').src = pt + '/images/menu4.png';
//document.getElementById('menu5').src = pt + '/images/menu5.png';

	switchflash('siteimages/gallery2.xml',860,289,2500,"","bottom","right");
}

function callxml3(pt)
{
//document.getElementById('menu1').src = pt + '/images/menu1.png';
//document.getElementById('menu2').src = pt + '/images/menu2.png';
//document.getElementById('menu3').src = pt + '/images/menuh3.png';
//document.getElementById('menu4').src = pt + '/images/menu4.png';
//document.getElementById('menu5').src = pt + '/images/menu5.png';

	switchflash('siteimages/gallery3.xml',860,289,2500,"","bottom","right");
}

function callxml4(pt)
{
//document.getElementById('menu1').src = pt + '/images/menu1.png';
//document.getElementById('menu2').src = pt + '/images/menu2.png';
//document.getElementById('menu3').src = pt + '/images/menu3.png';
//document.getElementById('menu4').src = pt + '/images/menuh4.png';
//document.getElementById('menu5').src = pt + '/images/menu5.png';

	switchflash('siteimages/gallery4.xml',860,289,2500,"","bottom","right");
}

function callxml5(pt)
{
//document.getElementById('menu1').src = pt + '/images/menu1.png';
//document.getElementById('menu2').src = pt + '/images/menu2.png';
//document.getElementById('menu3').src = pt + '/images/menu3.png';
//document.getElementById('menu4').src = pt + '/images/menu4.png';
//document.getElementById('menu5').src = pt + '/images/menuh5.png';

	switchflash('siteimages/gallery5.xml',860,289,2500,"","bottom","right");
}

function find_course()
{
var query = "";

if(document.forms['coursefinder']['location'].value != '')
query += "location=" + document.forms['coursefinder']['location'].value + "&";

if(document.forms['coursefinder']['level'].value != '')
query += "level=" + document.forms['coursefinder']['level'].value + "&";

if(document.forms['coursefinder']['program'].value)
query += "program=" + document.forms['coursefinder']['program'].value + "&";

if(document.forms['coursefinder']['lanselect'].value)
query += "lanselect=" + document.forms['coursefinder']['lanselect'].value + "&";


if (query != "") query = "?" + query;

//alert(query);
exec_ajax("workspace","courses.php" + query);
return false;
}

function ShowTab(vl)
{
var hs=document.getElementById('menu'+vl)
hs.className='current';
}


