
function addstyles(){

	//** Build js rendered stylesheet that css validators fail on **
	var jstyle = document.getElementsByTagName("head")[0];
	var lk = document.createElement("link");
	jstyle.appendChild(lk);
	lk.setAttribute("rel", "stylesheet");
	lk.setAttribute("type", "text/css");
	lk.setAttribute("href", "/js-vl.css");
}



function valueCounter(id, opacStart, opacEnd, tFunction, millisec) { 

var speed = Math.round(millisec / 100); 
var timer = 10; 

if(opacStart > opacEnd) { 
 for(i = opacStart; i >= opacEnd; i--) { 
     setTimeout("changeValues(" + i + ",'" + id + "','" + tFunction + "')",(timer * speed)); 
     timer++; 
 } 
} else if(opacStart < opacEnd) { 
 for(i = opacStart; i <= opacEnd; i++) 
 { 
     setTimeout("changeValues(" + i + ",'" + id + "','" + tFunction + "')",(timer * speed)); 
     timer++; 
 } 
} 
} 

function changeValues(nValue, id, tFunction) { 
	
	if(tFunction == "opacity")
	{
		var object = document.getElementById(id).style; 
		object.filter = "alpha(opacity=" + nValue + ")"; 
		object.opacity = (nValue / 100); 
		object.MozOpacity = (nValue / 100); 
		object.KhtmlOpacity = (nValue / 100); 
	}
	else if(tFunction == "top")
	{
		document.getElementById(id).style.top = "-"+nValue+"px";
	}
}


function flashLatest(){

	if(document.getElementById("latesthome"))
	{
		latestli = document.getElementById("latesthome").getElementsByTagName("li");

		litimea = setTimeout("latestli[0].className = 'highlight'",150);
		litimeb = setTimeout("latestli[0].className = ''",300);
		litimec = setTimeout("latestli[1].className = 'highlight'",300);
		litimed = setTimeout("latestli[1].className = ''",450);
		litimee = setTimeout("latestli[2].className = 'highlight'",450);
		litimef = setTimeout("latestli[2].className = ''",600);
	}
}


function popLinks(){

	poplinks = document.getElementsByTagName("a");
	for(i=0;i<poplinks.length;i++)
	{
		popLink = poplinks[i];
		linkRel = popLink.getAttribute("rel");
		
		if(linkRel == "pop")
		{
			linkHref = popLink.getAttribute("href");
			newLinkHrefA = linkHref.replace(/http:\/\//g, "");
			newLinkHrefB = newLinkHrefA.split("/");
			popinfo = newLinkHrefB[1].replace(/[^a-z]/g, "");
			poplinks.item(i).setAttribute("href","javascript:popInfo('"+popinfo+"')");
		}
	}
}


function popInfo(popinfo){

	if(!document.getElementById("popinfo"))
	{
		var parentBody = document.getElementsByTagName("body")[0];
		var popdiv = document.createElement("div");
		var popinner = document.createElement("div");
		var popclose = document.createElement("a");
		parentBody.appendChild(popdiv);
		popdiv.appendChild(popclose);
		popdiv.appendChild(popinner);
		popdiv.setAttribute("id", "popinfo");
		popinner.setAttribute("id", "popcontent");
		popclose.setAttribute("id", "popclose");
		popclose.setAttribute("title", "Close pop-up info box - click here");
		popclose.setAttribute("href", "javascript:popInfoClose()");
	}
	
	if(bName == "Explorer")
	{
		document.getElementById("popinfo").style.backgroundImage = "none";
	}
	
	if (self.pageYOffset) 
	{
		var scrolling = self.pageYOffset;
	} 
	else
	{
		var scrolling = document.documentElement.scrollTop;
	}
	
	if(bName == "Explorer")
	{
		viewportheight = document.documentElement.clientHeight
	}
	else
	{
		viewportheight = window.innerHeight
	}
	

	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert("Your browser does not support XMLHTTP!");
	}
	
	curHeight = Math.round((viewportheight-454)/2);
	var newPos = scrolling+curHeight;
	//document.getElementById("popinfo").style.top = newPos+"px";
	document.getElementById("popinfo").style.display = "block";
	valueCounter('popinfo',0,100,'opacity',200);
	
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			document.getElementById("popcontent").innerHTML= '';	
			document.getElementById("popcontent").innerHTML=xmlhttp.responseText;
			
			if(bName == "Explorer")
			{
				var RemFilTimer = setTimeout("document.getElementById('popinfo').style.filter = ''",300);
				var AddBGTimer = setTimeout("document.getElementById('popinfo').style.background = 'transparent url(/gfx/info-pop.png) no-repeat center center'",400);
			}
		}
	}
	
	var whichPage = "/popcontent/"+popinfo;
	xmlhttp.open("GET",whichPage,true);
	xmlhttp.send(null);
}


