window.addEvent('domready', function(){
	var tour_cur='about';
	var mode='home';

	if(mode=='join' || mode=='home')
	{
		$('loginFormTop').style.visibility='hidden';
	}
	else
	{
		$('loginFormTop').style.visibility='visible';
	}
	
	$$('.about').addEvent('mouseover',function(){
		$('faqImg').src='images_home/faq_over.gif';
	});
	$$('.about').addEvent('mouseout',function(){
		if(mode!='about')
		$('faqImg').src='images_home/faq.gif';
	});
	
	$$('.join').addEvent('mouseover',function(){
		$('joinImg').src='images_home/join_over.gif';
	});
	$$('.join').addEvent('mouseout',function(){
		if(mode!='join')
		$('joinImg').src='images_home/join.gif';
	});
	
	$$('.tour').addEvent('mouseover',function(){
		$('tourImg').src='images_home/tour_over.gif';
	});
	$$('.tour').addEvent('mouseout',function(){
		if(mode!='tour')
		$('tourImg').src='images_home/tour.gif';
	});

	$$('.contact').addEvent('mouseover',function(){
		$('contactImg').src='images_home/contactus_over.gif';
	});
	$$('.contact').addEvent('mouseout',function(){
		if(mode!='contactus')
		$('contactImg').src='images_home/contactus.gif';
	});
	
	$$('.products').addEvent('mouseover',function(){
		$('productImg').src='images_home/products_over.gif';
	});
	$$('.products').addEvent('mouseout',function(){
		if(mode!='products')
		$('productImg').src='images_home/products.gif';
	});
	
	$$('.about').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='about';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq_over.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','-3000px');
	});
	
	$('homePageBottom').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='home';
		$('loginFormTop').style.visibility='hidden';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','-1000px');
	});
	
	$('contactUsBottom').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='contactus';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus_over.gif';
		$('splash_wrap').tween('margin-left','-2000px');
	});
	
	$('kocoyMainLogo').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='home';
		$('loginFormTop').style.visibility='hidden';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','-1000px');
	});
	
	$('createAccTour').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccJoin').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccTop10').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccEasySteps').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccEasySteps2').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccEasySteps3').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	$('createAccEasySteps4').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='join';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('splash_wrap').tween('margin-left','1000px');
	});
	
	
