/********************************************************************************************************
		
								ALLGEMEIN

*********************************************************************************************************/

function openPopup(URL, winName, winWidth, winHeight, aParams, options)
{
	var link_addition = "";
	
	if (typeof aParams == 'object')
	{
        for (var Key in aParams) 
        {
            if (typeof aParams[Key] != 'function') 
			{
        	    link_addition = link_addition + '&' + Key + '=' + aParams[Key];
            }
        }
        
        var mkURL = URL + '?' + link_addition;
        
    } 
	else 
	{
		var mkURL = URL;    	
    }
    
    var breite = (screen.width - winWidth)/2;
    var hoehe = (screen.height - winHeight)/2 - 60;
    var features = 'width='+winWidth+',height='+winHeight+',top='+hoehe+',left='+breite;
    if(options != '') { features = features+','+options; }
    var fenster = window.open(mkURL, winName, features);
    fenster.focus();
    return fenster;
}


/********************************************************************************************************
		
								Suchen.de

*********************************************************************************************************/

function openSuchenDe(  was, wo, host )
{	
	var http = ""
	if ( host == "" )
	{
		http = "http://hausbau.bauen.de/Umgebungsinfo/KartenPopUp.aspx?was=" + was + "&woutf=" + wo;
	}
	else
	{
		http = host + "/Umgebungsinfo/KartenPopUp.aspx?was=" + was + "&woutf=" + wo;
	}
	
	// alert(http);
	suchendepopupwin=openPopup( http, 'suchendepopup', 1000, 830, '', 'scrollbars=no,status=no,resizable=no,toolbar=no,menubar=no');
	suchendepopupwin.focus();	
	
}

/********************************************************************************************************
		
								PRINT

*********************************************************************************************************/

function openPrintPopup(http)
{
	detailprintpopupwin=openPopup( http, 'printpopup', 850, 850, '', 'scrollbars=auto,status=no,resizable=no,toolbar=no,menubar=no');
	detailprintpopupwin.focus();
}

function printArticle()
{
	self.print();
}

function printContent(id)
{
	var DocumentContainer = document.getElementById(id);
    var WindowObject = window.open('', "TrackHistoryData", "width=2,height=2,top=0,left=0,toolbars=no,scrollbars=yes,status=no,resizable=yes");
    WindowObject.document.writeln(DocumentContainer.innerHTML);
    WindowObject.document.close();
    WindowObject.focus();
    WindowObject.print();
    WindowObject.close();
}

/********************************************************************************************************
		
					Fragen & Antworten ( einstellen der Kategorie)

*********************************************************************************************************/

function setCategory( catid )
{
	if ( document.getElementById('category_uid') != null )
	{
		for (var idx=0;idx<document.getElementById('category_uid').options.length;idx++) 
		{		
			if ( catid == document.getElementById('category_uid').options[idx].value) 
			{			
				document.getElementById('category_uid').selectedIndex=idx;
				document.getElementById('category_uid').options[idx].selected=true;
			}
		}	
	}
	if ( document.getElementById('category') != null )
		document.getElementById('category').value = catid;
}	