function popInfoClose(){

	if(bName == "Explorer")
	{
		document.getElementById("popinfo").style.backgroundImage = "none";
	}
	
	valueCounter('popinfo',100,0,'opacity',200);
	touterdisp = setTimeout("document.getElementById('popinfo').style.display = 'none'",200);
	touterhtml = setTimeout("document.getElementById('popcontent').innerHTML = ''",200);
}


function extendPage(){

	pageHeight = document.getElementById("page").offsetHeight;
	contentHeight = document.getElementById("outercontent").offsetHeight;
	tempheight = pageHeight-contentHeight;
	if(tempheight<0){tempheight=0;}
	
	//if(pageHeight <= 628){document.getElementById("page").style.minHeight = "628px";pageHeight = 628;}
	document.getElementById("footer").style.minHeight = tempheight+"px";
	document.getElementById("outerfooter").style.minHeight = tempheight+"px";
	
	if(bName == "Explorer" && (bVer == "6" || bVer == "7"))
	{
		if(pageHeight <= 628){document.getElementById("page").style.minHeight = "746px";}
	}
}



var homeProjectInt;

function homePortfolio(){

	pageHref = location.href;
	thisPage = pageHref.split("/");
	i = thisPage.length-1;
	if(thisPage[i] == "index.html" || thisPage[i] == "")
	{
		portfolioThumbs = document.getElementById("portfoliohome").getElementsByTagName("a");
		
		for(p=0;p<portfolioThumbs.length;p++)
		{
			portfolioThumb = portfolioThumbs[p];
			portfolioThumbImg = portfolioThumb.firstChild;
			
			if(portfolioThumbImg.tagName == "IMG")
			{
				thumbClass = portfolioThumbImg.getAttribute("class");
				thumbRel = portfolioThumb.getAttribute("rel");
				if(thumbClass == "thumbnail")
				{
					if((bName == "Explorer") && (bVer == "6" || bVer == "7"))
					{
						thumbAction = portfolioThumbs.item(p);
						thumbAction.onclick = function(){changePortfolio(this,thumbRel,'0');}
					}
					else
					{
						portfolioThumbs.item(p).setAttribute("onclick","changePortfolio(this,'"+thumbRel+"','0')");
					}
				}
			}
		}
		
		document.getElementById("thumba").style.opacity = "0.2";
		document.getElementById("thumba").style.filter = "alpha(opacity=20)";
		
		homeProjectInt = setTimeout("changePortfolio('thumba','pha','1')",3000);
	}
}



