jQuery.noConflict();

	var timeout    = 500;
	var closetimer = 0;
	var Fusedmenuitem = 0;
	var Fusedmenuitemname = 0;
	var validationErrors = Array();
	var skipArray = ['your phone number', 'preffered time of day', 'Enter your request here....', 'Enter you e-mail'];
	
	function in_array( what, where ){
		for(var i=0;i<where.length;i++){
		  if(what == where[i]){
		    return true;
	        break;
		  }
		}
		return false;
	}
// FUSED DROPDOWN MENU
	function FusedMenu_open()
	{  FusedMenu_canceltimer();
	   
	   if(this.id == Fusedmenuitemname){
	   	Fusedmenuitemname = this.id;
	   	Fusedmenuitem = jQuery('ul:first',this);
	   } else {
	   	 FusedMenu_close();
   	  	 Fusedmenuitemname = this.id;	
	   	 Fusedmenuitem = jQuery('ul:first',this);
	   }
	   Fusedmenuitem.slideDown("fast");
	}
	
	function FusedMenu_close()
	{  if(Fusedmenuitem) 
			Fusedmenuitem.slideUp("fast");
	   if(Fusedmenuitem)
	   	jQuery('#'+ Fusedmenuitemname).find('a:first').removeClass('mover');
	}
	
	function FusedMenu_timer()
	{  closetimer = window.setTimeout(FusedMenu_close, timeout);}
	
	function FusedMenu_canceltimer()
	{  if(closetimer)
	   {  window.clearTimeout(closetimer);
	      closetimer = null;}}

//FORM VALIDATION
	function validateForm(){
		if(validationErrors.length > 0){
			jQuery.each(validationErrors, function( intIndex, objValue ){
				jQuery(".object-"+objValue).parent().addClass("form-input-error");
			});	
		}
	}
	
	jQuery.fn.ajaxSubmit = function(e) {
		
		// Change a form's submission type to ajax 
		this.submit(function(){
			var params = {};
	    jQuery(this)
	    .find("input,:selected, textarea")
	    //.filter(":enabled")
	    .each(function() {
	      if(in_array(this.value, skipArray))
	      	params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = '';
	      else
	      	params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value;
	    });
	    jQuery("body").addClass("curWait");
	    current_div = "div#fancy_content li." + this.id + "-inner";
	    jQuery(current_div).html("");
	    jQuery("#fancy_loading").show();
	    jQuery.each(validationErrors, function( intIndex, objValue ){
			jQuery(".object-"+objValue).parent().removeClass("form-input-error");
		});	
		
		
	   	jQuery.post(this.getAttribute("action"), params, function(responseData){
	   		
			jQuery("body").removeClass("curWait");
			strError = "Unable to submit form. Please try again later.";
			jQuery("#fancy_loading").hide();
			jQuery(current_div).append(responseData).show('fast', function(){jQuery(current_div + " form").ajaxSubmit();
			validateForm();
		});
	 		
			
			
		}, "html");
		return false;
	});
	return this;
}
	

	
jQuery(document).ready(function(){
	FLIR.init( { path: '/facelift/' } );
	
	jQuery(".din-15-black").each( function() { FLIR.replace(this, new FLIRStyle({ cFont:'dinmedalt' ,cSize:'20',cColor:'black', mode:'wrap' })); } );
	jQuery(".din-15-blue").each( function() { FLIR.replace(this, new FLIRStyle({ cFont:'dinmedalt' ,cSize:'20' ,cColor:'355654'})); } );
	jQuery(".din-18-blue").each( function() { FLIR.replace(this, new FLIRStyle({ cFont:'dinmedalt' ,cSize:'24' ,cColor:'355654', mode:'wrap' })); } );
	jQuery(".din-19-blue").each( function() { FLIR.replace(this, new FLIRStyle({ cFont:'dinmedalt' ,cSize:'25' ,cColor:'355654', mode:'wrap' })); } );
	jQuery(".din-23-blue").each( function() { FLIR.replace(this, new FLIRStyle({ cFont:'dinmedalt' ,cSize:'31' ,cColor:'355654', mode:'wrap' })); } );
	
	jQuery('.topmenu-design > ul > li').mouseover(function(){
		jQuery(this).find('a:first').addClass('mover');
	}).mouseout(function(){
		jQuery(this).find('a:first').removeClass('mover');
	});
	
	jQuery('.faq-title').click(function(){

		jQuery(this).parent().children('.attribute-answer').toggle();
	});
	jQuery('.topmenu-design > ul > li').bind('mouseover', FusedMenu_open);
    jQuery('.topmenu-design > ul > li').bind('mouseout',  FusedMenu_timer);
	jQuery("div.contactform a").fancybox({
		'frameWidth': 827, 
		'frameHeight': 477,
		'zoomSpeedIn':	300,
		'overlayShow': true,  
		'zoomSpeedOut':	0
	});
	
});
document.onclick = FusedMenu_close;

