function mk_code(){
		return true;
		q1=document.getElementById('fight_a').value;
		q2=document.getElementById('fight_b').value;
		
		if(q1==''|| q2==''){
			alert('Bitte beide Felder ausfuellen');
			return false;
		}
		
		if(exact_info==true){
			q1='"'+q1+'"';
			q2='"'+q2+'"';
	
		}
		
		document.getElementById('mk_vs_btn').style.visibility='visible';
		document.getElementById('mk_vs_btn').value=q1+' VS '+q2;
		text='<a href="http://www.ennstal.org/google_fighter.php?q1='+escape(q1)+'&q2='+escape(q2)+'" target="_blank"><img src="http://www.ennstal.org/images/google-fight-promo.jpg" alt="Google-Fighter by egomanie.com" width="143" height="155" hspace="5" border="0" align="left" /></a><strong><a href="http://www.ennstal.org/google_fighter.php?q1='+escape(q1)+'&q2='+escape(q2)+'" target="_blank">Google Fighter</a></strong><br />';
		text+='<em><strong>Tausende Seiten, 2 Begriffe, 1 Kampf.....</strong></em><br />';
		text+='<br />Wolltest Du schon immer wissen, ob <strong>'+q1+' oder '+q2+'</strong> gewinnen w&uuml;rde?<br />';
		text+='Lass die witzigsten Dinge gegen einander in Google antreten und schau was passiert.<br />&Uuml;ber wen gibt es mehr Seiten im Netz?..<br />';
		text+='<br /><a href="http://www.ennstal.org/google_fighter.php?q1='+escape(q1)+'&q2='+escape(q2)+'" target="_blank">www.ennstal.org/google-fighter</a><br clear="all" style="clear:both" />';	
		document.getElementById('fight_html').value=text;
		document.getElementById('code_vorschau').innerHTML=text;
	
}
function mk_standard_code(){
	if(q1 && q2){
		text='<a href="http://www.ennstal.org/google-fighter" target="_blank"><img src="http://www.ennstal.org/images/google-fight-promo.jpg" alt="Google-Fighter by egomanie.com" width="143" height="155" hspace="5" border="0" align="left" /></a><strong><a href="http://www.ennstal.org/google-fighter" target="_blank">Google Fighter</a></strong><br />';
		text+='<em><strong>Tausende Seiten, 2 Begriffe, 1 Kampf.....</strong></em><br />';
		text+='<br />Wolltest Du schon immer wissen, ob <strong>Superman oder Batman</strong> gewinnen w&uuml;rde?<br />';
		text+='Lass die witzigsten Dinge gegen einander in Google antreten und schau was passiert.<br />&Uuml;ber wen gibt es mehr Seiten im Netz?..<br />';
		text+='<br /><a href="http://www.ennstal.org/google-fighter/" target="_blank">www.ennstal.org/google-fighter</a><br clear="all" style="clear:both" />';	
		document.getElementById('fight_html').value=text;
		document.getElementById('code_vorschau').innerHTML=text;
		
	}	
}

function google_fight(var_a,var_b,exact,animate){
	if(!exact)exact=false;
	if(!animate)animate=false;
	document.getElementById('fight_a').value=var_a;
	document.getElementById('fight_b').value=var_b;
	if(exact){
		document.getElementById('exact_1').checked=true;
	}else{
		document.getElementById('exact_0').checked=true;
	}
	if(animate){
		get_google();
	}
	
}

var fight_hoehe=100;
var anim_timer=new Array();
function animate(end_y,bild){
	if(anim_timer[bild])clearTimeout(anim_timer[bild]);		
	elem=document.getElementById(bild);
	if(elem.height==end_y){
		return true;
	}else if(elem.height<end_y){
		dazu=Math.round((end_y-elem.height)/3);
		elem.height+=dazu;
		anim_timer[bild]=window.setTimeout("animate("+end_y+",'"+bild+"')",100);
	}else if(elem.height>end_y){
		dazu=Math.round((elem.height-end_y)/3);
		elem.height-=dazu;
		anim_timer[bild]=window.setTimeout("animate("+end_y+",'"+bild+"')",100);
	}
}
	
