  //<[CDATA[

  var dinlight = {
    src: '/sifr/demo/dinlight.swf'
	  };

  // You probably want to switch this on, but read <http://wiki.novemberborn.net/sifr3/DetectingCSSLoad> first.
  // sIFR.useStyleCheck = true;
  
/*  sIFR.activate(dinlight);*/

  sIFR.delayCSS  = true;
  sIFR.fixFocus  = true;
 /* sIFR.prefetch(dinlight);*/
  sIFR.activate(dinlight);


  sIFR.replace(dinlight, {
    selector: '#teaser h1'
    ,css: [
      '.sIFR-root { text-align: right; font-weight: normal;color: #FFFFFF;font-size:28px; }'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #FFFFFF; }'
      ,'a:hover { color: #CCCCCC; }'
    ],
	wmode: 'transparent'
  });
  
    sIFR.replace(dinlight, {
    selector: '#content h1'
    ,css: [
      '.sIFR-root { text-align: left; font-weight: normal; color:#AA0715; font-size:34px;}'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #000000; }'
      ,'a:hover { color: #CCCCCC; }'
    ],
	wmode: 'transparent'
  });
  
    sIFR.replace(dinlight, {
    selector: '#header li.haupt'
    ,css: [
      '.sIFR-root { text-align: left; font-weight: normal; color:#FFFFFF; font-size:19px;}'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #FFFFFF; }'
      ,'a:hover { color: #E42E2C; }'
	  ,'a:active { color: #E42E2C; }'
    ],
	wmode: 'transparent',
    fixFocus: true 
  });
	
			sIFR.replace(dinlight, {
			selector: '#header li.hauptcurrent'
			,css: [
			  '.sIFR-root { text-align: left; font-weight: normal; color:#E42E2C; font-size:19px;}'
			  ,'a { text-decoration: none; }'
			  ,'a:link { color: #E42E2C; }'
			  ,'a:hover { color: #E42E2C; }'
			  ,'a:active { color: #E42E2C; }'
			],
			wmode: 'transparent',
   			fixFocus: true 
		  });	
      
/*	sIFR.replace(dinlight, {
    selector: '#header li'
    ,css: [
      '.sIFR-root { text-align: left; font-weight: normal; color:#FFFFFF;font-size:14px; line-height:0px;color: #FFFFFF; }'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #FFFFFF; }'
      ,'a:hover { color: #E42E2C; }'
	  ,'a:active { color: #E42E2C; }'
    ],
   wmode: 'transparent',
   fixFocus: true 
  });  */


  //]]>

<!-- ADCONVERSE -->

var update = "";
var numberField = "adconverse_number";
var lastResult = "";
var boDebugmode = false;


window.onload = function()
{
	//alert(window.location.hash);
	if(window.location.hash == '#debugmode')
	{
		boDebugmode = true;
		alert(window.name);
	}
	
	if(window.name.indexOf("adc:number")==-1)
	{
		var keywords;
		var keyword = "";
		if (document.referrer || window.name.indexOf("adc:referer")!=-1) 
		{
			var referer;
			
			if(window.name.indexOf("adc:referer")!=-1)
			{
				referer = window.name.substring(11);
			}
			else
			{
				referer = document.referrer;
				window.name = "adc:referer=" + document.referrer;
			}
			//alert(referer);
			
			var pos = referer.indexOf("?");

			if(pos!=-1)
			{
				var ref = referer.substring(pos+1);
				keywords = ref.split("&");
				
				for(var i=0;i<keywords.length;i++)
				{
					if(keywords[i].indexOf("q=")==0)
					{
						keyword = keywords[i].substring(2,keywords[i].length);
					}
					else if(keywords[i].indexOf("kword=")==0)
					{
						keyword = keywords[i].substring(6);
					}					
				}
				fetchNumber(keyword);
			}
		}
	}
	else
	{
		document.getElementById(numberField).innerHTML = window.name.split("=")[1];
	}
}

function trim (zeichenkette) 
{
	return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '');
}


function fetchNumber(keyword)
{
	updateResults("http://www.ranking-check.de/fetchNumber.php",numberField,'','keywords='+keyword);
}

function handleHttpResponse() 
{
  try
  {
	  if (http.readyState == 4) 
	  {
			if(http.status==200)
			{
				//lastResponse = http.responseText;
		  		try
		  		{
		  			var res = trim(http.responseText);
		  			
		  			res = res.substring(0,4) + " / " + res.substring(4,7) + " " + res.substring(7,10) + " " + res.substring(10,res.length); 
		  			
		  			document.getElementById(numberField).innerHTML = res;
		  			lastResult = res;
		  			window.name = "adc:number=" + res;
  		    	}
  		    	catch(e)
  		    	{
  		    		//alert('Kann Element nicht finden ' + e);
  		    	}
		    }
		    else
		    {
		    	document.getElementById(update).innerHTML = http.status;
		    }
	   }
	   iStatus = http.status;
	}
	catch(f)
	{
		//alert(f);
	}
}

function updateResults(sFile,sUpdate,session,query)
{
	doRequest(sFile,sUpdate,session,query,-1);
}

function doRequest(sFile, sUpdate, session,query,delay)
{
	http = getHTTPObject(); 
	update = sUpdate;
	var i = 0;
	try
	{
		
		theURL = sFile;
		if(theURL.indexOf("?")!=-1)
		{
			theURL = theURL.substring(0,sFile.indexOf("?"));
		}
		i = '1';
		if(session!=''&& sFile.indexOf("jsessionid")==-1)
		{
			theURL+=";jsessionid=" + session;
			//theURL+= "?sDesign=Direct&" + query;
		}
		else
		{
			if(theURL.indexOf("?")==-1)
			{
				theURL += "?";
			}
			//theURL+= "sDesign=Direct&" + query;
		}
		//alert(theURL);
		i = '2';
		
		//document.write(theURL);
		//var searchQuery = document.getElementById(submit).value;
		i = '3';
			http.onreadystatechange = handleHttpResponse;	
			
  		i='4';
  		//if(sUpdate!='handlerState')
  		{
  			http.open("POST", theURL, true);
  			http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				http.setRequestHeader("Content-length", query.length);
				http.setRequestHeader("Connection", "close");
  			
  			i = '5';
  		}
  		http.send(query);
  		i = '6'
  		//alert(theURL + ' ' + i);
  	}
  	catch(e)
  	{
  		alert(e + ' ' + i + ' ' + theURL );
  	}
}

function getHTTPObject() {
	  var xmlhttp;
	  try {
	    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (e) {
	     try {
	        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	     } catch (E) {
	        xmlhttp = false;
	     }
	  }
	
	  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	    try {
	      xmlhttp = new XMLHttpRequest();
	      xmlhttp.overrideMimeType('text/html');
	    } catch (e) {
	      xmlhttp = false;
	    }
	  }
	
	  return xmlhttp;
	}
