activeNavi='';

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var layers = new Array('layer_bg_immobilien', 'layer_bg_wohnen', 'layer_bg_service', 'layer_bg_gewerbe', 'layer_bg_buero', 'layer_bg_lizenz', 'layer_bg_euv', 'layer_bg_suchen', 'layer_bg_anbieten');
function show(id){
	for(i = 0; i < layers.length; i++){
		var obj;
		if(obj = document.getElementById(layers[i])){
			if(obj.style){
				if(layers[i] == id){	
					obj.style.visibility = 'visible';
				}
				else{
					obj.style.visibility = 'hidden';
				}
			}
		}
	}
}


function image_enlarge_popup(imageId)
{
 var src;
 var titel;
 var win;
 src= document.getElementById(imageId).src;
 titel= document.getElementById(imageId).title;

 win=window.open('../image_enlarge_popup.php?path='+src+'&titel='+titel,'ImageDetail','width=695,height=665,left=300,top=50,status=no,scrollbars=no,resizable=no,menubar=no,location=no');
 win.focus();
}

function image_enlarge_popup_popup(imageId)
{
 var src;
 var titel;
 var win;
 src= document.getElementById(imageId).src;
 titel= document.getElementById(imageId).title;
 win=window.open('image_enlarge_popup.php?path='+src+'&titel='+titel,'ImageDetails','width=695,height=665,left=300,top=50,status=no,scrollbars=no,menubar=no,location=no');
win.focus();
}


function details_popup_open(Id,info)
{
var win;
 win=window.open('../details_popup.php?id='+Id+'&info='+info,'Details','width=686,height=1000,left=300,top=50,scrollbars=yes');
win.focus();
 }


function hide_bild(imageId)
{
 var div;
 var hide_link;
 var show_link;

 div= document.getElementById(imageId);
 div.style.display = 'none';
 
 hide_link= document.getElementById('hide_link');
 hide_link.style.display = 'none';

 show_link= document.getElementById('show_link');
 show_link.style.display = '';
return false;
}

function show_bild(imageId)
{
 var div;
 var hide_link;
 var show_link;
 div= document.getElementById(imageId);
 div.style.display = '';

 hide_link= document.getElementById('hide_link');
 hide_link.style.display = '';

 show_link= document.getElementById('show_link');
 show_link.style.display = 'none';
return false;
}


function hide(id){
	for(i = 0; i < layers.length; i++){
		var obj;
		if(obj = document.getElementById(layers[i])){
			if(obj.style){
				obj.style.visibility = 'hidden';
			}
		}
	}
}

function swap_image(id, newImg){
	document.getElementById(id).src = newImg;
}


function PopUp(name, url, width, height){
    var options = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
    window.open(url, name, options + ',width=' + width + ',height=' + height);
}

function active_navi(elem) {
  document.getElementById(elem).style.backgroundColor='#8C8A8C';
}

function inactive_navi(elem) {
  document.getElementById(elem).style.backgroundColor='#CECBCE';
}

function inactive_navi3(elem1,elem2,elem3,activeElem) {
  if (elem1!=activeElem) document.getElementById(elem1).style.backgroundColor='#CECBCE';
  if (elem2!=activeElem) document.getElementById(elem2).style.backgroundColor='#CECBCE';
  if (elem3!=activeElem) document.getElementById(elem3).style.backgroundColor='#CECBCE';
}

function inactive_navi_not_active(elem,activeElem) {
  if (elem!=activeElem) document.getElementById(elem).style.backgroundColor='#CECBCE'; 
}

function setMainLink(id,link) {
  document.getElementById(id).href=link;
  return false;
}

function delMainLink(id1,id2,id3) {
  document.getElementById(id1).href='#';
  document.getElementById(id2).href='#';
  document.getElementById(id3).href='#';
}

function chkFormular(error,commValue)
{
	if(document.microsite.name.value == "")
	{
		alert(error);
		document.microsite.name.focus();
		return false;
	}

	if(document.microsite.vorname.value == "")
	{
		alert(error);
		document.microsite.vorname.focus();
		return false;
	}

	if(document.microsite.position.value == "")
	{
		alert(error);
		document.microsite.position.focus();
		return false;
	}

	if(document.microsite.email.value == "")
	{
		alert(error);
		document.microsite.email.focus();
		return false;
	}

	var Ergebnis = document.microsite.email.value.search(/@/);
	if(Ergebnis == -1)
	{
		alert(error);
		document.microsite.email.focus();
		return false;
	}

	if(document.microsite.firma.value == "")
	{
		alert(error);
		document.microsite.firma.focus();
		return false;
	}
	if(document.microsite.steuernr.value == "")
	{
		alert(error);
		document.microsite.steuernr.focus();
		return false;
	}
	if(document.microsite.strasse.value == "")
	{
		alert(error);
		document.microsite.strasse.focus();
		return false;
	}
	if(document.microsite.plz.value == "")
	{
		alert(error);
		document.microsite.plz.focus();
		return false;
	}
	if(document.microsite.ort.value == "")
	{
		alert(error);
		document.microsite.ort.focus();
		return false;
	}
	if(document.microsite.position.value == "")
	{
		alert(error);
		document.microsite.position.focus();
		return false;
	}
	if(document.microsite.buero_email.value == "")
	{
		alert(error);
		document.microsite.buero_email.focus();
		return false;
	}
	if(document.microsite.buero_tel.value == "")
	{
		alert(error);
		document.microsite.buero_tel.focus();
		return false;
	}
	if(document.microsite.buero_fax.value == "")
	{
		alert(error);
		document.microsite.buero_fax.focus();
		return false;
	}
	
	return true;
}

function print_listing(mls_id)
{
	window.open('<?php echo base_url()?>properties/print_listing/' + mls_id,'mywindow','width=650,toolbar=no,menubar=no,scrollbars=yes,maximize=yes');
}

function email_listing(mls_id)
{
	window.open('<?php echo base_url()?>properties/email_listing/' + mls_id,'mywindow','width=400,height=300,toolbar=no,menubar=no,scrollbars=yes,maximize=yes');
}


