;(function($){ // secure $ jQuery alias
/*******************************************************************************************/	
// jquery.event.hover.js - rev 5 
// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
// Liscensed under the MIT License (MIT-LICENSE.txt)
// http://www.opensource.org/licenses/mit-license.php
// Created: 2008-06-02 | Updated: 2008-07-30
/*******************************************************************************************/

//	USE THESE PROPERTIES TO CUSTOMIZE SETTINGS...

//	$.event.special.hover.delay = 100; 
//	Defines the delay (msec) while mouse is inside the element before checking the speed

//	$.event.special.hover.speed = 100; 
//	Defines the maximum speed (px/sec) the mouse may be moving to trigger the hover event

// save the old jquery "hover" method
$.fn._hover = $.fn.hover;

// jquery method 
$.fn.hover = function( fn1, fn2, fn3 ) {
	if ( fn3 ) this.bind('hoverstart', fn1 ); // 3 args
	if ( fn2 ) this.bind('hoverend', fn3 ? fn3 : fn2 ); // 2+ args
	return !fn1 ? this.trigger('hover') // 0 args 
		: this.bind('hover', fn3 ? fn2 : fn1 ); // 1+ args
	};	

// special event configuration
var hover = $.event.special.hover = {
	delay: 100, // milliseconds
	speed: 100, // pixels per second
	setup: function( data ){
		data = $.extend({ speed: hover.speed, delay: hover.delay, hovered:0 }, data||{} );
		$.event.add( this, "mouseenter mouseleave", hoverHandler, data );
		},
	teardown: function(){
		$.event.remove( this, "mouseenter mouseleave", hoverHandler );
		}
	};

// shared event handler
function hoverHandler( event ){
	var data = event.data || event;
	switch ( event.type ){
		case 'mouseenter': // mouseover
			data.dist2 = 0; // init mouse distance˛
			data.event = event; // store the event
			event.type = "hoverstart"; // hijack event
			if ( $.event.handle.call( this, event ) !== false ){ // handle "hoverstart"
				data.elem = this; // ref to the current element
				$.event.add( this, "mousemove", hoverHandler, data ); // track the mouse
				data.timer = setTimeout( compare, data.delay ); // start async compare
				}
			break;
		case 'mousemove': // track the event, mouse distance˛ = x˛ + y˛
			data.dist2 += Math.pow( event.pageX-data.event.pageX, 2 ) 
				+ Math.pow( event.pageY-data.event.pageY, 2 ); 
			data.event = event; // store current event
			break;
		case 'mouseleave': // mouseout
			clearTimeout( data.timer ); // uncompare
			if ( data.hovered ){ 
				event.type = "hoverend"; // hijack event
				$.event.handle.call( this, event ); // handle "hoverend"
				data.hovered--; // reset flag
				}
			else $.event.remove( data.elem, "mousemove", hoverHandler ); // untrack
			break;
		default: // timeout compare // distance˛ = x˛ + y˛  = ( speed * time )˛
			if ( data.dist2 <= Math.pow( data.speed*( data.delay/1e3 ), 2 ) ){ // speed acceptable
				$.event.remove( data.elem, "mousemove", hoverHandler ); // untrack
				data.event.type = "hover"; // hijack event
				if ( $.event.handle.call( data.elem, data.event ) !== false ) // handle "hover"
					data.hovered++; // flag for "hoverend"
				}
			else data.timer = setTimeout( compare, data.delay ); // async recurse
			data.dist2 = 0; // reset distance˛ for next compare
			break;
		}
	function compare(){ hoverHandler( data ); }; // timeout/recursive function
	};
	
/*******************************************************************************************/
})(jQuery); // confine scope

$(function(){
	$('#tpmnst').bind('hover', { speed:200 }, function(){
		$(this).addClass('hover');
		})
		.bind('hoverend',function(){
			$(this).removeClass('hover');
	});
});

if (document.images) {
    img1 = new Image();
    img1.src = "im/ddbg2.png";
}