function changePortfolio(curThumb,imgTarget,allani){

	clearTimeout(homeProjectInt);
		
	if(allani == "1")
	{
		curThumbS = curThumb;
		curThumb = document.getElementById(curThumb);
	}
	
	curRev = curThumb.getAttribute("rev");
	curRel = curThumb.getAttribute("rel");
	
	portfolioThumbs = document.getElementById("portfoliohome").getElementsByTagName("a");
	for(p=0;p<portfolioThumbs.length;p++)
	{
		portfolioThumb = portfolioThumbs[p];
		portfolioThumbImg = portfolioThumb.firstChild;

		if(portfolioThumbImg.tagName == "IMG")
		{
			thumbClass = portfolioThumbImg.getAttribute("class");
			if(thumbClass == "thumbnail")
			{
				portfolioThumbs[p].setAttribute("rev",imgTarget);
				portfolioThumbs[p].style.opacity = "1";
				portfolioThumbs[p].style.filter = "alpha(opacity=100)";
			}
		}
	}
	
	curThumb.style.opacity = "0.2";
	curThumb.style.filter = "alpha(opacity=20)";
	
	if(curRev != curRel)
	{
		valueCounter(curRev,100,0,'opacity',200);
		setTimeout("document.getElementById('"+curRev+"').style.display = 'none'",200);
		setTimeout("document.getElementById('"+imgTarget+"').style.display = 'block'",200);
		setTimeout("valueCounter('"+imgTarget+"',0,100,'opacity',400)",200);
	}

	if(allani == "1")
	{
		if(curThumbS == "thumba"){newvara = "thumbb";newvarb = "phb";}
		else if(curThumbS == "thumbb"){newvara = "thumbc";newvarb = "phc";}
		else if(curThumbS == "thumbc"){newvara = "thumba";newvarb = "pha";}
		
		homeProjectInt = setTimeout("changePortfolio('"+newvara+"','"+newvarb+"','1')",3000);
	}
}


function slideThumbs(slideDir,wAct){

	if(document.getElementById("portfoliothumbsinner"))
	{
		thumbActionu = document.getElementById("projectthumbsup");
		thumbActiond = document.getElementById("projectthumbsdown");

		if((bName == "Explorer") && (bVer == "6" || bVer == "7"))
		{		
			if(wAct == "load")
			{
				thumbActionu.onclick = function(){slideThumbs('up','click');}
				thumbActiond.onclick = function(){slideThumbs('down','click');}
			}
			else
			{
				thumbActionu.onclick = function(){return false;}
				thumbActiond.onclick = function(){return false;}
			}
		}
		else
		{
			if(wAct == "load")
			{
				thumbActionu.setAttribute("onclick","slideThumbs('up','click')");
				thumbActiond.setAttribute("onclick","slideThumbs('down','click')");
			}
			else
			{
				thumbActionu.setAttribute("onclick","return false");
				thumbActiond.setAttribute("onclick","return false");
			}
		}

		contHeight = document.getElementById("portfoliothumbsinner").offsetHeight-309;
		scrollStartTemp = document.getElementById("portfoliothumbsinner").offsetTop;
		scrollStart = -scrollStartTemp;

		if(wAct == "load")
		{
			totalThumbs = totalProj*103;
			remthumb = thisProj*103;
			scrollStop = totalThumbs-remthumb;
			scrollspeed = Math.round((2000-((totalProj-thisProj)*50))/10);

			if(scrollStop>contHeight)
			{
				scrollStop = contHeight;
			}
			
			if(scrollStop <= 0)
			{
				thumbActionu.style.backgroundImage = "none";
				thumbActionu.style.cursor = "auto";
			}
			
			//document.getElementById("portfoliothumbsinner").style.top = "-"+scrollStop+"px";
			valueCounter('portfoliothumbsinner', '0', scrollStop,'top', scrollspeed);
		}
		else
		{
			if(slideDir == "down")
			{
				scrollStop = parseInt(scrollStart)+103;

				if(scrollStart<contHeight)
				{
					valueCounter('portfoliothumbsinner', scrollStart, scrollStop,'top', 200);
				}
				
				if(scrollStart>=618)
				{
					thumbActiond.style.backgroundImage = "none";
					thumbActiond.style.cursor = "auto";
				}
				else
				{
					thumbActiond.style.backgroundImage = "";
					thumbActiond.style.cursor = "";
				}
				
				thumbActionu.style.backgroundImage = "";
				thumbActionu.style.cursor = "";
			}
			else
			{
				scrollStop = parseInt(scrollStart)-103;

				if(scrollStop>=0)
				{
					valueCounter('portfoliothumbsinner', scrollStart, scrollStop,'top', 200);
				}
				
				if(scrollStart<=103)
				{
					thumbActionu.style.backgroundImage = "none";
					thumbActionu.style.cursor = "auto";
				}
				else
				{
					thumbActionu.style.backgroundImage = "";
					thumbActionu.style.cursor = "";
				}
				
				thumbActiond.style.backgroundImage = "";
				thumbActiond.style.cursor = "";
			}

		}

		if(wAct == "click"){var clickTimer = setTimeout("timerClick()",210);}
	}
}

