function openWindow(url,oExtend) {
	// WINDOW ATTRIBUTES/PROPERTIES
	var oProps = {
		'width': 100,
		'height': 100,
		'screenx': 0,
		'screeny': 0,
		'left': 0,
		'top': 0,
		'dependent': 'no',
		'directories': 'no',
		'fullscreen': 'no',
		'location': 'no',
		'menubar': 'no',
		'resizable': 'no',
		'scrollbars': 'no',
		'status': 'no',
		'toolbar': 'no'
	};
	// MERGE DEFAULT PROPERTIES WITH PROVIDED ARRAY
	for (var prop in oExtend) {
		if (oExtend.hasOwnProperty(prop)) {
			var val = oExtend[prop];
			prop = prop.toLowerCase();
			if (/^width|height|screenx|screeny|left|top$/.test(prop)) {
				val = parseFloat(val);
			}
			if (oProps.hasOwnProperty(prop)) {
				oProps[prop] = val;
			}
		}
	}
	// CENTER THE WINDOW
	oProps.screenx = oProps.left = ((screen.availWidth/2)-(oProps.width/2));
	oProps.screeny = oProps.top = ((screen.availHeight/2)-(oProps.height/2));
	// CONVERT THE PROPERTIES ARRAY INTO A STRING
	var strProps = '';
	for (var key in oProps) {
		if (oProps.hasOwnProperty(key)) {
			strProps += key + '=' + oProps[key] +',';
		}
	}
	// REMOVE THE LAST COMMA
	strProps = strProps.substring(0,strProps.length-1);
	// OPEN THE WINDOW
	var popWindow = window.open (url, "popwindow",strProps);
	// IF FOCUS IS SUPPORTED, PLACE THE WINDOW ON TOP
	if (window.focus) { popWindow.focus(); }
	// STANDARDS COMPLIANCE // PREVENT DEFAULT
	return false;
}

function fadeImage (e,n) {
	
}


$(document).ready(function(){

	// webkit browsers load CSS and JS at the same time so make them wait a bit more
	if (jQuery.browser.safari && document.readyState != "complete") { setTimeout( arguments.callee, 100 ); return; }


	$('div.homePresButtons button').bind('click',function(){
	
		openWindow($(this).attr('rel'),{ 'width':574, 'height':430 });
	
	});

	
	if ($("div#presentation").length>0) {
	
		var oSlideHolder = $("div#presentation div#slides div.slideHolder"),
			navItems = $("div#presentation div#nav ul li a"),
			bannerImgs = $("div#presentation div#banner img"),
			slideWidth = oSlideHolder.parent().width(),
			speed = 500;
		
		oSlideHolder.width(oSlideHolder.children().length * slideWidth);

		navItems.bind("click",function(){
			
			if (oSlideHolder.queue("fx").length == 0) {

				var index = navItems.index(this);
				navItems.removeClass("active").eq(index).addClass("active");
				bannerImgs.css('zIndex',0).eq(index).css('zIndex',1).fadeIn(speed,function(){
					bannerImgs.not(":eq("+index+")").hide();
				});
				oSlideHolder.animate({ 'left':-(index*slideWidth) },speed);
				
			}
			return false;

		}).eq(0).trigger('click');
	
	}
	
	


	if ($.isFunction($.fn.hint)===true) {
		$('form input[title!=""]').hint();
		$('form textarea[title!=""]').hint();
	}
	
	if ($.isFunction($.fn.colorbox)===true) {
		$('a.colorbox').colorbox();
	}



});
