/**********************************************************************/
/* Funktion laed Images vor          																  */	
/**********************************************************************/
function preload_images() 
{ 
  var d=document; 
	if(d.images)
	{ 
		if(!d.MM_p) d.MM_p=new Array();
   	var i,j=d.MM_p.length,a=preload_images.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];
			}
		}
	}
}		
/**********************************************************************/
/* Funktion erzeugt einen Mailto-Link 							             			*/	
/**********************************************************************/
function create_email_link(email,domain,linkname)
{
	document.writeln("<a onMouseMove=\"javascript:status='"+linkname+"';\" onMouseOut=\"javascript:status='';\" href=\"mailto:"+email+"@"+domain+"\">"+linkname+"</a>");
}

/**********************************************************************/
/* Funktion oeffnet ein	Pop-Up-Fenster							             			*/	
/**********************************************************************/
function open_window(url, w, h, winname, scroll, resize)  
{
	var winleft = (screen.width - w) / 2; 
	var wintop = (screen.height - h) / 2;
	var winprops = "height="+h+",width="+w+",top="+wintop+",left="+winleft+",scrollbars="+scroll+",resizable="+resize;
	//var windowname = "-"+(Math.random()*99999999);
	var win = window.open(url, winname, winprops);
	if(window.focus) 
	{
		win.focus();
	}
}
/**********************************************************************/
/* Funktion zaehlt die Zeichen in einem Textarea                      */
/**********************************************************************/
function display_count_chars(id_name,string,max_chars)
{
	if(max_chars-string.length<0)
	{
		document.getElementById(id_name).innerHTML=0;
	}else{
		document.getElementById(id_name).innerHTML=max_chars-string.length;
	}
}

function showMap_kaufen(strasse,hausnr,plz,ort,displayart)
{
	open_window("http://www.yellowmap.de/Filialfinder/Html/Map.aspx?Partner=Gewobag&SecurityID=8G4Ofg4kYP60WarNVquWXQ%3D%3D&MapAddresses=D|"+plz+"|"+ort+"||"+strasse+"|"+hausnr, 790, 560, "locator" ,1,1,1,1);	
}
function showMap_mieten(id)
{
	open_window("http://www.yellowmap.de/Filialfinder/Html/Map.aspx?Partner=Gewobag&SecurityID=8G4Ofg4kYP60WarNVquWXQ%3D%3D&MapPartnerIds="+id, 790, 560, "locator" ,1,1,1,1);
}

function select_the_color(_selected,_count)
{
	for(i=0;i<_count;i++)
	{
		document.getElementById("preview_"+(i+1)).style.borderColor="#F0F5EB";
	}
	document.getElementById("preview_"+(_selected+1)).style.borderColor="#CC3333";
}

/**********************************************************************/
/* Funktion integriert das passende Styleshett 			             			*/	
/* Input: Pfadangabe zum Styleshett; Format: "../../shared/"          */
/**********************************************************************/
function checkstylesheet(path)
{
	if(navigator.appName == "Netscape")
	{if(navigator.platform == "Win32")
	{if((navigator.appVersion.substr(0,1)) >= 5)
	{document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_pc_ns6.css\">");}
	else{document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_pc_ns.css\">");}
	}else{if((navigator.appVersion.substr(0,1)) >= 5)
	{document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_mac_ns6.css\">");}
	else{document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_mac_ns.css\">");}}			
	}else{if(navigator.platform == "Win32"){document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_pc_ie.css\">");}else
	{document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+path+"style_mac_ie.css\">");}}		
}



function getRect(o)
{
	var r = { top:0, left:0, width:0, height:0 };
  if(!o) return r;
  else if(typeof o == 'string' ) o = document.getElementById(o);
  if( typeof o != 'object' ) return r;
  if(typeof o.offsetTop != 'undefined')    
	{
       r.height = o.offsetHeight;
       r.width = o.offsetWidth;
       r.left = r.top = 0;
       while (o && o.tagName != 'BODY')         
			 {
            r.top  += parseInt( o.offsetTop );
            r.left += parseInt( o.offsetLeft );
            o = o.offsetParent;
       }
  }
  return r;
}

function show_banner_einrichtungsplaner(_id)
{
	banner_w = 216;
	banner_h = 117;				
	
	pos_left = getRect("grundriss_id").left + 530 - banner_w;
	pos_top = getRect("grundriss_id").top + getRect("grundriss_id").height - banner_h-50;

	document.write("<div class=\"printhide\"><a href=\"javascript:open_window('einrichtungsplaner/index.php?expose_id="+_id+"', 880, 640, 'einrichtungsplaner', 0, 0);\" style=\"background:none;padding:0px;\"><img style=\"width:"+banner_w+"px;height:"+banner_h+"px;z-index:100;position:absolute;left:"+pos_left+"px;top:"+pos_top+"px;\" src=\"pix/bu_einrichtungsplaner.png\" alt=\"\" /></a></div>");
}

/**********************************************************************/
/* Funktion integriert Flash-Player fuer FLV-Videos                    */
/**********************************************************************/
function flv_player(_file,_x_size,_y_size)
{

var str = '<object data="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=false&'+Math.random()+'" type="application/x-shockwave-flash" width="'+_x_size+'" height="'+_y_size+'">';
str += '<param name="movie" value="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=false&'+Math.random()+'" />';
str += '<param name="allowfullscreen" value="true" />';
str += '<param name="quality" value="low" />';
str += '</object>';
document.write(str);
/*
document.write('<object data="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=false&'+Math.random()+'" type="application/x-shockwave-flash" width="'+_x_size+'" height="'+_y_size+'">');
document.write('<param name="movie" value="flash/flv_player.swf?video='+_file+'&startvolume=100&autoplay=false&'+Math.random()+'" />');
document.write('<param name="allowfullscreen" value="true" />');
document.write('<param name="quality" value="low" />');
document.write('</object>');
*/


}
