	function toggleContent(theId){
		if(document.getElementById("CIcontentMore" + theId).style.display=="none"){
			document.getElementById("CIcontentMore" + theId).style.display=""
			document.getElementById("CIcontent" + theId).style.display="none"
		}
		else{
			document.getElementById("CIcontentMore" + theId).style.display="none"
			document.getElementById("CIcontent" + theId).style.display=""
		}
	}
	
	function toggleContentTV(theId){
		if(document.getElementById("CIcontentMore" + theId).style.display=="none"){
			document.getElementById("CIcontentMore" + theId).style.display=""
			document.getElementById("CIcontent" + theId).style.display="none"
			document.getElementById("CIcontentNext" + theId).style.display="none"
			document.getElementById("CIfooter" + theId).style.backgroundColor="#330716"
		}
		else{
			document.getElementById("CIcontentMore" + theId).style.display="none"
			document.getElementById("CIcontent" + theId).style.display=""
			document.getElementById("CIcontentNext" + theId).style.display=""
			document.getElementById("CIfooter" + theId).style.backgroundColor="#760616"
		}
	}
	
	function changeDot(theMargin,theTxt){
		document.getElementById("dotIndicator").style.left=(4+27*theMargin)+"px"
		document.getElementById("dotIndicatorTxt").innerHTML=theTxt
		getItemTime(theTxt)
	}
	
	function toggleReg(){
        if(document.getElementById("CIcontentReg").style.display=="none"){
			document.getElementById("CIcontentReg").style.display=""
			document.getElementById("reg1").style.display="none"
		}
		else{
			document.getElementById("CIcontentReg").style.display="none"
			document.getElementById("reg1").style.display=""
		}
	}
	
	
	var bezArray=new Array("Innere Stadt", "Leopoldstadt", "Landstraße", "Wieden", "Margareten", "Mariahilf", "Neubau", "Josefstadt", "Alsergrund", "Favoriten", "Simmering", "Meidling", "Hietzing", "Penzing", "Rudolfsheim-Fünfhaus", "Ottakring", "Hernals", "Währing", "Döbling", "Brigittenau", "Floridsdorf", "Donaustadt", "Liesing")
	
	function changeMap(theBez){
		document.getElementById("w24mapContent").style.backgroundPosition="0px " + -theBez*210 + "px"
		document.getElementById("w24mapTxt").innerHTML=bezArray[theBez]
		
		//md start
	    //showAddress("Wien, " + bezArray[theBez]);
        //md end

	}
	//md start
	function showAddress(address) {
		var geocoder = new GClientGeocoder();
		geocoder.getLatLng(address, function (latlng) {
			map.setCenter(latlng, 15);
			aktuellerStandort = latlng;
			load();
		});
	}
