function gSetCBOValues(selectedValue,controlname,statusid)
{
	var sReturn= gsCallServerMethod('http://www.maxxcount.de/maxxcount/ie50/myOn/fastreloadprocess.aspx?'
				+ 'Method=getCboValues&SelectedValue=' + selectedValue
				+ '&ControlName=' + controlname + '&StatusID=' + statusid + '&bid=' + document.all.CMSSetStatus_47.value
				+ '&mid=' + document.all.CMSSetStatus_48.value + '&vid=' + document.all.CMSSetStatus_49.value
				+ '&rid=' + document.all.CMSSetStatus_50.value,'','');

	var sValues = sReturn.split(';')[0];
	var sDescriptions = sReturn.split(';')[1];
	switch (controlname)
	{
		case 'myOn_vw_Brands':
		    	    gClearCombobox('myOn_vw_Models');
			    gAddCombobox('myOn_vw_Models', sValues, sDescriptions);
			    document.all.myOn_vw_Models.disabled=false;
			    gClearCombobox('myOn_vw_vintages');
			    gAddCombobox('myOn_vw_vintages','0','Baujahr');
			    document.all.myOn_vw_vintages.disabled=true;
			    gClearCombobox('myOn_vw_radio');
			    gAddCombobox('myOn_vw_radio','0','Radio');
			    document.all.myOn_vw_radio.disabled=true;
			    break;
		case 'myOn_vw_Models':
		            gClearCombobox('myOn_vw_vintages');
		            gAddCombobox('myOn_vw_vintages',sValues,sDescriptions);
		            document.all.myOn_vw_vintages.disabled=false;
			    gClearCombobox('myOn_vw_radio');
			    gAddCombobox('myOn_vw_radio','0','Radio');
			    document.all.myOn_vw_radio.disabled=true;
		            break;
		case 'myOn_vw_vintages':
			    gClearCombobox('myOn_vw_radio');
		            gAddCombobox('myOn_vw_radio',sValues,sDescriptions);
		            document.all.myOn_vw_radio.disabled=false;
		            break;
	}
}

var bie=true;
function gsCallServerMethod(sURL,sParams,lFlags)
{
	var oSMthHttp;
	var sResponse;	
	var sXml = '<?xml version="1.0"?><Call><Params>' + sParams + '</Params></Call>';

	var sClientString = window.location.href;
	var lPos=glInStr(sClientString,'=wf');
	var lPosStart=lPos+1;
	var sClientID = '';
	sClientID = gsMid( sClientString, lPosStart, 40)

	sURL = sURL + '&ClientID=' + sClientID;

	try {
		oSMthHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
   	        bie=true;
		}
	catch(e){bie=false;}


	if (bie)
	{
		oSMthHttp = new ActiveXObject( "Microsoft.XMLHTTP" )
	}
	else
	{
		oSMthHttp = new XMLHttpRequest();
	}		


	if (sParams>'' && sParams!='undefined')
	{
		oSMthHttp.open('POST',sURL,false);
		oSMthHttp.send(sXml);
	}
	else
	{
		oSMthHttp.open('GET',sURL,false);
		oSMthHttp.send('');
	}	
	// trim the response	
	sResponse= oSMthHttp.responseText;
	if ((lFlags & 1) != 1)
		sResponse = msServerMethodXMLDecode(oSMthHttp.responseText);

	oSMthHttp = null;
	
	sResponse = sResponse.replace(/(^\s*)|(\s*$)/g, "");
	return(sResponse);
}

function msServerMethodXMLDecode(sValue)
{
	var sXML;
			
	sXML = sValue;
	if (sXML != '')
	{
		sXML = sXML.replace(/\&amp;/gi,'&');
		sXML = sXML.replace(/\&lt;/gi,'<');
		sXML = sXML.replace(/\&gt;/gi,'>');
		sXML = sXML.replace(/\&apos;/gi,'\'');
		sXML = sXML.replace(/\&quot;/gi,'"');
	}

	return(sXML);
}


