var returnValue1 = true, linksExt = ["http://www.cbsit.co.uk/","http://www.3rdsix.co.uk"], imgsExt = ["/images/adverts/city-business-solutions.gif",  "/images/adverts/third-six-pupillage.jpg"], len1 = (linksExt.length + imgsExt.length) / 2;

var returnValue2 = true, links = ["http://www.barsquared.com/files/products/lex-chambers-management/lex-criminal-graduated-fees.html", "http://www.barsquared.com/files/products/edict-solicitor-diary-management/edict-solicitor-app-overview.htm"], imgs = ["/images/adverts/lex-carter-advert.gif", "/images/adverts/edict-advert.gif"], len2 = (links.length + imgs.length) / 2;

if((len1*2)%2 == 1){returnValue=false;}
if((len2*2)%2 == 1){returnValue=false;}

var w = 480, h = 340;
if (document.all || document.layers) {
	w = screen.availWidth;
	h = screen.availHeight;	
}
var popW = 1000;
var popH = 600;
var leftPos = (w-popW)/2;
var topPos = (h-popH)/2;

function extPop(extLink){
	var popup=window.open(extLink,'a','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos );
	popup.focus();
}
function externalAd(){
	if(returnValue1==false)
	{document.write('<img src="blank.gif" alt="">');return false;}
	var rand = Math.floor(len1*Math.random())
	document.write("<a href=\"#\" onclick=\"extPop('"+linksExt[rand]+"')\" title=\"Go to "+linksExt[rand]+"\"><img src=\""+imgsExt[rand]+"\" alt=\"Go to "+linksExt[rand]+"\"></a>");
}
function internalAd(){
if(returnValue2==false)
	{document.write('<img src="blank.gif" alt="">');return false;}
	var rand = Math.floor(len2*Math.random())
	document.write("<a href=\""+links[rand]+"\" title=\"Go to "+links[rand]+"\"><img src=\""+imgs[rand]+"\" alt=\"Go to "+links[rand]+"\"></a>");
}
function extPop2(extLink2, extTitle2){
	var popup=window.open(extLink2,extTitle2,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
	popup.focus();
}

