/*jQuery stats starts here */
$(document).ready(function() {
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery);		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});			
		} else { //If row does not exist...			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});			
		}
	}	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
	$("#quote-link").click(function(){
		$("#quote-content").toggle("slow");
	})
	$('#testimonials-slider').innerfade({ speed: 'slow', timeout: 6000, type: 'sequence'});
    
    /*$("#form-feedback").validate({                        
            rules: {                           
                security_code: {
				    required: true,                
                    equalTo: "#captchacode"		
			     }
    		},
    		messages: {   		    
                security_code: {
				    required: '<div class=\"errorForm\">Please insert a Captcha !</div>',
                    equalTo: '<div class=\"errorForm\">Captcha Code is Not Matching !</div>',
                }
    		  }
    	   });
    
    $("#form-contact").validate({                        
            rules: {                           
                security_code: {
				    required: true,                
                    equalTo: "#captchacode"		
			     }
    		},
    		messages: {   		    
                security_code: {
				    required: '<div class=\"errorForm\">Please insert a Captcha !</div>',
                    equalTo: '<div class=\"errorForm\">Captcha Code is Not Matching !</div>',
                }
    		  }
    	   }); */
});


/*jQuery stats ends here */
/* focus and blur javascript of domain search input starts here */

function inputSearch(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Search')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Search';
}

function newsletterName(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Name')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Name';
}

function newsletterEmail(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Email')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Email';
}

/* focus and blur javascript of newsletter input starts here */
/* focus and blur javascript of quote section starts here */

function inputName(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Name')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Name';
}

function inputEmail(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Email')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Email';
}

function inputPhone(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Phone')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Phone';
}

function inputBudget(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Budget')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Budget';
}

function inputDescription(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Project Description')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Project Description';
}