$(document).ready(function(){
						   
						   
						   
						   $("img.lazy").lazyload({ 
								event : "click"
							});
						   
	/*					   
						   //When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});*/
						   
	/*var tabContents = $(".tab_content").hide(),
	tabs = $("ul.tabs li");
	
	tabs.first().addClass("active").show();
	tabContents.first().show();
	
	tabs.click(function() {
	var $this = $(this),
	activeTab = $this.find('a').attr('href');
	
	if(!$this.hasClass('active')){
	$this.addClass('active').siblings().removeClass('active');
	tabContents.hide().filter(activeTab).fadeIn();
	}
	
	return false;
	});	*/				   
/*$(document).ready(function() {

//Default Action
$(“.tab_content”).hide(); //Hide all content
if(location.hash != “”) {
var target = location.hash.split(“#”)[1]
$(location.hash).show(); //Show first tab content
$(“ul.tabs li:has(a[rel="+target+"])”).addClass(“active”).show();;
} else {
$(“ul.tabs li:first”).addClass(“active”).show(); //Activate first tab
$(“.tab_content:first”).show(); //Show first tab content
}

//On Click Event
$(“ul.tabs li”).click(function() {
$(“ul.tabs li”).removeClass(“active”); //Remove any “active” class
$(this).addClass(“active”); //Add “active” class to selected tab
$(“.tab_content”).hide(); //Hide all tab content
var activeTab = $(this).find(“a”).attr(“href”); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content

});

});						   
	*/					   
						   
						   
						   
						   
						   
	//$(".tb:not(:first)").hide();
	//$(".tb:first").show();
	$(".tboff").hide();
	$(".tbon").show();
	$(".tbmnst a").click(function(){
		stringref = $(this).attr("href").split('#')[1];
		$('.tb:not(#'+stringref+')').hide();
		if ($.browser.msie && $.browser.version.substr(0,3) == "6.0") {
			$('.tb#' + stringref).show();
		}
		else 
			$('.tb#' + stringref).fadeIn();
		return false;
	});
	$(".m1").click(function () {
	$("address").addClass("hl");
	
	});
	$(".m0").click(function () {
	$("address").removeClass("hl");
	});
	
	
/*	$("ul.tbmnst li").click(function() {

		//$("ul.tbmnst li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active");
	
	});*/
	
	
	
	$("ul.tbmnst a").click(function(){
			$("ul.tbmnst li").removeClass("tbact");
			$(this).parent().addClass("tbact");
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$(".tpmn01").hover( function() {
								 
								 
								 
								 
		$(".ddmn01").css('display','block');
		$(".ddmn02").css('display','none');
		$(".ddmn03").css('display','none');
		$(".ddmn04").css('display','none');
		$(".ddmn05").css('display','none');
		
			/*$("#tpmnst li").removeClass("menact");
			$(this).addClass("menact");*/
	
	}, function() {
		
	});
	$(".tpmn02").hover( function() {
		$(".ddmn01").css('display','none');
		$(".ddmn02").css('display','block');
		$(".ddmn03").css('display','none');
		$(".ddmn04").css('display','none');
		$(".ddmn05").css('display','none');
		
			/*$("#tpmnst li").removeClass("menact");
			$(this).addClass("menact");*/
	
	}, function() {
		
	});
	$(".tpmn03").hover( function() {
		$(".ddmn01").css('display','none');
		$(".ddmn02").css('display','none');
		$(".ddmn03").css('display','block');
		$(".ddmn04").css('display','none');
		$(".ddmn05").css('display','none');
	}, function() {
		
	});
	$(".tpmn04").hover( function() {
		$(".ddmn01").css('display','none');
		$(".ddmn02").css('display','none');
		$(".ddmn03").css('display','none');
		$(".ddmn04").css('display','block');
		$(".ddmn05").css('display','none');
	}, function() {
		
	});
	$(".tpmn05").hover( function() {
		$(".ddmn01").css('display','none');
		$(".ddmn02").css('display','none');
		$(".ddmn03").css('display','none');
		$(".ddmn04").css('display','none');
		$(".ddmn05").css('display','block');
	}, function() {
		
	});
	$("#mnwr").hover( function() {
							   
							   
							   
							   
		$("#ddmnbg").css('display','block');
		
		
		//$('#ddmnbg').fadeIn('fast', function() {});
		//$('#hdim').fadeTo("fast", 0);
		//$('#logo').fadeTo("fast", 0);
	}, function() {
		$("#ddmnbg").hide();
		
		//$('#ddmnbg').fadeOut('fast', function() {});
		//$('#hdim').fadeTo("fast", 1);
		//$('#logo').fadeTo("fast", 1);
	});
	
	
	
	


	
	/*		$(function()
{
	$('.scroll-pane').jScrollPane();
});
*/
	
	
	
	
	
	

/*$('#nw01').fadeOut(5000);
$('#nw02').fadeIn(5000);

$('#nw02').fadeOut(10000);
$('#nw01').fadeIn(10000);*/

//$(function() {
    // do work
    //$("#tbwr").show();
//}
//$("#tbwr").show().fadeIn('slow');
$("#tbwr:hidden:first").fadeIn("slow");



/*$.fn.equalizeHeights = function(){
  return this.height( Math.max.apply(this, $(this).map(function(i,e){ return $(e).height() }).get() ) )
}

$('.client-container, #clients, #gm, #ctcol2').equalizeHeights();*/


	
});


/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#newsst div.active');

    if ( $active.length == 0 ) $active = $('#newsst div:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#newsst div:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active')
	.animate({opacity : 0.0}, 2000);

    $next.css({opacity: 0.0})
        .addClass('active').delay(2000)
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 7500 );
});

$(function(){ $("label").inFieldLabels(); });
		$(function(){ $('#loopedSlider').loopedSlider(); });




