

/***************************************
****************************************
    GENERAL SCRIPTS
****************************************
***************************************/


/***************************************
    ON DOCUMENT LOAD
    ------------------------------------
    Any code between this function
    executs when the page had loaded
    fully.
***************************************/




$(document).ready(function(){
   
     
     $('.media').media({ 
    width:     908, 
    height:   198
     })
	

   // $("#breadcrumb ul li:last").addClass("home"); /*adding class to last item in a list*/    
   
    $("#wrap,#footercontent").dropShadow({left: 0, top: 0, opacity: 0.5, blur: 6,color: "#000"});
    
        $('#large_image').load(function() { 
    $("#large_image").fadeIn(400); 
    });
    	

	$("#gallerythumbs ul.thumbs a").click(function(){

      $("#large_image").hide();
	  var largePath = $(this).attr("href");
	  var largeAlt = $(this).attr("title");

	  $("#large_image").attr({ src: largePath, alt: largeAlt });


	  $("h2 em").html(" (" + largeAlt + ")"); return false;
	});


//FANCY BOX
$("a.fancy").fancybox({
'overlayShow' : false,
'zoomSpeedIn' : 600,
'zoomSpeedOut' : 500,
'easingIn' : 'easeOutBack',
'easingOut' : 'easeInBack'
}); 

    
    //NAV STUFF
    $.fn.fadeMenu = function (t, selector) {	  
	//ss(selector).remove();  
	
	return this.each(function() {
				
		var $ul = $(this).find('ul:first');
		$ul.show().css({opacity: 0});
		$(this).hover(function(e){		   
				$ul.show()  
				   .animate({opacity: 1}, { queue: false, duration: t });  
			},function(e){
				$ul.hide();  
				  // .animate({opacity: 0}, { queue: false, duration: t });   
				
		});
	});
};	
    var map = null;
    var geocoder = null;

    $( function() {
     if(typeof GBrowserIsCompatible != "undefined") {
     
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(51.840709,-2.165574), 13);
                var marker = new GMarker(new GLatLng(51.840709,-2.165574));
        map.addOverlay(marker);
        marker.openInfoWindowHtml('<h3>DME Solutions</h3><br /><address>DME Solutions Ltd, <br />Unit 23 Bamel Way, <br />Gloucester Business Park, <br />Gloucester, <br />GL3 4BH</address>');

        geocoder = new GClientGeocoder();
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
      }
      }
    });

    function showAddress() {
        var address = 'Unit 23 Bamel Way Gloucester Business Park Gloucester GL3 4BH';
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml('<h2>DME Solutions</h2><br /><address>DME Solutions Ltd, <br />Unit 23 Bamel Way, <br />Gloucester Business Park, <br />Gloucester, <br />GL3 4BH</address>');
            }
          }
        );
      }
    }
    
    $(function() {
    
        //$("li.toplevel ul").hide();
        
        $("#globalnav ul li").fadeMenu(500, "div#globalnav ul li:hover ul");

		/*//run the currently selected effect
		function runEffect(){
			//get effect type from 
			var selectedEffect = "blind";
			
			//most effect types need no options passed by default
			var options = {};
			//check if it's scale, transfer, or size - they need options explicitly set
			if(selectedEffect == 'scale'){  options = {percent: 0}; }
			else if(selectedEffect == 'transfer'){ options = { to: "#button", className: 'ui-effects-transfer' }; }
			else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; }
			
			//run the effect
			$("li.toplevel ul").show(selectedEffect);
		};
		
		//run the currently selected effect
		function secrunEffect(){
			//get effect type from 
			var selectedEffect = "blind";
			
			//most effect types need no options passed by default
			var options = {};
			//check if it's scale, transfer, or size - they need options explicitly set
			if(selectedEffect == 'scale'){  options = {percent: 0}; }
			else if(selectedEffect == 'transfer'){ options = { to: "#button", className: 'ui-effects-transfer' }; }
			else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; }
			
			//run the effect
			$("li.toplevel ul").hide(selectedEffect);
		};
		
		//set effect from select menu value
		$("li.toplevel").mouseover(function() {
			runEffect();
		});
		$("li.toplevel").mouseout(function() {
		    secrunEffect();
		});*/
		
			


	});

     
    
});