function madResult(result) {
    Bezirk = result.Placemark[0].address;
}
//md end
	function swooshSearch(){
		if(document.sucheForm.suche.value.length>2){
			document.sucheForm.submit()
		}
		else{
			alert('Bitte mehr als 2 Zeichen angeben!')
		}
	}
	
	function swooshSearch2(){
		if(document.sForm.sStr.value.length>2){
			document.sForm.submit()
		}
		else{
			alert('Bitte mehr als 2 Zeichen angeben!')
		}
	}
	
	function getWeather(){
			var randomnumber=Math.floor(Math.random()*10000); 
			$.ajax({
				type: "GET",
				url: "service_get.ashx?sid=ye4p2xw1jb5c123h0ltyyiht&command=get_weather&rnd=" + randomnumber,
				dataType: "xml",
				beforeSend: function() {
					//$("#tenyearsCont").html("<div style='margin-left:110px'><br/><img src='img/91.gif' alt='' border='0'/></div>")
				},
				success: function(xml) {
					//$("#tenyearsCont").html("")
					$(xml).find('weather').each(function(){
						
						if($(this).find('date_string').text()=="Heute"){
							var weather1icon=getWeatherIcon($(this).find('clouds').text(),$(this).find('rainfall').text(),$(this).find('fog').text())
							var weather1low=$(this).find('mintemp').text()
							var weather1high=$(this).find('maxtemp').text()
							$('#weather1low').html(weather1low)
							$('#weather1high').html(weather1high)
							$('#weather1icon').attr("src", "img/weather/" + weather1icon)
							
						}
						
						if($(this).find('date_string').text()=="Morgen"){
							var weather2icon=getWeatherIcon($(this).find('clouds').text(),$(this).find('rainfall').text(),$(this).find('fog').text())
							var weather2low=$(this).find('mintemp').text()
							var weather2high=$(this).find('maxtemp').text()
							$('#weather2low').html(weather2low)
							$('#weather2high').html(weather2high)
							$('#weather2icon').attr("src", "img/weather/" + weather2icon)
						}
						
						if($(this).find('date_string').text()=="Übermorgen"){
							var weather3icon=getWeatherIcon($(this).find('clouds').text(),$(this).find('rainfall').text(),$(this).find('fog').text())
							var weather3low=$(this).find('mintemp').text()
							var weather3high=$(this).find('maxtemp').text()
							$('#weather3low').html(weather3low)
							$('#weather3high').html(weather3high)
							$('#weather3icon').attr("src", "img/weather/" + weather3icon)
						}
					});
				}
			});
			
			
		}
		
		function getWeatherIcon(clounds,rainfall,fog){
			
			srtIcon=""
			
			if (clounds=="level0")srtIcon="w_1.jpg"
			else srtIcon="w_2.jpg"
			
			if (rainfall=="mizzle")srtIcon="w_3.jpg"
			
			if (rainfall=="rain")srtIcon="w_5.jpg"
			
			if (rainfall=="snow")srtIcon="w_7.jpg"
			
			if (rainfall=="hail")srtIcon="w_6.jpg"
			
			if (fog=="fog")srtIcon="w_8.jpg"
			
			return srtIcon
		}

		function validateLogin() {
		    if ($("#lgnFrm").validationEngine('validate')) {
		        getLoginStatus()
		    } 
        }
        
        function getLoginStatus() {
            

		    strData="login=" + $("#login").val() + "&pwd=" + $("#pwd").val()

            $.ajax({
              type: 'POST',
              url: "service_login.aspx",
              dataType: "xml",
              data: $("form#lgnFrm").serialize(),
              beforeSend: function () {
                  //alert($("form#lgnFrm").serialize())
              },
              success: function(xml) {

                  //alert($(xml).find('result').text())
                  if ($(xml).find('result').text() != "error") document.location = "mww.aspx"
                  else $('#legendid').validationEngine('showPrompt', 'Falscher Benutzername und/oder Passwort', 'red', 'topRight', 1)
              
              },
              error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
                }
            });
    }

    function getLogoutStatus() {

       
        $.ajax({
            type: 'GET',
            url: "service_logout.aspx",
            dataType: "xml",
            beforeSend: function () {
                
            },
            success: function (xml) {
                document.location = "mww.aspx"
                
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
            }
        });
    }


        function validateRegistration() {
		        if ($("#regFrm").validationEngine('validate')) {
			        postRegistration()
		        }
                else  $("#regFrm").attr("action", "");
		}

		function postRegistration() {


		    $.ajax({
		        type: 'POST',
		        url: "service_post.ashx",
		        dataType: "xml",
		        data: $("form#regFrm").serialize(),
		        beforeSend: function () {
		            //alert($("form#regFrm").serialize())
		        },
		        success: function (xml) {

		            if ($(xml).find('result').text() != "login used") {
		                $('#registrationid').validationEngine('showPrompt', '<b>Vielen Dank für Ihre Registrierung</b><br/>Sie erhalten in Kürze ein Email mit dem Bestätigungslink!', 'pass', 'topRight', 1)
		            }

		            else $('#registrationid').validationEngine('showPrompt', 'Dieser Benutzernahme ist bereits vergeben!', 'red', 'topRight', 1)

		        },
		        error: function (XMLHttpRequest, textStatus, errorThrown) {
		            alert(textStatus);
		        }
		    });
    }

    function nutzungsBestimmungen() {

        strNB = "<b>Nutzungsbestimmungen</b><br/>Die Nutzung der Inhalte auf www.wienweb.at ist unentgeltlich. Sämtliche Videos, Fotos, Texte und Audiofiles sind urheberrechlich geschützt. Jede über die private Verwendung hinausgehende Nutzung ist untersagt. Das betrifft das öffentliche Aufführen, die Weitergabe an Dritte, jeden kommerziellen Einsatz sowie die Veränderung oder Ergänzung der angebotenen Inhalte. <br/><br/>"

        strNB += "Einige Funktionen (SMS-Versand, Archivierungsfunktionen, usw.) sind nur für registrierte Benutzer/innen möglich. wienweb.at verpflichtet sich, die entsprechenden Daten der Nutzer/innen ausschließlich für Service-bezogene Informationen und Aktivitäten zu nutzen. Die Registrierung ist unentgeltlich, auch die Nutzung der Services erfolgt kostenlos. <br/><br/>"

        strNB += "Registrierte Nutzer/innen haben keinen Anspruch auf die Nutzung des Services. Ausfälle, technische Schwierigkeiten oder Systeminkompatibilitäten sind trotz ausgiebiger Tests möglich. Das Risiko trägt der/die Nutzer/in. <br/><br/>"

strNB+="Registrierte Nutzer/innen können jederzeit ohne Angabe von Gründen von der Nutzung der Services auf wienweb ausgeschlossen werden. Das gilt insbesondere bei missbräuchlicher Verwendung der Services."
$("#regFrm").validationEngine('init')
$('#nutzungsbestimmungen').validationEngine('showPrompt', strNB, 'pass', 'topRight', 1)

}

