/* Qchi.net default javascript */var sT, contVars;contVars = {    "section4": [        {            "color": "784ba5",            "textColor": "f4eff9",            "text": "<img class=\"badge-right\" src=\"images/badge-software.png\" /><span>Q:chi</span> has an outstanding team of software developers specialising in the Java, Google Apps and Lotus Notes / Domino platforms."         }     ],    "section3": [        {            "color": "BFD957",            "textColor": "363636",            "text": "<img class=\"badge-right\" src=\"images/badge-support.png\" /><span>Q:chi</span> has a Help Desk team delivering expert technical support to organisations large and small in Europe, Americas and Australasia."         }     ],    "section2": [        {            "color": "FACA31",            "textColor": "222",            "text": "<img class=\"badge-right\" src=\"images/ibm-partner.png\" /><span>Q:chi</span> is a best-of-breed UK-based Lotus Notes / Domino specialist, offering development, consultancy and support."         }     ],    "section1": [        {            "color": "0468CD",            "textColor": "eaf4fe",            "text": "<img class=\"badge-right\" src=\"images/google-reseller.png\" /><span>Q:chi</span> is a Google Apps authorized reseller with Google-certified expertise. We can help with migration, managed services and support."         }     ]};function ajaxDominoSearch(s) {	var startTime, loadingStr, searchStr, results, resultCount, endTime, elapsedTime;	startTime = new Date();	loadingStr = "<img class=\"ajax-loading\" alt=\"Searching Q:Chi.net\" src=\"images/ajax-loader.gif\"/>";	searchStr = "web/html_search?SearchView&Query=" + s + " #search-results";	$('#content').html( loadingStr ).load( searchStr, function(){		results = $('#search-results');		resultCount = $('div.search-result', results).length;		endTime = new Date();		elapsedTime = Number(endTime-startTime)/1000;		if ( resultCount >= 1 ) {			results.append('<p>' + resultCount + ' results found in ' + elapsedTime + ' seconds</p>');		} else {			results.append('<p>No matching documents found in ' + elapsedTime + ' seconds</p>');		}	});}			function menuCurrentPage() {    var href, menuItem, el, y, z;    href = window.location.href;    menuItem = href.substr( href.lastIndexOf("/") );    $('#menu ul li a').each(function(){        el = $(this);        if( el.attr('href') == "webpages"+menuItem) {	       var depth = el.parentsUntil("ul.menu-cont");		      if (depth.length === 3) {			     el.addClass("active-section");                }                y = depth.last().attr('class');                y = $.trim( y.substr(y.indexOf(" ")) );                z = contVars[y][0];                depth.find('.menu-bullet').css('background-color','#'+z.color);                return false;        }    });}function setSlider(el) {	var id, w, p, pp, np, a;	id = el.attr('id');	w = el.width();	p = el.offset();	pp = el.parent().offset();	np = ( p.left - pp.left ) + (0.5 * w) - 20;	a = contVars[id][0];	$('#sl-menu a.on, #menu span.on').removeClass('on');	$('#sl-info').css('background-color', "#"+a.color);	$('#sl-content').html(a.text).css('color', "#"+a.textColor);	$('#sl-img').stop().css('background-color', "#"+a.color).animate({		backgroundPosition: '('+np+' 0)'	});	$('#menu span.menu-bullet').css('background-color','#E3E9E7');	$('#menu .'+id+' span.menu-bullet').css('background-color','#'+a.color);	el.addClass('on');}function buildTagCloud(targ) {	var url, entry, size, col, text, x, cloud;	url = "web/tag_cloud?readViewEntries&outputformat=JSON";	cloud = [];	x = 0;	/*	 * 	Web server is on 7.0.x so the outputformat=JSON parameter is returning	 *	a page type of application/javascript whereas we need application/JSON 	 *	Therefore strip this out and let the backend generate the cloud	 */	/*	$.getJSON(url, function(data, textStatus){		$.each(data.viewentry, function(i, ve) { 			entry = ve.entrydata;			if (entry) {				col = entry[0]["@columnnumber"];				if (col === "0") {						size = 0.8 + (parseInt(ve["@descendants"], 10) / 10);						text = entry[0].text["0"];						cloud[x] = '<li><a href="#" style="font-size: '+size+'em">'+text+'</a></li>';						x++;				}			}		});		targ.append( cloud.join('') );	});	*/}$(document).ready(function(){	var tagCloud, oldNews, newsUl, newsOn, newsOff, newsItems;	/* set slider start position  */		if( $('#slider').length > 0 ) {		setSlider( $('#section2') );		$('#sl-menu a').mouseover(function() {			setSlider($(this));		});	}		$('#employees').keypress(function(e){		if (e.which == 13){   			return false;		}	});	$('#wage').keypress(function(e){		if (e.which == 13){   			return false;		}	});		/* bind ajax search to search field & setup placeholder text */	$('#ajax-search')		.addClass("blur")		.val("Search")		.bind({			keypress: function(e) {				if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  					ajaxDominoSearch( escape( $.trim( $(this).val() ) ) );							return false;				}			},			keyup: function(e) {				var searchVal = escape( $.trim( $(this).val() ) );				clearTimeout(sT);				if (searchVal.length >= 3) {					sT = setTimeout( "ajaxDominoSearch(\""+searchVal+"\")", 500 );					return true;  				}			},			focus: function() {				var t = $(this);				var searchVal = escape( $.trim( t.val() ) );				if (searchVal === "Search") {					t.removeClass("blur").val("");				}			},			blur: function() {				var t = $(this);				var searchVal = escape( $.trim( t.val() ) );				if (searchVal === "") {					t.addClass("blur").val("Search");				}			}	});	/* hilight the current page and  section in the lefthand menu  */	menuCurrentPage();	/* populate the tag cloud  */		tagCloud = $('#tag-cloud');	if( tagCloud.length > 0 ) {			buildTagCloud(tagCloud);		$('a', tagCloud).live('click', function(e) {			var searchVal;			searchVal = escape( $.trim( $(this).text() ) );			ajaxDominoSearch(searchVal);			e.preventDefault();		});	}			/* if the news is longer then 5 items, setup the 'see older news' button effect */		oldNews = $("#show-old-news");	if( oldNews.length > 0 ) {		oldNews.live("click", function(e) {			newsUl = $("#news ul.news");			if(newsUl.length > 0) {				newsOff = newsUl.filter(":hidden");				newsOn = newsUl.filter(":visible");				newsOn.slideUp(function() {					newsOff.slideDown(function() {						if (oldNews.text() == "see older articles") {							oldNews.text("see latest  articles");						} else {							oldNews.text("see older articles");						}					});				});			}		});	}		/*	nasty graphical effect - no longer used. apply a class to the news item before and after the currently hovered one.	newsItems = $('#news ul.news li')		newsItems.bind({		mouseover: function(e) {			$(this)				.prev().addClass('sibling').end()				.next().addClass('sibling');		},		mouseout: function(e) {			$('li.sibling')				.removeClass('sibling');		}			});	*/	});