function gAddCombobox(sName, sIDs, sDescs)
{
	var asIDs = sIDs.split(',');
	var asDescs = sDescs.split(',');
	var oOption;
	
    for (var i=0; i<asIDs.length; i++)
    {
		oOption = document.createElement('OPTION');
		oOption.text = asDescs[i];
		oOption.value = asIDs[i];
		oOption.title = asDescs[i];

		if (bie)
		{
			document.all(sName).add(oOption);
		}
		else
		{
			document.all(sName).appendChild(oOption);
		}
          		
    } 
}

function gClearCombobox(sName)
{
    var oCbo = document.all(sName).options;

    for (var i = oCbo.length; i>0; i--) 
	{
	if (bie)
	{
		oCbo.remove(i-1);
	}
	else
	{
		document.all(sName).innerHTML='';//document.all(sName).removeChild(oCbo.options[i-1]);
	}
	}
}


function gsMid(sValue, Start, Length)
{
 if (sValue == null)
  return (false);

 if (Start > sValue.length)
  return '';

 if (Length == null || Length.length == 0)
  return (false);

 return sValue.substr((Start - 1), Length);
}

function glInStr(sValue1, sValue2)
{
 var a = 0;

 if (sValue1 == null || sValue2 == null)
  return (false);

 sValue1 = sValue1.toLowerCase();
 sValue2 = sValue2.toLowerCase();

 a = sValue1.indexOf(sValue2);
 if (a == -1)
  return 0;
 else
  return a + 1;
}


var oSector1;
var oSector2;
var oSector3;
var oSector4;
window.setTimeout("try{oSector1=document.all.myOnAttr_IndustrySector1;}catch(e){};//alert('1');alert(oSector1);",1500);
window.setTimeout("try{oSector2=document.all.myOnAttr_IndustrySector2;}catch(e){};//alert('2');alert(oSector2);",2000);
window.setTimeout("try{oSector3=document.all.myOnAttr_IndustrySector3;}catch(e){};//alert('3');alert(oSector3);",3000);
window.setTimeout("try{oSector4=document.all.myOnAttr_IndustrySector4;}catch(e){};//alert('4');alert(oSector4);",4000);
function gCheckBranche(sValue)
{
//alert('einstieg');
   if (sValue=='131')
   {
//document.all.item("divtest").style.display='inline'; 
	//document.all.item("ComboSectors").style.display='none';  
   //automarkenauswahl anschalten
     
	oSector1.disabled=false;
     oSector2.disabled=false;
     oSector3.disabled=false;
     oSector4.disabled=true;

   }
   else
   {
   if (sValue=='132')
   {
     //franchhisekonzept
     oSector4.disabled=false;
     oSector1.disabled=true;
     oSector2.disabled=true;
     oSector3.disabled=true;
   }
   else 
      {
            oSector4.disabled=true;
     	    oSector1.disabled=true;
            oSector2.disabled=true;
            oSector3.disabled=true;
      }
   }
//alert('fertig');
}


function ReloadISearch(sLanguage)
{
try
{
	if (document.all.DataView_AllFields.value.length>1)
	{
		var sRes;

		sRes = gsCallServerMethod('http://www.maxxcount.de/maxxcount/ie50/myOn/fastreloadprocess.aspx?'
				+ 'Method=ISearch&Language=' + sLanguage + '&Input=' + document.all.DataView_AllFields.value);

		document.all.Test.innerHTML=sRes;
		document.all.Test.style.display='inline';
	}
	else
	{
		document.all.Test.style.display='none';
	}
}
catch(e)
{
//Wenn das kommt, dann ist man auf der Suchseite
	if (document.all.DataView_AllFields[0].value.length>1)
	{
		var sRes;

		sRes = gsCallServerMethod('http://www.maxxcount.de/maxxcount/ie50/myOn/fastreloadprocess.aspx?'
				+ 'Method=ISearch&Language=' + sLanguage + '&Input=' + document.all.DataView_AllFields[0].value);

		document.all.Test.innerHTML=sRes;
		document.all.Test.style.display='inline';
	}
	else
	{
		document.all.Test.style.display='none';
	}
}
}