function timerClick(){

	if((bName == "Explorer") && (bVer == "6" || bVer == "7"))
	{		
		thumbActionu.onclick = function(){slideThumbs('up','click');}
		thumbActiond.onclick = function(){slideThumbs('down','click');}
	}
	else
	{
		thumbActionu.setAttribute("onclick","slideThumbs('up','click')");
		thumbActiond.setAttribute("onclick","slideThumbs('down','click')");
	}
}


function checkForm(formreq,formname){

	reqFields = new Array();

	if(formreq == "qcontact")
	{
		reqFields[0] = 'name';
		reqFields[1] = 'email';
		reqFields[2] = 'subject';
	}
	else if(formreq == "fcontact")
	{
		reqFields[0] = 'name';
		reqFields[1] = 'email';
		reqFields[2] = 'message';
	}
	else if(formreq == "fquote")
	{
		reqFields[0] = 'name';
		reqFields[1] = 'email';
		reqFields[2] = 'budget';
	}
	
	chkDetails = new Array();
	chkDetails['num'] = 0;
	chkDetails['mssg'] = 'Please fill in all required fields.<br /><br />';
	var efilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i


	for(i=0;i<reqFields.length;i++)
	{
		fieldname = reqFields[i];
		fieldlabel = reqFields[i].replace(/-/g," ");

		if(fieldname == "email")
		{
			tcfemail = document.forms[formname].elements[fieldname].value;
			if(efilter.test(tcfemail))
			{
				chkDetails['num'] = chkDetails['num']+1;
			}
			else
			{
				chkDetails['mssg'] += "- Please enter a valid Email Address\<br />";
			}
		}
		else if(fieldname == "phone" || fieldname == "budget")
		{
			tcfphone = document.forms[formname].elements[fieldname].value; cfphone = tcfphone.replace(/ /gi,"");
			if(isNaN(cfphone) || cfphone == "")
			{
				chkDetails['mssg'] += "- Please enter a valid Number<br />";
			}
			else
			{
				chkDetails['num'] = chkDetails['num']+1;
			}

		}
		else
		{
			tcfthisfield = document.forms[formname].elements[fieldname].value; cfthisfield = tcfthisfield.replace(/ /gi,"");
			if(cfthisfield != "")
			{
				chkDetails['num'] = chkDetails['num']+1;
			}
			else
			{
				fieldlabelU = fieldlabel.charAt(0).toUpperCase() + fieldlabel.slice(1);
				chkDetails['mssg'] += "- "+fieldlabelU+"<br />";
			}
		}

	}

	if(chkDetails['num'] == reqFields.length)
	{
		return true;
	}
	else
	{

		if (self.pageYOffset)
		{
			var scrolling = self.pageYOffset;
		}
		else
		{
			var scrolling = document.documentElement.scrollTop;
		}

		var errPos = scrolling+130;
		errorid = "cterrorpop";

		if(!document.getElementById(errorid))
		{
			var errBody = document.getElementsByTagName("body")[0];
			var errDiv = document.createElement("div");
			errBody.appendChild(errDiv);
			errDiv.setAttribute("id", errorid);
		}

		chkDetails['mssg'] += '<span id="errConf" onclick="hideErr()">OK</div>';
		
		document.getElementById(errorid).innerHTML = chkDetails['mssg'];
				
		document.getElementById(errorid).style.opacity = "0";
		document.getElementById(errorid).style.filter = "alpha(opacity=0)";
		
		document.getElementById(errorid).style.display = "block";
		
		errDivMarginV = document.getElementById(errorid).offsetHeight;
		errDivMargin = Math.round(errDivMarginV/2);
		document.getElementById(errorid).style.marginTop = "-"+errDivMargin+"px";
		
		document.getElementById(errorid).style.opacity = "1";
		document.getElementById(errorid).style.filter = "alpha(opacity=100)";
		return false;
	}
}


function hideErr(){

		document.getElementById(errorid).innerHTML = '';
		document.getElementById(errorid).style.display = "none";
}


