<!--

  window.onload = initialize;
  
  function initialize()  {
	  initializeSearch();
      try { Crm.SetupForwardingToCrm(); } catch (ex) { }	
  }
  
  Crm = {
    Xhr: function() {
        
        var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
        
        if (window.ActiveXObject) { 
            for (var i=0; i<activexmodes.length; i++) {
                try {
                    return new ActiveXObject(activexmodes[i]);
                } catch (ex) {
                    // suppress errors
                }
            }
        }
        else if (window.XMLHttpRequest)
            return new XMLHttpRequest();
        else
            return false;
    },

    SetupForwardingToCrm: function() {
        
	    var targetContactForm = document.getElementsByName("contactForm");
	    
        if (targetContactForm[0]) {

	        targetContactForm[0].onsubmit = function() {
		        try {
                    var request = new Crm.Xhr();
		
                    request.open("POST", "/ForwardToCrm.php", false);
		            request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		            var contactForm = document.getElementsByName("contactForm")[0];		
		
                    var zgoda = 0;
		            if(contactForm.interesse_mail.checked)
			            zgoda = 1;
		
                    var salut = '';
		            if(!contactForm.salutation.selectedIndex)
			            salut = '';
		            else 
			            salut = contactForm.salutation.options[contactForm.salutation.selectedIndex].text;
			
		            var postBody = 'form=' + escape('contactForm')
                        + '&company=' + encodeURIComponent(document.getElementById('company').value) 
                        + '&department=' + encodeURIComponent(document.getElementById('department').value) 
                        + '&salutation=' + encodeURIComponent(salut) 
                        + '&title=' + encodeURIComponent(document.getElementById('title').value) 
                        + '&forename=' + encodeURIComponent(document.getElementById('forename').value)
                        + '&surename=' + encodeURIComponent(document.getElementById('surename').value)
                        + '&birthday=' + encodeURIComponent(document.getElementById('birthday').value)
                        + '&function=' + encodeURIComponent(contactForm["function"].options[contactForm["function"].selectedIndex].text)
                        + '&institution=' + encodeURIComponent(contactForm.institution.options[contactForm.institution.selectedIndex].text)
                        + '&street=' + encodeURIComponent(document.getElementById('street').value)
                        + '&country=' + encodeURIComponent(contactForm.country.options[contactForm.country.selectedIndex].text)
                        + '&zip=' + encodeURIComponent(document.getElementById('zip').value)
                        + '&city=' + encodeURIComponent(document.getElementById('city').value)
                        + '&email=' + encodeURIComponent(document.getElementById('email').value)
                        + '&phone=' + encodeURIComponent(document.getElementById('phone').value)
                        + '&phone_selection=' + encodeURIComponent(document.contactForm.phone_selection.options[document.contactForm.phone_selection.selectedIndex].text)
                        + '&fax=' + encodeURIComponent(document.getElementById('fax').value)
                        + '&comment=' + encodeURIComponent(document.getElementById('comment').value) 
                        + '&zgoda=' + zgoda;
                    
                    request.send(postBody);

                } catch (ex) {
                    // suppress errors
                }		
		        return true;
            }
	    }

        var targetServiceFuerVerbraucherForm = document.getElementsByName("service-fuer-verbraucher");
	    
        if (targetServiceFuerVerbraucherForm[0]) {

	        targetServiceFuerVerbraucherForm[0].onsubmit = function() {
		        try {

                    var request = new Crm.Xhr();
		
                    request.open("POST", "/ForwardToCrm.php", false);
		            request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				            
                    var Prospekt01 = '00';
		            var Prospekt02 = '00';
		            var Prospekt03 = '00';
		            var Prospekt04 = '00';
		            var Prospekt05 = '00';
		            var Prospekt07 = '00';
		            var Prospekt08 = '00';
		            var Prospekt09 = '00';
		            var Prospekt10 = '00';
		            var Prospekt11 = '00';

                    if(document.getElementById("anzahlProspekt01").selectedIndex)
			            Prospekt01 = document.getElementById("anzahlProspekt01").options[document.getElementById("anzahlProspekt01").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt02").selectedIndex)
			            Prospekt02 = document.getElementById("anzahlProspekt02").options[document.getElementById("anzahlProspekt02").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt03").selectedIndex)
			            Prospekt03 = document.getElementById("anzahlProspekt03").options[document.getElementById("anzahlProspekt03").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt04").selectedIndex)
			            Prospekt04 = document.getElementById("anzahlProspekt04").options[document.getElementById("anzahlProspekt04").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt05").selectedIndex)
			            Prospekt05 = document.getElementById("anzahlProspekt05").options[document.getElementById("anzahlProspekt05").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt07").selectedIndex)
			            Prospekt07 = document.getElementById("anzahlProspekt07").options[document.getElementById("anzahlProspekt07").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt08").selectedIndex)
			            Prospekt08 = document.getElementById("anzahlProspekt08").options[document.getElementById("anzahlProspekt08").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt09").selectedIndex)
			            Prospekt09 = document.getElementById("anzahlProspekt09").options[document.getElementById("anzahlProspekt09").selectedIndex].text;
		            if(document.getElementById("anzahlProspekt10").selectedIndex)
			            Prospekt10 = document.getElementById("anzahlProspekt10").options[document.getElementById("anzahlProspekt10").selectedIndex].text;
			
		            var postBody = 'form=' + escape('service-fuer-verbraucher')
                        + '&anzahlProspekt01='  + encodeURIComponent(Prospekt01) 
                        + '&anzahlProspekt02=' + encodeURIComponent(Prospekt02) 
                        + '&anzahlProspekt03=' + encodeURIComponent(Prospekt03) 
                        + '&anzahlProspekt04=' + encodeURIComponent(Prospekt04) 
                        + '&anzahlProspekt05=' + encodeURIComponent(Prospekt05) 
                        + '&anzahlProspekt07=' + encodeURIComponent(Prospekt07) 
                        + '&anzahlProspekt08=' + encodeURIComponent(Prospekt08) 
                        + '&anzahlProspekt09=' + encodeURIComponent(Prospekt09) 
                        + '&anzahlProspekt10=' + encodeURIComponent(Prospekt10) 
                        + '&anzahlProspekt11=' + encodeURIComponent(Prospekt11) 
                        + '&Firma=' + encodeURIComponent(document.getElementsByName('Firma')[0].value)
                        + '&Abteilung=' + encodeURIComponent(document.getElementsByName('Abteilung')[0].value)
                        + '&Anrede=' + encodeURIComponent(document.getElementsByName("Anrede")[0].value)
                        + '&Titel=' + encodeURIComponent(document.getElementsByName('Titel')[0].value)
                        + '&VName=' + encodeURIComponent(document.getElementsByName('VName')[0].value)
                        + '&NName=' + encodeURIComponent(document.getElementsByName('NName')[0].value)
                        + '&Strasse=' + encodeURIComponent(document.getElementsByName('Strasse')[0].value)
                        + '&Plz=' + encodeURIComponent(document.getElementsByName('Plz')[0].value) 
                        + '&Ort=' + encodeURIComponent(document.getElementsByName('Ort')[0].value) 
                        + '&Land=' + encodeURIComponent(document.getElementsByName("Land")[0].value)
                        + '&eMail=' + encodeURIComponent(document.getElementsByName('eMail')[0].value) 
                        + '&Telefon=' + encodeURIComponent(document.getElementsByName('Telefon')[0].value) 
                        + '&Telefax=' + encodeURIComponent(document.getElementsByName('Telefax')[0].value);
                    
                    request.send(postBody);

                } catch (ex) {
                    // suppress errors
                }		
		        return true;
            }
	    }

        var targetTtAddressForm = document.getElementsByName("tt_address_form");
	    
        if (targetTtAddressForm[0]) {

	        targetTtAddressForm[0].onsubmit = function() {
		        try {

                    var request = new Crm.Xhr();
		
                    request.open("POST", "/ForwardToCrm.php", false);
		            request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		            var ttAddressForm = document.getElementsByName("tt_address_form")[0];	

                    var title = document.getElementsByName('FE[tt_address][title]')[0];

                    var postBody = 'form=' + escape('tt_address_form')
                        + '&title=' + encodeURIComponent(title.options[title.selectedIndex].text)
                        + '&first_name=' + encodeURIComponent(document.getElementsByName('FE[tt_address][first_name]')[0].value)
                        + '&last_name=' + encodeURIComponent(document.getElementsByName("FE[tt_address][last_name]")[0].value)
                        + '&email=' + encodeURIComponent(document.getElementsByName('FE[tt_address][email]')[0].value)
                        + '&birthday=' + encodeURIComponent(document.getElementsByName('FE[tt_address][birthday]')[0].value);
                    
                    request.send(postBody);

                } catch (ex) {
                    // suppress errors
                }		
		        return true;
            }
	    }
    }  	
  }; 

  try {
	document.execCommand("BackgroundImageCache", false, true);
  } catch(err) {

  }

  function teaserContainerOvrSmall( obj ) {
	  obj.style.cursor='pointer';
	  obj.style.margin='0px 1px 1px 0px';
  }

  function teaserContainerOutSmall( obj ) {
	  obj.style.cursor='pointer';
	  obj.style.margin='1px 0px 0px 1px';
  }
  
  
  function teaserContainerOvrLarge( obj ) {
	  obj.style.cursor='pointer';
	  obj.style.margin='0px 1px 1px 0px';
  }

  function teaserContainerOutLarge( obj ) {
	  obj.style.cursor='pointer';
	  obj.style.margin='1px 0px 0px 1px';
  }
  
  function teaserContainerUp( linkID ) {
	  location.href = '/' + linkID;
  }


  function attention( type ) {
    if ( type=='nl' ) {
      alert('Deze site is uitsluitend bestemd voor artsen,\ndiëtisten en andere paramedici.');
    } else if (type=='fr') {
      alert('Cette partie du site est destiné exclusivement aux médecins,\ndiététicien(ne)s et autres paramédicaux');
    }
  }
  
  
  
  function initializeSearch() {
	  
	  if ( document.getElementById("indexedSearchText") && window.searchString ) {
		  
		  document.getElementById("indexedSearchText").onfocus = function() {
			  var textField = document.forms["indexedsearch"].elements["indexedSearchText"].value;
			  if ( textField == searchString ) {
				  document.forms["indexedsearch"].elements["indexedSearchText"].value = "";
				  document.forms["indexedsearch"].elements["indexedSearchText"].className = "searchText";
			  }
		  }
		  
		  document.getElementById("indexedSearchText").onblur = function() {
			  var textField = document.forms["indexedsearch"].elements["indexedSearchText"].value;
			  if ( textField == "" || textField == searchString ) {
				  document.forms["indexedsearch"].elements["indexedSearchText"].value = searchString;
				  document.forms["indexedsearch"].elements["indexedSearchText"].className = "searchTextEpty";
			  }
		  }
		  
		  document.getElementById("indexedSearchText").onkeydown = function () {
			  var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
			  if (keyCode == 13) {
				  document.forms["indexedsearch"].submit();
				  return false;		
			  }
		  }
		  
		  var textField = document.forms["indexedsearch"].elements["indexedSearchText"].value;
		  if ( textField == "" || textField == searchString ) {
			  document.forms["indexedsearch"].elements["indexedSearchText"].value = searchString;
			  document.forms["indexedsearch"].elements["indexedSearchText"].className = "searchTextEpty";
		  }
	  }	  
  }
  
  /* Funktion für Send-A-Card ##################################################### */
  function printPostcard(url, param) {
	  window.open(url,'PrintCard', param);
	  // return false;
  }
  
// -->
