// Preis Switch

function preisSwitch(val) {
	if(val<'1500') {
		document.getElementById("kaufpreis").name="quicksearch#ObjPreise#kaufpreis#68#klgl";
		}
	else {
		document.getElementById("kaufpreis").name="quicksearch#ObjPreise#kaufpreis#68#grgl";
		}
	}	



//Formularausblender 

$(document).ready(function()
{
	$('form[name="submit_form"]').submit(function()
	{
		$('input[type="text"]').each(function()
		{
            if ($(this).val() == $(this).attr('defaultValue'))
				$(this).val('');
		});
	});
	
	$('input[type="text"]').focus(function()
	{
		if ($(this).val() == 'von' || $(this).val() == 'bis')
			$(this).val('');
	});
	
	$('input[type="text"]').blur(function()
	{
		if ($(this).val() == '')
			$(this).val($(this).attr('defaultValue'));
	});
});


//Objektart/typswitch

function quickSearchChangeName(select)
{
    var index = select.options.selectedIndex;
    var value = select.options[index].value;
    
    //alert('name: ' + select.name + '\nindex: ' + index + '\nvalue:' + value);
    
    if (value == 'grundstueck' || 
        value == 'einzelhandel' || 
        value == 'hallen_lager_prod' || 
        value == 'wohnung' || 
        value == 'sonstige' || 
        value == 'gastgewerbe' || 
		value == 'haus' ||
        value == 'buero_praxen' ||
		value == 'zimmer' ||
		value == 'zinshaus_renditeobjekt'
		)
    {
        select.name = "quicksearch#ObjKategorie#objektart#11#id";
    }
    else
    {
        select.name = "quicksearch#ObjKategorie#objekttyp#12#id";
    }
}


//Popups

function OSG_mypopup(s,b,h,id,entry,optionen) {
	if (!optionen) {
		optionen = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no,top=5,left=30";
	}
	var seite = "osg_popup.xhtml?art="+s+"&id="+id+"&entry="+entry;
	windowprops = "height="+h+",width="+b+","+optionen;
	var fensterle =	window.open(seite, "Popup", windowprops);
	fensterle.focus();
}


// Formularproof

function proof(){
	if(document.formular.vorname.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihren Vornamen an)");
		return false;
	}
	if(document.formular.name.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihren Namen an)");
		return false;
	}

	if(document.formular.wohnort_plz.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihre PLZ an)");
		return false;
	}
	if(document.formular.Ort.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihren Wohnort an)");
		return false;
	}
	if(document.formular.strasse.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihre Strasse an)");
		return false;
	}
	if(document.formular.telefon.value==""){
		alert("__OSG__LANGUAGE(Bitte geben Sie Ihre Telefonnummer an)");

		return false;
	}

		return true;

	}
	
	
// Listenstriche bei nicht vorhandenem Link ausblenden. Hier wird dann das komplette <li> gelöscht.

$(document).ready(function()
{
	$('li.extlink').each(function()
    {
		if ($(this).html() == '&nbsp;<i>|</i>&nbsp;')
        	$(this).remove();
    });
});