function moreinfo(stginfo){

	var infotitle = '';
	var infobody = document.getElementById("wqtinfobody");
	
	// Stage 1 ************
	if(stginfo == "staticif")
	{
		infotitle = "<strong>Static web project</strong><br />";
		infobody.innerHTML = infotitle+"Static web projects are websites that are manually updated by webmasters upon request from the website owner. Static websites tend to be cheaper to design &amp; build but may cost more in the long run from update requests to your webmaster.";
	}
	
	if(stginfo == "ecommif")
	{
		infotitle = "<strong>Ecommerce project</strong><br />";
		infobody.innerHTML = infotitle+"An Ecommerce web project is a shopping website that allows you to sell your products and even take payment online. These websites can vary in size and can also vary in the systems used to manage your products and take payment, these can also vary in cost.";
	}
	
	if(stginfo == "cmsif")
	{
		infotitle = "<strong>CMS web project</strong><br />";
		infobody.innerHTML = infotitle+"A CMS web project, or a Content Management System, is a website design and built in a way that allows the user or website owner to manage, update, and add to a website without the need of a web master or any technical web development knowledge from an online control panel. A CMS tends to cost more to develope but can save money in the long run if the website will be updated on a regular basis.";
	}
	
	if(stginfo == "customif")
	{
		infotitle = "<strong>Bespoke web project</strong><br />";
		infobody.innerHTML = infotitle+"A Bespoke web project doesn't necessarily mean a website, or it can be a combination of a CMS and some Ecommerce for example. Or if you already have a website you may require extra programming for your existing website or such things as contact forms.";
	}
	

	// Stage 2 ************
	if(stginfo == "statics")
	{
		infotitle = "<strong>Small static website</strong><br />";
		infobody.innerHTML = infotitle+"A small static website is normally just a few pages in size, e.g. a brochure/information website, or a portfolio website.";
	}

	if(stginfo == "staticm")
	{
		infotitle = "<strong>Medium static website</strong><br />";
		infobody.innerHTML = infotitle+"A medium static website would normally be quite a few pages in size similar to this website. It would normally contain such things as contact forms or extra scripting too.";
	}

	if(stginfo == "staticl")
	{
		infotitle = "<strong>Large static website</strong><br />";
		infobody.innerHTML = infotitle+"A large static website would normally contain many pages and sections like a town information website for example. A site of this size would normally contain contact forms and other interactive features.";
	}

	if(stginfo == "ecommerces")
	{
		infotitle = "<strong>Small ecommerce website</strong><br />";
		infobody.innerHTML = infotitle+"A small ecommerce website would normally consist of a around 20 or less products to sell. These can use an Ecommerce shopping system and take advantage of the features of such a system but would be cheaper to use something like 'Buy Now' buttons from Google or PayPal.";
	}
	
	if(stginfo == "ecommercem")
	{
		infotitle = "<strong>Medium ecommerce website</strong><br />";
		infobody.innerHTML = infotitle+"A medium ecommerce website can contain many hundreds of products and would normally use a complete shopping cart system with many features that allow you to control and customise many aspects of managing and selling your products online.";
	}

	if(stginfo == "ecommercel")
	{
		infotitle = "<strong>Large ecommerce website</strong><br />";
		infobody.innerHTML = infotitle+"A large ecommerce website can contain thousands of products and would normally use a complete shopping cart system with many features that allow you to control and customise many aspects of managing and selling your products online. Other features you might expect would be customer account management tools, special offer and coupon code management tools.";
	}

	//Stage 3 *************
	if(stginfo == "extraaif")
	{
		infotitle = "<strong>Flash Content</strong><br />";
		infobody.innerHTML = infotitle+"Flash content can be animation, photo slideshows, interactive menus, and other interactive content. Flash content could also be the website itself, most websites are built using (x)html &amp; css but some are built using Flash, wanting/needing this will be down to your objectives and budget.";
	}
	
	if(stginfo == "extrabif")
	{
		infotitle = "<strong>Interactive/ Contact Forms</strong><br />";
		infobody.innerHTML = infotitle+"You may require some simple contact forms, or other forms to gather information. Depending on your quote, your website may come with a basic contact form but you may require more interactive forms such as feedback forms and quote systems.";
	}	

	if(stginfo == "extracif")
	{
		infotitle = "<strong>Scripting</strong><br />";
		infobody.innerHTML = infotitle+"Scripting would normally mean the popular javascript, javascript is used to give a website more interactivity or some more advanced features such as photo galleries. Scripting could also mean other forms of scripting depending on your requirements.";
	}
	
	if(stginfo == "extradif")
	{
		infotitle = "<strong>Programming</strong><br />";
		infobody.innerHTML = infotitle+"Extra Programming would be used if you required extra features bolted on to a static website for example, such as a news system. Or if you had an Ecommerce website you may require an extra feature that does not come included as standard such as a competition system or related products features on your product pages. Programming can come in the form of many languages such as PHP, Perl, or ASP.";
	}
	
	infobody.innerHTML += '<br /><br /><a href="javascript:clinfo()">Clear</a>';	
}

