$(function() {	
	$('#slideshow').cycle({
	    fx:     'fade',
	    prev:   '#prev',
	    next:   '#next',
	    after:   onAfter,
	    timeout: 0
	});	
});

function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    $('#prev')[index == 0 ? 'hide' : 'show']();
    $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();

}


function quickSearch() {			
	var keyword = document.getElementById('searchText').value;
		
	if (keyword != "")
		rpcSearch(keyword);
	return false;
}

function rpcSearch(str) {		
	var request = new ajaxObj();	
	if (!ajaxObj)
		return null;
	
	var sURL = "rpc-quicksearch.cfm";
	
	var targetDiv = document.getElementById('search-results');
		targetDiv.style.display = "";
		targetDiv.innerHTML = '<p><img src="/images/loadcirc_pink2.gif" width="16" height="16" border="0" alt="Loading..." /></p>';
		
	var requestComplete = function (oXML) {
		targetDiv.innerHTML = oXML.responseText;
	};
	
	request.connect(sURL, "GET", "s="+str , requestComplete);
}	

function openContact() {
    window.open('/contact/','FooMail','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=400');
}