$(document).ready(function() {
  
  	//Placeholder text
(function(c){c.fn.extend({defaultValue:function(e){if("placeholder"in document.createElement("input"))return!1;return this.each(function(){if(c(this).data("defaultValued"))return!1;var a=c(this),h=a.attr("placeholder"),f={input:a};a.data("defaultValued",!0);var d=function(){var b;if(a.context.nodeName.toLowerCase()=="input")b=c("<input />").attr({type:"text"});else if(a.context.nodeName.toLowerCase()=="textarea")b=c("<textarea />");else throw"DefaultValue only works with input and textareas";b.attr({value:h,
"class":a.attr("class")+" empty",size:a.attr("size"),style:a.attr("style"),tabindex:a.attr("tabindex"),rows:a.attr("rows"),cols:a.attr("cols"),name:"defaultvalue-clone-"+((1+Math.random())*65536|0).toString(16).substring(1)});b.focus(function(){b.hide();a.show();setTimeout(function(){a.focus()},1)});return b}();f.clone=d;d.insertAfter(a);var g=function(){a.val().length<=0?(d.show(),a.hide()):(d.hide(),a.show().trigger("click"))};a.bind("blur",g);g();e&&e(f)})}})})(jQuery);
	 
	 
	 $('#test').hide();
	 $('#test').show();
	 
	 //Google Map
	 if ($('#map').length){
		var myLatlng = new google.maps.LatLng(55.883914,-4.21205);
		var myOptions = 
		{
			zoom: 11,
			center: myLatlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		
		var map = new google.maps.Map(document.getElementById("map"), myOptions);
		
		var marker = new google.maps.Marker(
		{
			position: myLatlng, 
			map: map,
			title:"RAD IT Solutions"
		});
	}  
	
	// top navigation drop down menu	
		$(document).ready(function(){
			$(".nav li").hover(
				  function () {
					$(this).children("ul").stop(true, true).fadeIn();
				  }, 
				  function () {
					$(this).children("ul").stop(true, true).fadeOut();
				  }
				);

		});
		
		//cycle
		$('#slide')

		.cycle({
			fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
			// speed: 5000
			timeout: 6000, 
			delay:  -2000,
			pager:  '#company',
			pagerAnchorBuilder: function(idx, slide) { 
    	// return selector string for existing anchor 
    		return '#company li:eq(' + idx + ') a'; 
			}
		});
		

       $(".jump").click(function(event){
               event.preventDefault();
                $('html,body').stop(true, true);
               var to = $(this).attr("href");
               var targetOffset = $(to).offset();
               var topx = targetOffset.top;
               
               if($(".heading").length>0){
                   if($(".heading").hasClass("fixed")){
                    	var topx = targetOffset.top-$(".heading").height()-20;
                   }
                   else {
                   		var topx = targetOffset.top-$(".heading").height()-50;
                   }
               }
               
               $('html,body').animate({scrollTop: topx}, 1000);
           });    
        




		if($(".armour_menu").length>0){
				var $comment = $('.armour_menu, .heading');
				eltop = $comment.offset().top - parseFloat($comment.css('marginTop').replace(/auto/, 0));
				$window = $(window);
				
				$window.scroll(function (event) {
				// what the y position of the scroll is
				var y = $window.scrollTop();
				// whether that's below the form
				if (y >= eltop) {
				// if so, ad the fixed class
				$comment.addClass('fixed');
				} else {
				// otherwise remove it
				$comment.removeClass('fixed');
				}
				});
			}

  
});