function clinfo(){

	document.getElementById("wqtinfobody").innerHTML = 'For more information on each feature just click the <strong>i</strong> symbol.';
}


months = new Array();
months['january'] = "0";
months['february'] = "1";
months['march'] = "2";
months['april'] = "3";
months['may'] = "4";
months['june'] = "5";
months['july'] = "6";
months['august'] = "7";
months['september'] = "8";
months['october'] = "9";
months['november'] = "10";
months['december'] = "11";

pmonths = new Array();
pmonths[0] = "january";
pmonths[1] = "february";
pmonths[2] = "march";
pmonths[3] = "april";
pmonths[4] = "may";
pmonths[5] = "june";
pmonths[6] = "july";
pmonths[7] = "august";
pmonths[8] = "september";
pmonths[9] = "october";
pmonths[10] = "november";
pmonths[11] = "december";

function startCalendar()
{
	var d = new Date();
	year = d.getFullYear();
	thismonth = d.getMonth();
	month = pmonths[thismonth];
	myCalendar(year,thismonth,month);
}

function myCalendar(year,thismonth,month,calToday){

	fnDate = new Date();

	yearDiv = document.getElementById("thisyear");
	dayDiv = document.getElementById("days");

	monthTempA = month;
	monthTempB = months[monthTempA];
	prevmonthtemp = parseInt(monthTempB)-1;
	nxtmonthtemp = parseInt(monthTempB)+1;

	if(month == "december")
	{
		prevmonth = pmonths[prevmonthtemp];
		nprevmonth = prevmonthtemp;
		nxtmonth = "january";
		nnxtmonth = "0";
		prevyear = year;
		nxtyear = parseInt(year)+1;
	}
	else if(month == "january")
	{
		prevmonth = "december";
		nprevmonth = "11";
		nxtmonth = pmonths[nxtmonthtemp];
		nnxtmonth = nxtmonthtemp;
		prevyear = parseInt(year)-1;
		nxtyear = year;
	}
	else
	{
		prevmonth = pmonths[prevmonthtemp];
		nprevmonth = prevmonthtemp;
		nxtmonth = pmonths[nxtmonthtemp];
		nnxtmonth = nxtmonthtemp;
		prevyear = year;
		nxtyear = year;
	}

	prevdate = prevmonth+'-'+prevyear;
	nxtdate = nxtmonth+'-'+nxtyear;
	
	umonthtxt = month.charAt(0).toUpperCase() + month.slice(1);

	totaldays = readDaysInMonth(thismonth,year);
	getFirstDay = new Date(year,thismonth,1);
	dateToS = getFirstDay.getDay();
	
	if(dateToS == 0)
	{
		dateToS = 8;
		startCountDays = 44;		
	}
	else if(dateToS == 5 || dateToS == 6)
	{
		dateToS = dateToS+1;
		startCountDays = 44;
	}
	else if(totaldays == 28)
	{
		dateToS = 10;
		startCountDays = 45;
	}
	else
	{
		dateToS = dateToS;
		startCountDays = 43;
	}
	
	yearDiv.innerHTML = '';
	yeartostop = fnDate.getFullYear()-2;
	monthtostop = fnDate.getMonth()+1;
	currentyear = fnDate.getFullYear();
	if(prevyear < yeartostop)
	{
		yearDiv.innerHTML += '<a id="prevmonth">&laquo;</a>';
	}
	else
	{
		yearDiv.innerHTML += '<a id="prevmonth" title="View '+prevmonth+' '+prevyear+'" onclick="myCalendar(\''+prevyear+'\',\''+nprevmonth+'\',\''+prevmonth+'\')">&laquo;</a>';
	}
	
	yearDiv.innerHTML += '<span id="actYear">'+umonthtxt+' '+year+'</span>';
	
	if((nnxtmonth == monthtostop) && (nxtyear == currentyear))
	{
		yearDiv.innerHTML += '<a id="nxtmonth">&raquo;</a>';
	}
	else
	{
		yearDiv.innerHTML += '<a  id="nxtmonth" title="View '+nxtmonth+' '+nxtyear+'" onclick="myCalendar(\''+nxtyear+'\',\''+nnxtmonth+'\',\''+nxtmonth+'\')">&raquo;</a>';
	}
	
	dayDiv.innerHTML = '';
	for(d=1;d<dateToS;d++)
	{
		getThisDayC = new Date(year,thismonth,d);
		dateToCC = getThisDayC.getDay();
		
		if(dateToCC != 1)
		{
			dayDiv.innerHTML += '<a rel="calDay" class="dayitemblank" href="javascript:;"></a>';
		}
	}
	
	stopCountDays = startCountDays-dateToS;
	
	for(i=0;i<stopCountDays;i++)
	{
		day = i+1;
		getThisDay = new Date(year,thismonth,day);
		dateToC = getThisDay.getDay();
		
		tnfday = day.toString();
		if(tnfday.length<2)
		{
			tnday = '0'+tnfday;
		}
		else
		{
			tnday = tnfday;
		}

		nday = tnday;
		nday.split("");
		dayhtml = nday[1];
		dayhtmlf = nday[0];

		if(dayhtmlf == "1")
		{
			mydath = "th";
		}
		else
		{
			if(dayhtml == "1")
			{
				mydath = "st";
			}
			else if(dayhtml == "2")
			{
				mydath = "nd";
			}
			else if(dayhtml == "3")
			{
				mydath = "rd";
			}
			else
			{
				mydath = "th";
			}
		}

		senddate = day+mydath+" "+month+" "+year;

		dispday = day;
		if(day<10){dispday = "0"+day;}
		dispmonth = parseInt(months[month])+1;
		if((parseInt(months[month])+1)<10){dispmonth = "0"+(parseInt(months[month])+1);}
		sendcdate = dispday+"-"+dispmonth+"-"+year;
		
		if(day > totaldays)
		{
			dayDiv.innerHTML += '<a rel="calDay" class="dayitemblank" href="javascript:;"></a>';
		}
		else
		{
			dayDiv.innerHTML += '<a rel="calDay" title="View posts for the '+senddate+'" class="dayitem" href="/latest/'+sendcdate+'">'+day+'</a>';
		}

		hightlightToday();
	}
}

