function getFlash(filename, filename_bild, width, height, transparent, qualitaet) {
	document.write('<object type="application/x-shockwave-flash" data="'+filename+'" width="'+width+'" height="'+height+'">');

		if (transparent = '1')
		{
			document.write('<param name="wmode" value="transparent">');
		} else {
			document.write('<param name="wmode" value="opaque">');
		}

		document.write('<param name="movie" value="'+filename+'">');
		document.write('<param name="quality" value="'+qualitaet+'">');
		document.write('<img src="'+filename_bild+'" width="'+width+'" height="'+height+'" border="0" />');
	document.write('</object>');
}

function GetFlash2()
{
	document.write('<object width="398" height="300" data="download_files/el_karte1.swf" type="application/x-shockwave-flash">');
	document.write('<param name="movie" value="download_files/el_karte1.swf">');
	document.write('</object>'); 
}


// globale Instanz von XMLHttpRequest
var xmlHttp = false;

// XMLHttpRequest-Instanz erstellen
// ... für Internet Explorer
try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
// ... für Mozilla, Opera und Safari
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}




// globale Instanz von XMLHttpRequest
var xmlHttp2 = false;

// XMLHttpRequest-Instanz erstellen
// ... für Internet Explorer
try {
    xmlHttp2  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp2  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp2  = false;
    }
}
// ... für Mozilla, Opera und Safari
if (!xmlHttp2  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp2 = new XMLHttpRequest();
}




function changeDetails(ort,specials,link)
{
	if (xmlHttp) 
	{
	 	document.getElementById("changeable").innerHTML = '<img src="images/loading_mini.gif" border="0" style="float:left"><div style="float:left;padding:2px 10px">Bitte warten ...</div>';
	 	document.getElementById('scout_submit').value='Suche ...';
	 	document.getElementById('scout_output').innerHTML='';
	 	document.getElementById('scout_submit').disabled=true;
	 	document.getElementById('scout_allbut_span').style.display='none';	
	 	document.getElementById('scout_alltxt_span').style.display='none';	
	 	
	 	
	    xmlHttp.open('GET', 'index.php?'+link+'&idlay=5&scout=1&ort='+ort+'&specials='+specials, true);
	    xmlHttp.onreadystatechange = function () 
	    {
		    if (xmlHttp.readyState == 4) 
		    {
		    	var tempText = xmlHttp.responseText;
			    document.getElementById("changeable").innerHTML = tempText.substring(1);
			    document.getElementById("allbut").checked = true;
			    
			    if(tempText.substring(0,1) == "0")
			    {
			    	document.getElementById('scout_submit').value='Bitte treffen Sie eine Auswahl';
			    	document.getElementById('scout_submit').disabled=true;		    	
			    }
			    else if(tempText.substring(0,1) == "1")
			    {
			    	document.getElementById('scout_submit').value='Keine Ergebnisse';
			    	document.getElementById('scout_submit').disabled=true;
			    	    	
			    }
			    else if(tempText.substring(0,1) == "2")
			    {
			    	document.getElementById('scout_submit').value='Suchergebnisse anzeigen';
			    	document.getElementById('scout_submit').disabled=false;	
			    	document.getElementById('scout_allbut_span').style.display='inline';
			    	document.getElementById('scout_alltxt_span').style.display='inline';
			    }
		    }
	    }; 
	    xmlHttp.send(null);
	}
}







function selectAll(selfstat) 
{
	var f = document.scout;
	for (var i = 0; i < f.elements.length; i++) 
	{ 
		if(f.elements[i].name.substr(0,8) == "sspecial") 
		{ 
			f.elements[i].checked = selfstat;
		}
	}	
}






function getScoutOutput(link,sendString)
{	
	if (xmlHttp2) 
	{
	 	document.getElementById("scout_output").innerHTML = '<div style="border:1px #ACA899 solid;padding:5px;background-color:#4B87BD;color:#fff;font-weight:bold;margin-top:20px;height:30px"><img src="images/loading_mini.gif" border="0" style="float:left"><div style="float:left;padding:2px 10px">Ergebnisse werden zusammengestellt.<br>Bitte haben Sie Geduld ...</div></div>';	 	
	    
	    var f = document.scout;
	    if(sendString == "")
	    {
	    	sendString = document.getElementById("kommunen").value;
		    for (var i = 0; i < f.elements.length; i++) 
			{ 
				if(f.elements[i].name.substr(0,8) == "sspecial") 
				{ 
					if(f.elements[i].checked == true)
						sendString += ":" + f.elements[i].value;
				}
			}
	    }

		xmlHttp2.open('GET', 'index.php?'+link+'&idlay=5&scout=2&sendString='+sendString, true);   
	    xmlHttp2.onreadystatechange = function () 
	    {
		    if (xmlHttp2.readyState == 4) 
		    {
		    	var tempText = xmlHttp2.responseText;
			    document.getElementById("scout_output").innerHTML = tempText;
		    }
  
	    }; 

	    xmlHttp2.send(null);
	}
}




function setStartUp(ort,specials,link,sendString)
{
	for (i = 0; i < document.getElementById('kommunen').length; i++)
	{
    	if (document.getElementById('kommunen').options[i].value == ort)
      		document.getElementById('kommunen').options[i].selected = true;
      	else
      		document.getElementById('kommunen').options[i].selected = false;
	}
	
	for (i = 0; i < document.scout.specials.length; i++)
	{
    	if (document.scout.specials.options[i].value == specials)
      		document.scout.specials.options[i].selected = true;
      	else
      		document.scout.specials.options[i].selected = false;
	}
	
	changeDetails(ort,specials,link);
	getScoutOutput(link,sendString);
}