function get_google(){	
	q1=document.getElementById('fight_a').value;
	q2=document.getElementById('fight_b').value;
	
	if(q1==''|| q2==''){
		alert('Bitte beide Felder ausfuellen');
		////////// nur fuer den code generator
		document.getElementById('mk_vs_btn').style.visibility='hidden';
		//////////////
		return false;
	}
	
	
	exact_info=document.getElementById('exact_1').checked;
	
	if(exact_info==true){
		q1='"'+q1+'"';
		q2='"'+q2+'"';

	}
	
	
	//// nur fuer den code generator
	mk_code();
	//////////////////////
	
	document.getElementById('google_zahl1').innerHTML='<img src="/images/loader_2.gif" width="14" height="13" />';	
	document.getElementById('google_zahl2').innerHTML='<img src="/images/loader_2.gif" width="14" height="13" />';	

	var ajaxRequest;  // The variable that makes Ajax possible!
	 try{// Opera 8.0+, Firefox, Safari
	   ajaxRequest = new XMLHttpRequest();
	 }catch (e){// Internet Explorer Browsers
	   try{
		  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	   }catch (e) {
		  try{
			 ajaxRequest = new AactiveXObject("Microsoft.XMLHTTP");
		  }catch (e){
			 // Something went wrong
			 alert("Your browser broke!");
			 return false;
		  }
	   }
	 }

 ajaxRequest.onreadystatechange = function(){
   if(ajaxRequest.readyState == 4){
	  var tempText=ajaxRequest.responseText;
	  tempText=tempText.split('||');
	  	tempText[0]=parseInt(tempText[0]);
		tempText[1]=parseInt(tempText[1]);
		if(isNaN(tempText[0]))tempText[0]=0;
		if(isNaN(tempText[1]))tempText[1]=0;
	  	///## färben
		if(tempText[0]>tempText[1]){
			info_a='<span style="color:#CC3300">'+q1+'</span>';
			info_b=q2;
		}else if(tempText[0]<tempText[1]){
			info_a=q1;
			info_b='<span style="color:#CC3300">'+q2+'</span>';
		}else{
			info_a='<span style="color:#CC3300">'+q1+'</span>';
			info_b='<span style="color:#CC3300">'+q2+'</span>';	
		}
		//##
	  	document.getElementById('google_zahl1').innerHTML="<b>"+info_a+"</b><br /><small>"+tempText[0]+" Ergebnisse</small>";
		document.getElementById('google_zahl2').innerHTML="<b>"+info_b+"</b><br /><small>"+tempText[1]+" Ergebnisse</small>";

		if(!tempText[0])tempText[0]=0;
		if(!tempText[1])tempText[1]=0;
		if(tempText[0]>tempText[1]){
			proz=Math.floor(tempText[1]/tempText[0]*100);				
			hoch_2=Math.round(fight_hoehe/100*proz);			
			animate(fight_hoehe,'bild_1');
			animate(hoch_2,'bild_2');	
		}else if(tempText[0]==tempText[1]){
			animate(fight_hoehe/2,'bild_1');
			animate(fight_hoehe/2,'bild_2');
		}else{
			proz=Math.floor((tempText[0]/tempText[1])*100);			
			hoch_2=Math.round(fight_hoehe/100*proz);			
			animate(hoch_2,'bild_1');
			animate(fight_hoehe,'bild_2');		
		}


   }
 }
 //window.open("/action.php?action=google_fight&q1="+escape(q1)+'&q2='+escape(q2));
 ajaxRequest.open("GET", "/action.php?action=google_fight&q1="+escape(q1)+'&q2='+escape(q2), true);
 ajaxRequest.send(null); 
}
function checkKeycode(e) {
	var keycode;
	if (window.event){
		keycode = window.event.keyCode;		
	}else if (e){
		keycode = e.keyCode;
	}	
	return keycode;
}