function hightlightToday(){

	var d = new Date();
	year = d.getFullYear();
	thismonth = d.getMonth();
	month = pmonths[thismonth];
	day = d.getDate();

	fsMonthYear = document.getElementById("actYear").innerHTML;
	
	umonthtxt = month.charAt(0).toUpperCase() + month.slice(1);
	curdttext = umonthtxt+' '+year;

	if(curdttext == fsMonthYear)
	{
		calDays = document.getElementById("days").getElementsByTagName("a");
		for(d=0;d<calDays.length;d++)
		{
			calDay = calDays[i];
			thisREL = calDay.getAttribute("rel");
			thisHTML = calDay.innerHTML;
			if(thisREL=="calDay" && thisHTML == day)
			{
				calDays.item(i).style.backgroundColor = '#fafe93';
				calDays.item(i).style.color = '#000000';
				calDays.item(i).style.fontWeight = 'bold';
			}
		}
	}
}


function isLeapYear(year){

return ((year%4 == 0) && (year%100 != 0 || year%400 == 0));

}




function readDaysInMonth(month,year)
{
    if (month == 1 && isLeapYear(year) == true) return 29;
    else return [31,28,31,30,31,30,31,31,30,31,30,31][month];
}

function showday(thisdate,thiscdate){

	top.location = "/latest/"+thiscdate;
}


