// JavaScript Document

// Cufon fonts replace

Cufon.replace('h1, h2, h3, h4, a, button, ul.price, .contactformbox h3', {
            fontFamily:'Museo Sans',
			textShadow:'1px 1px 1px #ffffff',
			hover: { color: '#3a7fae'} //default link color hover
			});
Cufon.replace('ul.price li.cost', {
            fontFamily:'Museo Sans',
			textShadow:'0px 1px 1px #ffffff'
			});			
Cufon.replace('.slider-text h1', {
            fontFamily:'Museo Sans',
			textShadow:'1px 1px 1px #444444'
			});
Cufon.replace('.fbox h5,.footerform button, #newssend button', {
            fontFamily:'Museo Sans',
			textShadow:'1px 1px 1px #000000'
			});

$(document).ready(function(){
						 

	// Customize bg cost color Price Tabs
	
    var bgcosthov = { backgroundColor:'#4396cf'}; //hover mouse
	var bgcostout = { backgroundColor:'#3a7fae'}; //out mouse (default)
	
    //Slider head
	
    $('#sliders').cycle({ 
	    fx:'fade', 
    	speed:500, 
    	timeout:5000,  
    	pause:1,
		next:'#slider-show-next', 
	    prev:'#slider-show-prev'
	});
	
	$('#slider-show-next,#slider-show-prev').hide();
	$('#slider').hover(
		function() {
		  $('#slider-show-next,#slider-show-prev').stop().fadeTo(500, 1);
		},
		function() {
		  $('#slider-show-next,#slider-show-prev').stop().fadeTo(500, 0);
	   });
	
	// Form head open/close

	$(".close").click(function(){
	    $('.close').toggleClass("open");
		$('#head-form').toggle(550, function() {
		 });
		return false;
	});
	
	//PrettyPhoto activation
	
	$("a[rel^='prettyPhoto']").prettyPhoto();
	$('.gallery li').hover(
		function() {
		  $(this).find('img').fadeTo(300, 0.5);
		  $(this).children('.zoom').fadeIn(300).animate({bottom:"+=10px"},500);
		},
		function() {
		  $(this).find('img').fadeTo(300, 1);
		  $(this).children('.zoom').fadeOut(300).animate({bottom:"10px"},500);
	   });
	
	//jQuery tabs control

	 var pagecont = $('div#aboutus div[id]');
	 pagecont.hide().filter(':first').show(100);
		$('div#aboutus ul.pagenav li a').click(function () {
			pagecont.hide();
			pagecont.filter(this.hash).show(100);
			$('div#aboutus ul.pagenav li a').removeClass('selected');
			$(this).addClass('selected');
			return false;
			}).filter(':first').click();
		
	//Testimonial slider
	
    $('.testimonial').cycle({ 
	    fx:'fade', 
    	speed:500, 
    	timeout:3000,  
    	pause:1
	});	
	
	$('.gallerys').cycle({ 
	    fx:'turnDown', 
    	speed:2000, 
    	timeout:0,  
    	pause:1,
		next:'#galup', 
	    prev:'#galdown'
	});	
	
	$('#galup,#galdown,#blockarrow').hide();
	$('#wrapgallery').hover(
		function() {
		  $('#galup,#galdown,#blockarrow').stop().fadeTo(500, 1);
		},
		function() {
		  $('#galup,#galdown,#blockarrow').stop().fadeTo(500, 0);
	   });
	
	//Get It Now hover offers effect
	
	$('#wrapget h3.off').fadeOut();
	$('#wrapget a').hover(function(){
		$('#wrapget h3').fadeOut(100);
		$('#wrapget h3.off').fadeIn(300);
		},
		function(){
		$('#wrapget h3').fadeIn(300);
		$('#wrapget h3.off').fadeOut(100);
		});
	
	//contact form head, footer validate
	
   $('#submit').formValidator({scope: '#contactforms'});
   $('#fsubmit').formValidator({scope: '#footerforms'});
   $('#submitn').formValidator({scope: '#newssendform',errorDiv: '#errormess'});
   $('#submit,#fsubmit').click(function() {
        $('input.error-input, textarea.error-input').delay(500).animate({marginLeft:10},100).animate({marginLeft:0},100).animate({marginLeft:10},100).animate({marginLeft:0},100);
    });
	   
	//contact form head, footer ajax sending
	
	 var options = {
	
		beforeSubmit: function() {
		    $('#send,#footersend').show().html('<img src="images/ajax-loader.gif"/>');
			$('#contactforms,#footerforms').hide();
		},
		success: function() {
			$('#send,#footersend').hide();
			$("#mess,#footermess").show().html('<p>Thanks!</p><p>Your message send.</p>');
			$('#contactforms,#footerforms').delay(2000).show(function() {
            $('#mess,#footermess').hide();
			$('#contactforms,#footerforms').clearForm();
            });
		  }
	   };
	
	  $('#contactforms,#footerforms').submit(function() {
	  $(this).ajaxSubmit(options);
		return false;
	   }); 
	  
	  
	  $("#newssendsend").hide();
	  $("#newssendmess").hide();
	   var optionsn = {
	
		beforeSubmit: function() {
		    $("#newssendsend").show().html('<img src="images/ajax-loader.gif"/>');
		},
		success: function() {
			$('#newssendsend').hide();
			$("#newssendmess").show().html('Thanks! Your email was sent.');
		  }
	   };
	
	  $('#newssendform').submit(function() {
	  $(this).ajaxSubmit(optionsn);
		return false;
	   });
	
	
	//Price Tabs effects 

	
	$('ul.price li.buy').hover(function(){
		$(this).animate({paddingTop: 7},150);
		},
		function(){
		$(this).animate({paddingTop: 10},150);
		});
	$('ul#h1').hover(function(){
		$('.price-h').animate({left: 0 },150);
		});
	$('ul#h2').hover(function(){
		$('.price-h').animate({left: 184 },150);
		});
	$('ul#h3').hover(function(){
		$('.price-h').animate({left: 368 },150);
		});	
	$('ul#h4').hover(function(){
		$('.price-h').animate({left: 552 },150);
		});	
	$('ul#h5').hover(function(){
		$('.price-h').animate({left: 736 },150);
		});
	
	$('#price li').hover( function(){
	$(this).find('li.cost').animate(bgcosthov,300);
    },
    function(){
	$(this).find('li.cost').animate(bgcostout,300);
    });
	
	$('#wrapprice, .wrapbest').hide();
	 
	$('.in').click(function(){
	        $('#wrapprice, .wrapbest').show();
		    for (var i=1; i<=$('.out').length; i++){
			$('.out').eq(i-1).delay(500).delay((i-1)*500).fadeIn(500);
			};
			$('.price-h').delay(2500).fadeIn(100);
		 return false;
	});
	 
	 $('a.scroll').click(function(e){
		$.scrollTo( this.hash || 0, 1500, {easing:'jswing'});
		e.preventDefault();
	    });
	
	
	// hover effect follow images
	
	$('ul#socicon li').hover(function(){
		$(this).find('a img').animate({width: 32},150);
		},
		function(){
		$(this).find('a img').animate({width: 36},150);
		
		});
	

	
//BarGraph setting
	 
arrayOfData = new Array(
   [30,'Other','#b2273c'],
   [70,'Other','#b2533d'],
   [50,'Other','#b2723e'],
   [80,'Other','#b2913f'],
   [100,'DynaX','#80ac02']
);

$('#companyskills').jqbargraph({
   data: arrayOfData,
   title: false, // title of your graph, accept HTML
   barSpace: 20, // this is default space between bars in pixels
   width: 428, // default width of your graph
   height: 210, //default height of your graph
   color: '#000000', // if you don't send colors for your data this will be default bars color
   colors: false, // array of colors that will be used for your bars and legends
   lbl: '', // if there is no label in your array
   sort: false, // sort your data before displaying graph, you can sort as 'asc' or 'desc'
   position: 'bottom', // position of your bars, can be 'bottom' or 'top'. 'top' doesn't work for multi type
   prefix: '', // text that will be shown before every label
   postfix: '%', // text that will be shown after every label
   animate: true, // if you don't need animated appearance change to false
   speed: 5, // speed of animation in seconds
   legendWidth: 100, // width of your legend box
   legend: false, // if you want legend change to true
   legends: false, // array for legend. for simple graph type legend will be extracted from labels if you don't set this
   type: false, // for multi array data default graph type is stacked, you can change to 'multi' for multi bar type
   showValues: true // you can use this for multi and stacked type and it will show values of every bar part
   //showValuesColor: '' // color of font for values
});
$('.graphFieldcompanyskills').css({bottom: 10 });//hack css stile jqbargraph

		
});
