/*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';
}
function newsletterPhone(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Phone')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Phone';
}
function newsletterCompany(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Company')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Company';
}
function newsletterCity(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='City')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='City';
}
function newsletterState(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='State')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='State';
}
function newsletterCountry(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Country')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Country';
}
function newsletterWebsite(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Website')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Website';
}
function newsletterApplication(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Application')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Application';
}
function newsletterJob(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Job')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Job';
}
function newsletterStart(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Start')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Start';
}
function newsletterEnd(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='End')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='End';
}
function newsletterEstimation(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Estimation')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Estimation';
}
function newsletterOs(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Os')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Os';
}
function newsletterTools(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Tools')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Tools';
}
function newsletterReference(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Reference')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Reference';
}
function newsletterCode(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Code')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Code';
}


/* 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 inputCompany(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Company Name*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Company Name*';
}
function inputCity(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your City*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your City*';
}
function inputState(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your State')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your State';
}
function inputCountry(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Country*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Country*';
}
function inputWebsite(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Corporate Website Name')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Corporate Website Name';
}
function inputApplication(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Application Type*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Application Type*';
}
function inputJob(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Your Job Type*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Your Job Type*';
}
function inputStart(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Project Start time')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Project Start time';
}
function inputEnd(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Project End time')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Project End time';
}
function inputEstimation(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Preliminary Estimation*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Preliminary Estimation*';
}


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 inputOs(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Operating System')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Operating System';
}
function inputTools(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Tools')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Tools';
}
function inputReference(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Reference Sites')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Reference Sites';
}

function inputCode(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Captcha Code*')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Captcha Code*';
}
function inputDescription(inputID){
	var inputID = document.getElementById(inputID)
	if (inputID.value=='Enter Project Requirement')	
		inputID.value='';
	else if(inputID.value=='')
		inputID.value='Enter Project Requirement';
}
