function DESemail(emailname,emailserver) {
	document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
	document.write(emailname + "@" + emailserver); 
	document.write("</a>"); 
}

$(window).load(function() {
	
	if (document.getElementById('slider')) {
		$('#slider').nivoSlider({
			effect:'random',
			slices:15,
			animSpeed:500,
			pauseTime:3000,
			directionNav:true, //Next & Prev
			directionNavHide:true, //Only show on hover
			controlNav:false, //1,2,3...
			keyboardNav:false, //Use left & right arrows
			pauseOnHover:false, //Stop animation while hovering
			manualAdvance:true, //Force manual transitions
			captionOpacity:0.8 //Universal caption opacity

		});
	}
});


//  This is where the magic happens, like on Cribs, except nowhere near as vile.
(function ($, window, document) {
    var H, // <head>
        B; // <body>

    //  Is any of this actually going to work?
    if (typeof jQuery === 'undefined') {
        return; // Hot Christ! jQuery isn't available!
    }

    //  --  Instantiate just ONE jQuery object, use this to find other elements
    //      rather than creating a new jQuery object for each selector
    $.root = new jQuery.prototype.init(document);

    //	--  Make Rocket Go Now
    $.root.ready(function () {
        //  Cache <head> and <body> elements
        H = $.root.find('head');
        B = $.root.find('body');

		B.find("#next_fixture").load('/incs/ajax/latest_cal.php');
		
		B.find('.google_map').googleMap();
		
		B.find('.multi_images').multiPics();
		
		if (B.find('.slideshow').length) {
			B.find('.slideshow').slides({
	        	preload: true,
	        	preloadImage: '/img/design/loading.gif',
	        	play: 5000,
	        	pause: 2500,
	        	hoverPause: false,
	        	generatePagination: true,
	        	generateNextPrev: false
	        });
		}

		
        //  Other bindings and that...

		$('form.default').submit( function() {
			$(this).find('button').html('Please Wait');
			return true;
		});
		
		
		

        //  Stick in any elements that need last-child (for IE)
		//$(".pagination li:last-child, ul.multi_thumbs li:last-child").addClass('last-child');

    });



    //	--	Hey buddy I got your custom jQuery plugins right here...


    //	Google Maps
    $.prototype.googleMap = function () {

        return this.each(function () {
            var map_wrap, latitude, longitude, title, address, map, point,
                map_html, marker;

            map_wrap = $(this);
			
            latitude  = map_wrap.data('latitude');
            longitude = map_wrap.data('longitude');
            title     = map_wrap.data('title');
            address   = map_wrap.data('address');
			
			alert(latitude);
			
			var latlng = new google.maps.LatLng(latitude, longitude);
				
			var myOptions = {
				zoom: 10,
				center: latlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			};
				
            map = new google.maps.Map(map_wrap[0], myOptions);

            map_html = '<div class="map_html">';
            map_html += '<h2>' + title + '</h2>';
            map_html += '<p>' + address + '</p>';
            map_html += '</div>';
				
			var infowindow = new google.maps.InfoWindow({
				content: map_html
			});
				
			var marker = new google.maps.Marker({
				position: latlng, 
				map: map, 
				animation: google.maps.Animation.DROP
			});
				
			google.maps.event.addListener(marker, 'click', function() {
				infowindow.open(map,marker);
			});

        });

    };



    //  General video embedder thinger
    $.prototype.videoEmbed = function () {
        return this.each(function () {
            var video  = $(this),
                config = {};

            video.empty();

            config.params = {
                allowfullscreen:    true,
                allowscriptaccess: 'always',
                wmode:             'transparent'
            };

            config.swf       = video.data('swf');
            config.height    = video.data('height');
            config.width     = video.data('width');
            config.wmode     = 'transparent';
            config.flashvars = {};

            $.each(video.data('vars'), function (key, value) {
                config.flashvars[key] = value;
            });

            video.flash(config);
        });
    };

	// Multipics gallery
	$.prototype.multiPics = function () {
		
		return this.each(function () {
			
			var container	=	$(this);
			var items		=	container.find('ul.multi_thumbs li');
			var thumbs		=	items.find('a');
			var master		=	container.find('div.master_wrap img');
			var cache		= 	[];
			
			//master.hide();
			
			// Thumb Clicks
			thumbs.bind('click', function() {
				
				var thumb	=	$(this);
		        var src		=	thumb.attr('href');
				
				//alert(src);
				//master.hide();
				
				// new <img> probably faster than doing cache[] lookup ??
				var img = document.createElement('img');
				
		        $(img).load(function() {

		            master.attr('src', src).fadeIn(250);
            		
		            items.removeClass('active');
		
		            thumb.parent().addClass('active'); // apply class to <li>

		        }).attr('src', src); // odd, but fixes browser bug, can't remmeber which one
				
				return false;
					
			});
			
			
			// preload larger images
			thumbs.each( function() {
				
				var tmb = $(this);
				
				//tmb.css('opacity','0.2');
				
				var fullsize 		=	$(this).attr('href');
				var cache_fullsize	=	document.createElement('img');
			    //cache_fullsize.src	= 	fullsize;
			
				$(cache_fullsize).load(function() {
            		
					tmb.animate({opacity: 1}, 250);
					
					//tmb.css('opacity','1');

		        }).attr('src', fullsize);
			
			    //cache.push(cache_fullsize);
			});
			
			
		});
	};

}(jQuery, this, this.document));
//  --  FIX UP; LOOK SHARP!

