/**
 * $.include - script inclusion jQuery plugin
 * Based on idea from http://www.gnucitizen.org/projects/jquery-include/
 * @author Tobiasz Cudnik
 * @link http://meta20.net/.include_script_inclusion_jQuery_plugin
 * @license MIT
 */
// overload jquery's onDomReady
if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
	document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
	document.addEventListener( "DOMContentLoaded", function(){ jQuery.ready(); }, false );
}
jQuery.event.remove( window, "load", jQuery.ready );
jQuery.event.add( window, "load", function(){ jQuery.ready(); } );
jQuery.extend({
	includeStates: {},
	include: function(url, callback, dependency){
		if ( typeof callback != 'function' && ! dependency ) {
			dependency = callback;
			callback = null;
		}
		url = url.replace('\n', '');
		jQuery.includeStates[url] = false;
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.onload = function () {
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.onreadystatechange = function () {
			if ( this.readyState != "complete" && this.readyState != "loaded" ) return;
			jQuery.includeStates[url] = true;
			if ( callback )
				callback.call(script);
		};
		script.src = url;
		if ( dependency ) {
			if ( dependency.constructor != Array )
				dependency = [dependency];
			setTimeout(function(){
				var valid = true;
				$.each(dependency, function(k, v){
					if (! v() ) {
						valid = false;
						return false;
					}
				})
				if ( valid )
					document.getElementsByTagName('head')[0].appendChild(script);
				else
					setTimeout(arguments.callee, 10);
			}, 10);
		}
		else
			document.getElementsByTagName('head')[0].appendChild(script);
		return function(){
			return jQuery.includeStates[url];
		}
	},
	readyOld: jQuery.ready,
	ready: function () {
		if (jQuery.isReady) return;
		imReady = true;
		$.each(jQuery.includeStates, function(url, state) {
			if (! state)
				return imReady = false;
		});
		if (imReady) {
			jQuery.readyOld.apply(jQuery, arguments);
		} else {
			setTimeout(arguments.callee, 10);
		}
	}
});
$.include('js/hoverIntent.js');
$.include('js/superfish.js');
$.include('js/atooltip.jquery.js');
$.include('js/scrollTop.js');
$.include('js/flashobject.js');
$.include('js/hover-image.js');
$.include('js/jquery.cycle.all.latest.js');
$.include('js/kwicks-1.5.1.pack.js');
$.include('js/jquery.nivo.slider.js');

$(document).ready(function() {
jQuery('ul.sf-menu').superfish({
	animation: {height:'show'},
			delay:     800
});
	$(document).ready(function() {
	$('#slider').nivoSlider({
		effect: 'sliceUpDownLeft',
		slices: 15,
		animSpeed: 1000,
		pauseTime: 5000
	});
});
$('.normaltip').aToolTip({
	xOffset: -20,
		yOffset: -40
});
$('.fixedtip').aToolTip({
		fixed: true
});
$('.clicktip').aToolTip({
		clickIt: true,
		tipContent: 'Hello I am aToolTip with content from param'
});
$(".slideDown dt").click(function(){
	$(this).toggleClass("active").parent(".slideDown").find("dd").slideToggle();
})
$('.kwicks').kwicks({
	max : 850,
	spacing : 0,
	event : 'mouseover'
});
	$(".code a.code-icon").toggle(function(){
		$(this).find("i").text("-");
		$(this).next("div.grabber").slideDown().find("i").text("-");
	}, function(){
		$(this).find("i").text("+");
		$(this).next("div.grabber").slideUp();
	})
});