$$('.contact').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='contactus';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus_over.gif';
		$('splash_wrap').tween('margin-left','-2000px');
	});
	
	$$('.products').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		mode='products';
		$('loginFormTop').style.visibility='visible';
		$('joinImg').src='images_home/join.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('productImg').src='images_home/products_over.gif';
		$('splash_wrap').tween('margin-left','2000px');
	});

	$$('.join').addEvent('click',function(){
		$('error').innerHTML='';
		if($('floaty'))
			$('floaty').dispose();
		$('splash_wrap').tween('margin-left','1000px');
		mode='join';
		$('loginFormTop').style.visibility='hidden';
		$('joinImg').src='images_home/join_over.gif';
		$('faqImg').src='images_home/faq.gif';
		$('tourImg').src='images_home/tour.gif';
		$('productImg').src='images_home/products.gif';
		$('contactImg').src='images_home/contactus.gif';
		$('reg_wrap').tween('margin-left','0px');
	});
	
	$$('.tour').addEvent('click',function(){
		$('error').innerHTML='';
		if(mode!='tour'){
			mode='tour';
			$('loginFormTop').style.visibility='visible';
			$('joinImg').src='images_home/join.gif';
			$('faqImg').src='images_home/faq.gif';
			$('tourImg').src='images_home/tour_over.gif';
			$('productImg').src='images_home/products.gif';
			$('contactImg').src='images_home/contactus.gif';
			$('splash_wrap').set('tween',{onComplete:function(){
				var floaty=new Element('div',{'id':'floaty'});
				floaty.grab(new Element('div',{'id':'inner'}));
				
				var current=$('bubble').getChildren('div.current')[0]; 
				
				// Setting the sub menu as selected // 
				$$('div#bubble div.current').tween('color','#86c221');
				/////////////////////////////////////
				
				$('bubble').grab(floaty);
				
				floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
			
				var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
				
				$$('div#bubble div').addEvents({
					'mouseenter':function(){
						bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
					},
					'mouseleave':function(){
						bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
					}
				});
				
				$('splash_wrap').set('tween',{onComplete:function(){return;}});
			}}).tween('margin-left','0px');
		}
	});

	$$('div#bubble div').addEvent('click',function(){
		var tour_new=this.innerHTML.toLowerCase();
		if(tour_new=='4 easy steps') tour_new='4_easy_steps';
		if(tour_new=='kocoy vs. local hvac supply house') tour_new='kocoy_vs_hvac';
		if(tour_new=='top 10 reasons to join kocoy') tour_new='top_reasons';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=this;
			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
		
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
		}
	});
	
	
	$('nextEasySteps').addEvent('click',function(){
		
		tour_new='4_easy_steps';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('EasyStepBack').addEvent('click',function(){
		
		tour_new='about';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('abt');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});

	$('EasyStep2').addEvent('click',function(){
		
		tour_new='4_easy_steps_2';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('EasyStep2Back').addEvent('click',function(){
		
		tour_new='4_easy_steps';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});

	$('EasyStep3').addEvent('click',function(){
		
		tour_new='4_easy_steps_3';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('EasyStep3Back').addEvent('click',function(){
		
		tour_new='4_easy_steps_2';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});

	$('EasyStep4').addEvent('click',function(){
		
		tour_new='4_easy_steps_4';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('EasyStep4Back').addEvent('click',function(){
		
		tour_new='4_easy_steps_3';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});

	$('kocoyVsHvac').addEvent('click',function(){
		
		tour_new='kocoy_vs_hvac';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('kocoyLocal');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('kocoyVsHvacBack').addEvent('click',function(){
		
		tour_new='4_easy_steps_4';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('easyStep');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('moveTop10').addEvent('click',function(){
		
		tour_new='top_reasons';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('top10');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	$('moveTop10Back').addEvent('click',function(){
		
		tour_new='kocoy_vs_hvac';
		
		if(tour_new!=tour_cur){
		
			$$('div#bubble div').removeEvents('mouseenter','mouseleave');
			
			$('floaty').dispose();
			
			var floaty=new Element('div',{'id':'floaty'});
			floaty.grab(new Element('div',{'id':'inner'}));
			
			var current=document.getElementById('kocoyLocal');

			// Setting the color back to show menu item as unselected //
			$$('div#bubble div.current').tween('color','#c2e090');
			
			$$('div#bubble div.current').removeClass('current');
			current.addClass('current');
			// Setting the color to show menu item as selected //
			$$('div#bubble div.current').tween('color','#86c221');
			
			$('bubble').grab(floaty);
			
			floaty.setStyles({'width':current.offsetWidth-9,'left':current.offsetLeft-2}).setStyle('visibility','visible');
		
			var bubble=new Fx.Morph('floaty',{duration:500,transition:'back:out',wait:false});	
			
			$$('div#bubble div').addEvents({
				'mouseenter':function(){
					bubble.start({'left':this.offsetLeft-2,'width':this.offsetWidth-9});
				},
				'mouseleave':function(){
					bubble.start({'left':current.offsetLeft-2,'width':current.offsetWidth-9});
				}
			});
	
			$(tour_cur).tween('opacity',1,0);
			$(tour_new).tween('opacity',0,1);
			tour_cur=tour_new;
			
		}
	});
	
	$('clearContactForm').addEvent('click',function(){
		$('u_email').value='';
		$('u_sub').value='';
		$('u_query').value='';
		$('u_email').focus();
	});
	
	$('contForm').addEvent('submit',function(e){
		
		e.stop();
		
		if(!($('u_email').value).test("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$")){
			//$('errorContact').innerHTML='<p>Invalid email address. Please try again.</p>';
			alert("Invalid Email Address. Please try again.");
			$('u_email').value='';
			$('u_email').focus();
		}
		else if($('u_sub').value==""){
			//$('error').innerHTML='<p>Please provide the subject.</p>';
			alert("Please provide the subject.");
			$('u_sub').focus();
		}
		else if($('u_query').value==""){
			//$('error').innerHTML='<p>Please provide your Queries.</p>';
			alert("Please provide your Queries.");
			$('u_query').focus();
		}
		else
		{
		 
			var u_email=encodeURIComponent($('u_email').value)
			var u_sub=encodeURIComponent($('u_sub').value)
			var u_query=encodeURIComponent($('u_query').value)
			var parameters="u_email="+u_email+"&u_sub="+u_sub+"&u_query="+u_query
			
			if(window.ActiveXObject)
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			if(window.XMLHttpRequest)
				xmlHttp=new XMLHttpRequest();

			url = "contactForm.php";
			xmlHttp.open("POST",url,true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", parameters.length);
			xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
				if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {

					$('u_email').value='';
					$('u_sub').value='';
					$('u_query').value='';

					$('errorContact').innerHTML=xmlHttp.responseText;
				}
				else
				{
					$('errorContact').innerHTML="<img src='../images_home/spinner.gif'>";
				}
			}
		//	xmlHttp.onreadystatechange=handleStateChange;
			xmlHttp.send(parameters);
		
		}
	});
	
	$('loginTop').addEvent('submit',function(e){
		if(!($('login').value).test("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$")){
			//$('errorContact').innerHTML='<p>Invalid email address. Please try again.</p>';
			e.stop();
			alert("Invalid Email Address. Please fill a valid email address");
			$('login').value='';
			$('login').focus();
		}
		else if($('passwd').value==""){
			e.stop();
			//$('error').innerHTML='<p>Please provide the subject.</p>';
			alert("Please enter your password.");
			$('passwd').focus();
		}
		else {
			
			var login=encodeURIComponent($('login').value)
			var passwd=encodeURIComponent($('passwd').value)
			var parameters="login="+login+"&passwd="+passwd
			var resp=1;
			
			if(window.ActiveXObject)
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			if(window.XMLHttpRequest)
				xmlHttp=new XMLHttpRequest();
		
			url = "loginValidate.php";
			xmlHttp.open("POST",url,true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", parameters.length);
			xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
				if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
					resp=xmlHttp.responseText;
				}
			}
		//	xmlHttp.onreadystatechange=handleStateChange;
			xmlHttp.send(parameters);

			if(resp!=1)
			{
				alert("Incorrect username or password. Please enter a valid username or password.");
				e.stop();
			}
		}
	});

	
	$('fadebox_show').addEvent('click',function(){
		$('fadebox').setStyle('left',(document.body.clientWidth-400)/2+'px');
		$('dim').setStyle('display','block').tween('opacity',0,1);
	});
	
	$('fadebox_hide').addEvent('click',function(){
		$('dim').tween('opacity',1,0,{onComplete:function(e){e.setStyle('display','none')}});
	});
	
	$('recover').addEvent('click',function(){
		$('dim').tween('opacity',1,0,{onComplete:function(e){e.setStyle('display','none')}});
		$('pw_form').set('send',{onSuccess:function(resp){$('error').innerHTML=resp;}});
		$('pw_form').send();
	});
	
	$('fadebox_show_jp').addEvent('click',function(){
		$('fadebox').setStyle('left',(document.body.clientWidth-400)/2+'px');
		$('dim').setStyle('display','block').tween('opacity',0,1);
	});
	
	$('loginFormJP').addEvent('submit',function(e){
		if(!($('loginJP').value).test("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$")){
			//$('errorContact').innerHTML='<p>Invalid email address. Please try again.</p>';
			e.stop();
			alert("Invalid Email Address. Please fill a valid email address");
			$('loginJP').value='';
			$('loginJP').focus();
		}
		else if($('pwdJP').value==""){
			e.stop();
			//$('error').innerHTML='<p>Please provide the subject.</p>';
			alert("Please enter your password.");
			$('pwdJP').focus();
		}
		else {
			
			var login=encodeURIComponent($('loginJP').value)
			var passwd=encodeURIComponent($('pwdJP').value)
			var parameters="login="+login+"&passwd="+passwd
			var resp=1;
			
			if(window.ActiveXObject)
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			if(window.XMLHttpRequest)
				xmlHttp=new XMLHttpRequest();

			url = "loginValidate.php";
			xmlHttp.open("POST",url,true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", parameters.length);
			xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
				if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
					var resp=xmlHttp.responseText;
				}
			}
		//	xmlHttp.onreadystatechange=handleStateChange;
			xmlHttp.send(parameters);

			if(resp!=1)
			{
				alert("Incorrect username or password. Please enter a valid username or password.");
				e.stop();
			}
		}
	});

});