function highlighttxt(){

paras = document.getElementsByTagName("p");
headsa = document.getElementsByTagName("h1");
headsb = document.getElementsByTagName("h2");
headsc = document.getElementsByTagName("h3");
headsd = document.getElementsByTagName("h4");
alinks = document.getElementsByTagName("a");
liitems = document.getElementsByTagName("li");
labels = document.getElementsByTagName("label");
divs = document.getElementsByTagName("div");
inputs = document.getElementsByTagName("input");

	document.getElementsByTagName("body")[0].style.backgroundColor = "#000000";
	
	for (var i=0; i<paras.length; i++) 
	{   
		var para = paras[i];  
 		paras.item(i).style.color ="#fbf30e";
 		paras.item(i).style.backgroundColor ="#000000";
	}
	
	for (var i=0; i<headsa.length; i++) 
	{   
		var heada = headsa[i];  
 		headsa.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<headsb.length; i++) 
	{   
		var headb = headsb[i];  
 		headsb.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<headsc.length; i++) 
	{   
		var headc = headsc[i];  
 		headsc.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<headsd.length; i++) 
	{   
		var headd = headsd[i];  
 		headsd.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<alinks.length; i++) 
	{   
		var alink = alinks[i];  
 		alinks.item(i).style.color ="#3bd711";
 		alinks.item(i).style.backgroundColor ="#000000";
 		alinks.item(i).style.textDecoration ="underline";
	}
	
	for (var i=0; i<liitems.length; i++) 
	{   
		var liitem = liitems[i];  
 		liitems.item(i).style.color ="#fbf30e";
 		liitems.item(i).style.backgroundColor ="#000000";
	}
	
	for (var i=0; i<labels.length; i++) 
	{   
		var labelss = labels[i];  
 		labels.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<divs.length; i++) 
	{   
		var divss = divs[i];  
 		divs.item(i).style.backgroundColor ="#000000";
 		divs.item(i).style.color ="#fbf30e";
	}
	
	for (var i=0; i<inputs.length; i++) 
	{   
		var inputss = inputs[i];  
 		inputs.item(i).style.backgroundColor ="#000000";
 		inputs.item(i).style.color ="#fbf30e";
	}
	
}


function ieWarning(){

	if(bName == "Explorer" && bVer == "6")
	{
		if(showIeWarning == "true")
		{
			if(!document.getElementById("iewarning"))
			{
				var ieBody = document.getElementsByTagName("body")[0];
				var ieDiv = document.createElement("div");
				ieBody.appendChild(ieDiv);
				ieDiv.setAttribute("id", "iewarning");
			}
			document.getElementById("iewarning").innerHTML = 'It appears you are using an old web browser such as Internet Explorer 6. It is recommended that you upgrade to the latest version of Internet Explorer (v8) or another modern web browser such as FireFox or Google Chrome. Some features of this website will not display correctly or are not compatible with Internet Explorer 6. To learn more about why you might be seeing this warning please visit <a href="http://www.atdc.co.uk/latest/16/hdybihini" target="_blank" title="Visit http://www.atdc.co.uk/latest/16/hdybihini [opens new window]">www.atdc.co.uk</a>. <a href="/stopwarning" id="closewarning">Close <img src="/gfx/close.gif" alt="close" width="10" height="10" style="vertical-align:middle;" /></a>';
			
			document.getElementById("iewarning").onmouseover = function(){document.getElementById("iewarning").style.backgroundColor = '#fdf9c0';}
			document.getElementById("iewarning").onmouseout = function(){document.getElementById("iewarning").style.backgroundColor = '#fffde2';}
		}
	}
}



/** http://www.quirksmode.org/js/detect.html           **/
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

var bName = BrowserDetect.browser;
var bVer = BrowserDetect.version;



window.onload = function (){extendPage();homePortfolio();flashLatest();popLinks();var slideThumbTimer = setTimeout("slideThumbs('down','load')",700);if(bName == "Explorer" && bVer == "6"){ieWarning();}}