Cufon.replace('#logo a,#logo a span,h1,h2,h3,h4,#top-phone,#top-email,label,.action span', {fontFamily: 'Comfortaa'} );

var $ = jQuery.noConflict();

$(document).ready(function() {
	
		$('a.action,#fsocial li a img,.bigsubmit,.smallsubmit').hover(function(){
			$(this).animate({opacity: 0.7}, 300);
		}, function () {
			$(this).animate({opacity: 1}, 300);
		});
		
		$('.pgallery li a').mouseenter(function(e) {
            $(this).children('img').animate(200);
            $(this).children('span').fadeIn(300);
        }).mouseleave(function(e) {
            $(this).children('img').animate(200);
            $(this).children('span').fadeOut(300);
        });
		
		
		$('.ntip').tipsy({gravity: 's', fade:true});
		$('.stip').tipsy({gravity: 'n', fade:true});
		$('.etip').tipsy({gravity: 'w', fade:true});
		$('.wtip').tipsy({gravity: 'e', fade:true});
		
		
		$('#offerslide').cycle({ 
        	fx:'scrollLeft,scrollDown,scrollRight,scrollUp',
			timeout:3000,
			easing:'easeInOutBack', // easing supported via the easing plugin	
			pager:'.slidernav',
	        prev:    '#slidernavp',
	        next:    '#slidernavn',
	        pause: 1,
	        cleartypeNoBg: true,
			// callback fn that creates a thumbnail to use as pager anchor 
			pagerAnchorBuilder: function(idx, slide) { 
				return '<li><a href="#"></a></li>';
			}
    	});
    	
    	$('.twitterfeed ul,.testimonials').cycle({ 
        	fx:'scrollUp',
			timeout:5000,
			easing:'easeInOutBack',
	        cleartypeNoBg: true	
    	});
    	
    	$('.twitterfeed ul,.testimonials').hover(function() { 
    		$(this).cycle('pause');
		}, function() { 
    		$(this).cycle('resume'); 
		});
		
		$('.slidernav li a,#slidernavp,#slidernavn').click(function() { 
    		$('#offerslide').cycle('pause'); 
		});
		
		$('#offerslider').hover(function() { 
    		$('#slidernavp,#slidernavn').fadeIn('slow');
		}, function() { 
    		$('#slidernavp,#slidernavn').fadeOut('slow'); 
		});
		
		$('#pgallery li a').mouseenter(function(e) {
            $(this).children('img').animate(300);
            $(this).children('span').fadeIn(400);
        }).mouseleave(function(e) {
            $(this).children('img').animate(300);
            $(this).children('span').fadeOut(400);
        });
			
		$("a[rel^='prettyPhoto']").prettyPhoto({
			animation_speed: 'normal',
			theme: 'dark_rounded'
			});
			
		$('input[type="text"],select,textarea').focus(function () {
			$(this).removeClass("inputerror");
		});
			
});


$(document).ready(function() {

		$('#quote_form-submit').click(function () {
          
        //Get the data from all the fields
        
        var regemail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  		 
        var ajaxquote_name = $('input[name="quote_form-name"]');
        var ajaxquote_email = $('input[name="quote_form-email"]');
        var ajaxquote_phone = $('input[name="quote_form-phone"]');
        var ajaxquote_company = $('input[name="quote_form-company"]');
        var ajaxquote_website = $('input[name="quote_form-website"]');
        

// var ajaxquote_pages = $('select[name="quote_form-pages"]');
   
//     var ajaxquote_budget = $('select[name="quote_form-budget"]');
 

         
        if (ajaxquote_name.val()=='') {
            ajaxquote_name.addClass('inputerror');
            return false;
        } else ajaxquote_name.removeClass('inputerror');
        
        if (ajaxquote_email.val()=='') {
            ajaxquote_email.addClass('inputerror');
            return false;
        } else ajaxquote_email.removeClass('inputerror');
        
        if (ajaxquote_phone.val()=='') {
            ajaxquote_phone.addClass('inputerror');
            return false;
        } else ajaxquote_phone.removeClass('inputerror');
        
        if (ajaxquote_company.val()=='') {
            ajaxquote_company.addClass('inputerror');
            return false;
        } else ajaxquote_company.removeClass('inputerror');
        
        if (ajaxquote_website.val()=='') {
            ajaxquote_website.addClass('inputerror');
            return false;
        } else ajaxquote_website.removeClass('inputerror');
        
        if (ajaxquote_pages.val()=='') {
            ajaxquote_pages.addClass('inputerror');
            return false;
        } else ajaxquote_pages.removeClass('inputerror');
        
        if (ajaxquote_budget.val()=='') {
            ajaxquote_budget.addClass('inputerror');
            return false;
        } else ajaxquote_budget.removeClass('inputerror');
		
		if(regemail.test(ajaxquote_email.val()) == false) {
  			ajaxquote_email.addClass('inputerror');
            return false;
        } else ajaxquote_email.removeClass('inputerror');
        
        
        var data = $('#quote_form').serialize();
          
        //start the ajax  
        $.ajax({  
            //this is the php file that processes the data and send mail  
            url: "quoteform.php",   
              
            //GET method is used  
            type: "GET",  
  
            //pass the data           
            data: data,       
              
            //Do not cache the page  
            cache: false,  
              
            //success  
            success: function (html) {                
                //if process.php returned 1/true (send mail success)  
                if (html==1) {                    
                    //hide the form  
                    $('#quote_form').hide();                   
                      
                    //show the success message  
                    $('#quote_form-successmsg').fadeIn('slow');  
                      
                //if process.php returned 0/false (send mail failed)  
                } else alert('Sorry, unexpected error. Please Refresh the Page & Try Again.');                 
            }         
        });  
          
        //cancel the submit button default behaviours  
        return false;
        
        });
        
        
        
        $('#newsletter_form-submit').click(function () {
          
        //Get the data from all the fields
        
        var regemail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        
        //Getting the Form Fields and Storing it into a Javascript Variable
        
        var ajaxnewsletter_email = $('input[name="newsletter_form-email"]');
        
        //Starting the Validation
        
        if (ajaxnewsletter_email.val()=='') {
            ajaxnewsletter_email.addClass('inputerror');
            return false;
        } else ajaxnewsletter_email.removeClass('inputerror');
        
		if(regemail.test(ajaxnewsletter_email.val()) == false) {
  			ajaxnewsletter_email.addClass('inputerror');
            return false;
        } else ajaxnewsletter_email.removeClass('inputerror');
        
        //Ending the Validation
        
        
        
        //Storing All the Form Values into a Javascript Variable
        
        var data = $('#newsletter_form').serialize();
          
        //start the ajax  
        $.ajax({  
            //this is the php file that processes the data and send mail  
            url: "newsletter.php",   
              
            //GET method is used  
            type: "GET",  
  
            //pass the data           
            data: data,       
              
            //Do not cache the page  
            cache: false,  
              
            //success  
            success: function (html) {                
                //if process.php returned 1/true (send mail success)  
                if (html==1) {                    
                    //hide the form  
                    $('#subscribe').hide();                   
                      
                    //show the success message  
                    $('#newsletter_form-successmsg').fadeIn('slow');  
                      
                //if process.php returned 0/false (send mail failed)  
                } else alert('Sorry, unexpected error. Please Refresh the Page & Try Again.');                 
            }         
        });  
          
        //cancel the submit button default behaviours  
        return false;
        
        });

});
