//E-legance.org
   function ajaxLoader(url,id)
	{
		if (document.getElementById) {
			var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			}
			if (x)
				{
			x.onreadystatechange = function()
					{
				if (x.readyState == 4 && x.status == 200)
						{
						el = document.getElementById(id);
						el.innerHTML = x.responseText;
					}else{
						el.innerHTML = '<span class="loading">зареждане</span>';
						
					}
					}
				x.open("GET", url, true);
				x.send(null);
				}
	    }
		
window.addEvent('domready', function(){
		if($('query_link')!=null){
					$('query_link').addEvent('click',function(){
						var form=$('query');
						var other_form=$('friend');
						form.setStyle('display','block');
						var myEffects = form.effects({wait:true, duration: 500, transition: Fx.Transitions.Sine.easeInOut});var myEffects2 = other_form.effects({wait:true, duration: 500, transition: Fx.Transitions.Sine.easeInOut});
						//check other form
						if(other_form.getStyle('height').toInt()>20){
							myEffects2.start({
								'height':[0],
								'opacity':[1,0]
							});
							
							other_form.setStyle('display','none');
						}
						if(form.getStyle('height').toInt()<250){
							form.setStyle('opacity',0);
							myEffects.start({
								'height':[0,250],
								'opacity':[0,1]
							});
						}else{
							myEffects.start({
								'opacity':[1,0],
								'height':[250,0]
							});
						} 
					
					});
					
					//send
					
					
					$('friend_link').addEvent('click',function(){
						var form=$('friend');
						var other_form=$('query');
						form.setStyle('display','block');
						var myEffects = form.effects({wait:true, duration: 500, transition: Fx.Transitions.Sine.easeInOut});
						var myEffects2 = other_form.effects({wait:true, duration: 500, transition: Fx.Transitions.Sine.easeInOut});
						//check other form
						if(other_form.getStyle('height').toInt()>20){
							myEffects2.start({
								'height':[0],
								'opacity':[1,0]
							});
							other_form.setStyle('display','none');
							
						}
						if(form.getStyle('height').toInt()<270){
							form.setStyle('opacity',0);
							myEffects.start({
								'height':[0,270],
								'opacity':[0,1]
							});
						}else{
							myEffects.start({
								'opacity':[1,0],
								'height':[270,0]
							});
						} 
					
					});
					
					
				}
				
			
});
