
var testimonials = ["We have worked with Skilled Careers for quite some time now and during the last year when recruiting good candidates was a real challenge, they provided us with the majority of the engineers who joined us. They didn't just provide the greatest numbers but also some of the best",
					"Skilled Careers understands our company's philosophy and genuinely tries to match our requirements with a candidate's aspirations and expectations. They stand out amongst their peers as a recruitment consultancy who is genuine, trustworthy and loyal, quite an exception in the recruiting industry",
					"After two weeks at my new company, I'm just writing to thank Skilled Careers for the prompt and efficient service in finding me a job that exactly matched my requirements - even more impressive in the current economic climate. Everything was arranged quickly and efficiently and feedback from the interviews was always prompt", 
					"In the years I have worked closely with Gavin McBride of Skilled Careers for both temporary and permanent recruitment for United House, the level of service has been outstanding; one which excels that of other recruitment agencies, he works with the upmost integrity and expertise in this industry which is refreshing, and has fully tailored a procedure that works for the company, consistently providing quality candidates efficiently.","They are so much more than a CV forwarding service, a full in-depth screening process occurs which involves face to face interviews, reference checks etc I would highly recommend as an effective way of resourcing for any construction/development company."];

var count = 1;
var t = setTimeout("rotate()", 11 * 1000);

$(document).ready(function() { 
	
	if(document.getElementById("news") != null) {
		newsXmlHttp = getXmlHttpObject();
		if (newsXmlHttp == null)  {
			alert("Browser does not support HTTP Request");
			return;
		}
		//unique url - avoid caching  
		newsXmlHttp.open("GET", "getNewsRssFeed.php", true);
		newsXmlHttp.send(null);
		newsXmlHttp.onreadystatechange = showNews;
		
	}
	if(document.getElementById("recent_jobs_ul") != null) {
		jobsXmlHttp = getXmlHttpObject();
		if (jobsXmlHttp == null)  {
			alert("Browser does not support HTTP Request");
			return;
		}
		//unique url - avoid caching  
		jobsXmlHttp.open("GET", "getJobs.php?mode=getRecent", true);
		jobsXmlHttp.send(null);
		jobsXmlHttp.onreadystatechange = showRecentJobs;
	}
	
	//$(document).ready(function(){
	//only needed for the demo page
	//demopage_switchslider();
	//activate the lightbox
	//jQuery('a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg]').prettyPhoto({theme: "light_square"});
	// here you can see the slide options I used in the demo page. depending on the id of the slider a different setup gets activated
	$('#slider').aviaSlider({	
		blockSize: {height: 217, width:20},
		display: 'bottomright',
		transition: 'fade',
		autorotation: true,
		betweenBlockDelay:20,
		animationSpeed: 600,
		switchMovement: false
	});

	
	//testimonials timer		   
});


function getJobs(url) {
	$("#search_results").html("<img src='images/loader.gif' id='search_job_loader' />");
	fjobsXmlHttp = getXmlHttpObject();
	if (fjobsXmlHttp == null)  {
		alert("Browser does not support HTTP Request");
		return;
	}
	//unique url - avoid caching  
	fjobsXmlHttp.open("GET", "getJobs.php?"+url, true);
	fjobsXmlHttp.send(null);
	fjobsXmlHttp.onreadystatechange = showJobResults;
}

function showJobResults() {
	if(fjobsXmlHttp.readyState == 4 && fjobsXmlHttp.status == 200) {
		document.getElementById("search_results").innerHTML = fjobsXmlHttp.responseText;
	}
}

function showNews() {
	if(newsXmlHttp.readyState == 4 && newsXmlHttp.status == 200) {
		
		var node = newsXmlHttp.responseXML;
		//create vars that contain toady's weather data from XML
		var titles = node.getElementsByTagName("title");
		var links = node.getElementsByTagName("link");
		var top_ticker = document.getElementById("news");
		if(top_ticker != null) {
			var top_str = '';
			for(var i=0; i<8; i++) {
				top_str += "<li><a href="+links[i].childNodes[0].nodeValue+" target='_blank'>"+titles[i].childNodes[0].nodeValue+"</a></li>"
			}
			top_ticker.innerHTML = top_str;
			$("#loader").remove();
		}
		//btm_ticker.innerHTML = btm_str;
		//alert("populating ticker");
		$(function() {
			//new FrontPage().init();
		});
		
		
		


		 //$('#ticker_box .pointer div').clone().css({float: "none" }).append("#ticker_box .pointer");
		// $('#news .pointer div').clone().css({float: "none" }).append("#news .pointer");
	}
}

function showRecentJobs() {
	if(jobsXmlHttp.readyState == 4 && jobsXmlHttp.status == 200) {
		document.getElementById("recent_jobs_ul").innerHTML = jobsXmlHttp.responseText;
		$("#recent_loader").remove();
	}
}

//function to create a cross-browser compatiable XmlHttp object
function getXmlHttpObject() {
	if(window.XMLHttpRequest) {
		//ie+7, ff,chrome
		return new XMLHttpRequest();
	}
	if(window.ActiveXObject){
		//ie6, ie5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function rotate() {
	$("#testimonials p").fadeTo(800, 0, function() { $("#testimonials p").html('<img class="openQoute" src="images/blank.gif" /> '+testimonials[count++]+' <img class="closeQoute" src="images/blank.gif" />'); $("#testimonials p").fadeTo(800, 1); });
	t = setTimeout("rotate()", 10 * 1000);
	if(count > 4)//5 testimonials
		count = 0;
}