function getUserdata(theId) {

    $.ajax({
        type: "GET",
        url: "service_get.ashx?sid=ye4p2xw1jb5c123h0ltyyiht&command=get_userdata&user_id=" + theId,
        dataType: "xml",
        beforeSend: function () {

        },
        success: function (xml) {
            userLogin = $(xml).find('login').text()
            userPwd = $(xml).find('pwd').text()
            userEmail = $(xml).find('email').text()
            userName = $(xml).find('name').text()
            userLastname = $(xml).find('lastname').text()
            userStreet = $(xml).find('street').text()
            userZip = $(xml).find('zip').text()
            userCity = $(xml).find('city').text()
            userMobile = $(xml).find('mobile').text()
            userBirthday = $(xml).find('birthday').text()

            $("#login").val(userLogin)
            $("#pwd").val(userPwd)
            $("#email").val(userEmail)
            $("#name").val(userName)
            $("#lastname").val(userLastname)
            $("#street").val(userStreet)
            $("#zip").val(userZip)
            $("#city").val(userCity)
            $("#mobile").val(userMobile)
            $("#birthday").val(userBirthday)

        }
    });
}


function getUserdataLogin(theId) {
   
    $.ajax({
        type: "GET",
        url: "service_get.ashx?sid=ye4p2xw1jb5c123h0ltyyiht&command=get_userdata&user_id=" + theId,
        dataType: "xml",
        beforeSend: function () {
           
        },
        success: function (xml) {
            userLogin= $(xml).find('login').text()
            $("#loginContainer").html(userLogin)
        }
    });
}

function validateUserData(theId) {
    if ($("#regFrm").validationEngine('validate')) {
        postUserData(theId)
    }
    else $("#regFrm").attr("action", "");
}

function postUserData(theId) {
    $.ajax({
        type: 'POST',
        url: "service_post.ashx",
        dataType: "xml",
        data: $("form#regFrm").serialize(),
        beforeSend: function () {
            
        },
        success: function (xml) {
            result = $(xml).find('result').text()
            if (result == theId) {
                $('#userDataid').validationEngine('showPrompt', 'Ihre Benutzerdaten wurden erfolgreich geändert!', 'pass', 'topRight', 1)
                getUserdataLogin(theId)
            }
            else $('#userDataid').validationEngine('showPrompt', result, 'red', 'topRight', 1)
            

        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(textStatus);
        }
    });
}

function showImprint(){
    imprint = window.open("imprint.aspx", "imprint", "width=400,height=680,status=no,scrollbars=no,resizable=yes");
}

function initSMS(aktUserId) {
    if ($("#smsFrm").validationEngine('validate')) {
        sendSMS(aktUserId)
    }
    else $("#smsFrm").attr("action", "");
}

function sendSMS(aktUserId) {
		
		aktFrm=document.smsFrm
		
		aktNr = aktFrm.SmsPrefix.value + aktFrm.SmsNummer.value
		
		aktTxt = aktFrm.SmsText.value
		
		aktUrl="service_get.ashx?sid=bcliy14kn5hu4svlctuon0ej&command=send_sms&user_id=" + aktUserId + "&msg=" + aktTxt + "&tel=" + aktNr
       
        $.ajax({
            type: 'GET',
            url: aktUrl,
            dataType: "xml",
            beforeSend: function () {
                
            },
            success: function (xml) {
                result = $(xml).find('result').text()
				
				err=result.indexOf('erfolgreich')
				if(err==-1)$('#smsbutt').validationEngine('showPrompt', result, 'red', 'topRight', 1)
				else $('#smsbutt').validationEngine('showPrompt', result, 'pass', 'topRight', 1)
                
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
            }
        });
    }

