//Copyright (c) Brendan Moore (http://bemoreinteractive.com).

function clearBox(id)
{
	
	var name = $(id).identify();
	var text = "";
	
	switch(name)
	{
		case "search_txt": 
			text = 'Search PCE Ltd';
			break;
		case "inform_name_txt":
			text = 'Your Name';
			break;
		case "inform_email_txt":
			text = 'yourname@somecompany.com';
			break;
	}

	if($(id).className == 'pre')
		{
			if($(id).value == text)
			{
				$(id).value = '';
				$(id).className = 'standard';
			}
		}
	else if($(id).className == 'standard')
		{
			if($(id).value == '')
			{
				$(id).value = text;
				$(id).className = 'pre';
			}
		}
	
}//end clearBox.


setTimeout("featuredContent()", 5000);

function featuredContent(no)
{
	if($('featured_list')){
	var contentSelectors = $('featured_list').childElements();
	for (var i = 0; i < contentSelectors.length; i++) {
		var active = $(contentSelectors[i]);
		var next = $(contentSelectors[i+1]);
		if(!next)
		{
			var next = $(contentSelectors[0]);
		}
		if($(active).className == 'active')
		{
			$(active).className = '';
			$(next).className = 'active';
			var read_more = $(next).firstChild.href;
			break;
		}
			
	}
	var content = $('featured').childElements();
	for (var i = 0; i < content.length; i++) {
		var active = $(content[i]);
		var next = $(content[i+1]);
		if(!next)
		{
			var next = $(content[0]);
		}
		if($(active).className == 'active')
		{
			$(active).fade();
			$(active).className = 'inactive';
			$(next).appear({delay:1});
			$(next).className = 'active';
			$('featured_btn').href = read_more;
			break;
		}
			
	}
	setTimeout("featuredContent()", 5000);
	}
}
	
function informPCE()
{
 var name = $('inform_name_txt').value;
 var email = $('inform_email_txt').value;
 var meta_ref = $('inform_meta_ref').value;
 var meta_user = $('inform_meta_user').value;

if(email !== 'yourname@somecompany.com'){
 new Ajax.Updater('content_footer_form', '/class_lib.php', {
 method: 'post',
 postBody: "inform_name_txt="+name+"&inform_email_txt="+email+"&inform_meta_ref="+meta_ref+"&inform_meta_user="+meta_user+""
});
 }else{

 alert("You must enter some valid details before we can inform you!");

 }
} 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("UA-15950216-1");
pageTracker._trackPageview();
} catch(err) {}