/*
var flashvars = {};
flashvars.xml = "/incs/cu3er/config.xml";
flashvars.font = "font.swf";
var attributes = {};
attributes.wmode = "transparent";
attributes.id = "slider";
swfobject.embedSWF("/incs/cu3er/cu3er.swf", "slideshow", "515", "345", "9", "/incs/js/expressInstall.swf", flashvars, attributes);
*/


/*
function DESemail(emailname,emailserver) {
	document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
	document.write(emailname + "@" + emailserver); 
	document.write("</a>"); 
}

$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'random',
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:true, //Force manual transitions
		captionOpacity:0.8 //Universal caption opacity

	});
});

//  This is where the magic happens, like on Cribs, except nowhere near as vile.
(function ($, window, document) {
    var H, // <head>
        B; // <body>

    //  Is any of this actually going to work?
    if (typeof jQuery === 'undefined') {
        return; // Hot Christ! jQuery isn't available!
    }

    //  --  Instantiate just ONE jQuery object, use this to find other elements
    //      rather than creating a new jQuery object for each selector
    $.root = new jQuery.prototype.init(document);

    //	--  Make Rocket Go Now
    $.root.ready(function () {
        //  Cache <head> and <body> elements
        H = $.root.find('head');
        B = $.root.find('body');
	
	// return latest event
	
	B.find('.multi_images').multiPics();
	
    $("#next_fixture").load('/incs/ajax/latest_cal.php');
	
	
	
	$('#googlemap').googleMaps({
	    	latitude: 53.85521,
	        longitude: -1.58714,
			depth: 12,
			scroll: false,
			markers: [{
			            latitude: 	53.85521,
			            longitude: -1.58714,
						info: {
							layer: '#war'
						}
			
			        },
					{
					            latitude: 	53.82267,
					            longitude: -1.59349,
								info: {
									layer: '#met'
								}

					        }]
	
	    });
	
		// Multipics gallery
			$.prototype.multiPics = function () {

				return this.each(function () {

					var container	=	$(this);
					var items		=	container.find('ul.multi_thumbs li');
					var thumbs		=	items.find('a');
					var master		=	container.find('div.master_wrap img');
					var cache		= 	[];

					// Thumb Clicks
					thumbs.bind('click', function() {

						var thumb	=	$(this);
				        var src		=	thumb.attr('href');

						master.hide();

						// new <img> probably faster than doing cache[] lookup ??
						var img = document.createElement('img');

				        $(img).load(function() {

				            master.attr('src', src).fadeIn(250);

				            items.removeClass('active');

				            thumb.parent().addClass('active'); // apply class to <li>

				        }).attr('src', src); // odd, but fixes browser bug, can't remmeber which one

						return false;

					});


					// preload larger images
					thumbs.each( function() {

						var tmb = $(this);

						//tmb.css('opacity','0.2');

						var fullsize 		=	$(this).attr('href');
						var cache_fullsize	=	document.createElement('img');
					    //cache_fullsize.src	= 	fullsize;

						$(cache_fullsize).load(function() {

							tmb.animate({opacity: 1}, 250);

							//tmb.css('opacity','1');

				        }).attr('src', fullsize);

					    //cache.push(cache_fullsize);
					});


				});
			};
	
	
}); // End jQuery


//  This is where the magic happens, like on Cribs, except nowhere near as vile.
(function ($, window, document) {
    var H, // <head>
        B; // <body>

    //  Is any of this actually going to work?
    if (typeof jQuery === 'undefined') {
        return; // Hot Christ! jQuery isn't available!
    }

    //  --  Instantiate just ONE jQuery object, use this to find other elements
    //      rather than creating a new jQuery object for each selector
    $.root = new jQuery.prototype.init(document);

    //	--  Make Rocket Go Now
    $.root.ready(function () {
        //  Cache <head> and <body> elements
        H = $.root.find('head');
        B = $.root.find('body');

        //  Invoke plugins, yo -> B.find('#element').functionName({ ... });
        B.find('.google_map').googleMap();
        B.find('.video_embed').videoEmbed();
		
		B.find('.multi_images').multiPics();
		
		
		B.find('.slideshow').slides({
        	preload: true,
        	preloadImage: '/img/design/loading.gif',
        	play: 5000,
        	pause: 2500,
        	hoverPause: false,
        	generatePagination: true,
        	generateNextPrev: false
        });
		
        //  Other bindings and that...

		$('form.default').submit( function() {
			$(this).find('button').html('Please Wait');
			return true;
		});

        //  Stick in any elements that need last-child (for IE)
		//$(".pagination li:last-child, ul.multi_thumbs li:last-child").addClass('last-child');

    });



    //	--	Hey buddy I got your custom jQuery plugins right here...

    //	Google Maps
    $.prototype.googleMap = function () {

        return this.each(function () {
            var map_wrap, latitude, longitude, title, address, map, point,
                map_html, marker;

            map_wrap = $(this);

            if (GBrowserIsCompatible()) {
                latitude  = map_wrap.data('latitude');
                longitude = map_wrap.data('longitude');
                title     = map_wrap.data('title');
                address   = map_wrap.data('address');

                map = new GMap(map_wrap[0]);

                map.addControl(new GLargeMapControl());
                map.centerAndZoom(new GPoint(longitude, latitude), 2);

                point = new GPoint(longitude, latitude);

                map_html = '<div class="map_html">';
                map_html += '<h2>' + title + '</h2>';
                map_html += '<p>' + address + '</p>';
                map_html += '</div>';

                marker = new GMarker(point);

                GEvent.addListener(marker, 'click', function () {
                    marker.openInfoWindowHtml(map_html);
                });

                map.addOverlay(marker);
                marker.openInfoWindowHtml(map_html);
            } else {
                map_wrap.html('<p>Your browser is not compatible with Google Maps</p>');
            }
        });

    };



    //  General video embedder thinger
    $.prototype.videoEmbed = function () {
        return this.each(function () {
            var video  = $(this),
                config = {};

            video.empty();

            config.params = {
                allowfullscreen:    true,
                allowscriptaccess: 'always',
                wmode:             'transparent'
            };

            config.swf       = video.data('swf');
            config.height    = video.data('height');
            config.width     = video.data('width');
            config.wmode     = 'transparent';
            config.flashvars = {};

            $.each(video.data('vars'), function (key, value) {
                config.flashvars[key] = value;
            });

            video.flash(config);
        });
    };

	

}(jQuery, this, this.document));
//  --  FIX UP; LOOK SHARP!
*/

