var curPic=0;
var onOff=0;
var iArr=new Array()
	//****************************************************************
	iArr[0]=["706", "586", "/Assets/Picture/screen-campaign-tmb-15408.png", "/Assets/Picture/screen-campaign-15545.png", "230", "190", "Campaign Creation"]
	iArr[1]=["800", "714", "/Assets/Picture/screen-email-thmb-15409.png", "/Assets/Picture/screen-email-15549.png", "230", "190", "Email"]
	iArr[2]=["703", "563", "/assets/Picture/screen-import-thmb-15542.png", "/assets/Picture/screen-import-15551.png", "230", "190", "Data Import"]
	iArr[3]=["776", "628", "/Assets/Picture/screen-opps1-15401.png", "/assets/Picture/screen-opps1-15552.png", "230", "190", "Opportunities"]
	iArr[4]=["816", "615", "/Assets/Picture/screen-forecast-thmb-15406.png", "/assets/Picture/screen-forecast-15550.png", "230", "190", "Forecasting"]
	iArr[5]=["920", "558", "/Assets/Picture/Screen-product-book-Thumb-15573.png", "/assets/Picture/Screen-product-book-15574.png ", "230", "190", "Product Book"]
	iArr[6]=["881", "699", "/Assets/Picture/Screen-Invoice-Thumb-15557.png", "/assets/Picture/Screen-Invoice-15558.png", "230", "190", "Invoicing"]
	iArr[7]=["1000", "673", "/Assets/Picture/Screen-Relationship-Thumb-15568.png", "/assets/Picture/Screen-Relationship-Big-15567.png", "230", "190", "Relationships"]
	iArr[8]=["911", "629", "/Assets/Picture/Csreen-Activities-thumb-15565.png", "/assets/Picture/Csreen-Activities-15566.png", "230", "190", "Activity Management"]
	iArr[9]=["853", "622", "/Assets/Picture/screen-dash-mkt-thbm-15538.png", "/assets/Picture/screen-dash-mkt-15547.png", "230", "190", "Marketing Dashboard"]
	iArr[10]=["1022", "785", "/Assets/Picture/Screen-Opportunity-Man-Thumb-15571.png", "/assets/Picture/Screen-Opportunity-Man-15570.png", "230", "190", ""]
	iArr[11]=["835", "804", "/Assets/Picture/screen-case-thmb-15537.png", "/assets/Picture/screen-case-15546.png", "230", "190", "Customer Support"]
	iArr[12]=["842", "618", "/Assets/Picture/lead-man-thmb-15410.png", "/assets/Picture/lead-man2-15560.png", "230", "190", "Login"]
	//**************************************************************** // imageObj.onLoaD=alert('images loaDed'); 	
	var n=iArr.length-1; var i=n;
	var imgObj=new Image(); 
	for(i=n; i>=0; i--) { imgObj.src=iArr[i][3]; } 	
function aniConfig(){
	this.noS=26; // # frames
	this.msI=26; // ms interval
	this.ssI=16; // slide interval
}
function findScr(){
	this.sY=getScrolledY();
	this.bY=getBrowserY();
	this.bX=getBrowserX();
	this.cX=Math.ceil(this.bX/2);
	this.cY=Math.ceil(this.sY+(this.bY/2));
}
function chaAtt(obj, str) { //should use more reliable ie if in head
	if (document.all)	{ this.sty = obj.style.setAttribute('cssText', str) }
	else			{ this.sty = obj.setAttribute('style', str) }
}
function findPos(obj){
	this.x=this.y=this.w=this.h=0;
	this.w+=obj.width;
	this.h+=obj.height;
	while(obj!=null){
		this.y+=obj.offsetTop;
		this.x+=obj.offsetLeft;
		obj=obj.offsetParent; }	
}
function centerEndPos(ePo){
	this.w=this.h=0;
	this.w=ePo.w/2;
	this.h=ePo.h/2;
}
function getEndPos(endImg,scr){
	this.w=iArr[endImg][0];
	this.h=iArr[endImg][1];
	this.x=scr.cX;
	this.y=scr.cY;
	this.tl=this.x+(this.w/2);
	this.tt=this.y-(this.h/2);
}
function calcFirstFrame(inc,pos,ePo){
	this.W=pos.w+inc.wRemain;
	this.H=pos.h+inc.hRemain;
	this.L=pos.x-inc.lRemain;
	this.T=pos.y-inc.tRemain;
}
function calcInc(pos,ePo,cPo,con){
	this.wInc=Math.floor((ePo.w-pos.w)/con.noS);
	this.hInc=Math.floor((ePo.h-pos.h)/con.noS);
	
	if ((ePo.x-cPo.w)<pos.x){	this.lInc=Math.floor((pos.x-(ePo.x-cPo.w))/con.noS); }
	else {						this.lInc=-Math.floor(((ePo.x-cPo.w)-pos.x)/con.noS); }
	if ((ePo.y-cPo.h)<pos.y){	this.tInc=Math.floor((pos.y-(ePo.y-cPo.h))/con.noS); }
	else {						this.tInc=-Math.floor(((ePo.y-cPo.h)-pos.y)/con.noS); }
	
	this.wRemain=(ePo.w-pos.w)-(this.wInc*con.noS);
	this.hRemain=(ePo.h-pos.h)-(this.hInc*con.noS);
	this.lRemain=((pos.x-(ePo.x-cPo.w))-(this.lInc*con.noS));
	this.tRemain=((pos.y-(ePo.y-cPo.h))-(this.tInc*con.noS));
}
function fadeOutEl(id,value){
	var obj=new gEBI(id);
	var count=100;
	for(var i=100; i>value; i--){
		setTimeout( function() { setOpacity(obj, count); count--; }, 8*i);
	}
}
function fadeInEl(id,value){
	var obj=new gEBI(id);
	var count=0;
	for(var i=0; i<=value; i++){
		setTimeout( function() { setOpacity(obj, count); count++; }, 8*i);
	}
}
function setOpacity(obj,value){
	obj.el.style.opacity=value/100;
	obj.el.style.filter='alpha(opacity='+value+')';
}
function setOpac(id,value){
	var obj=new gEBI(id);
	obj.el.style.opacity=value/100;
	obj.el.style.filter='alpha(opacity='+value+')';
}
function getBrowserX(){ var bX = document.body.offsetWidth; return bX; }
function getBrowserY(){ var bY;
	switch(true){	case(self.innerHeight!=null)			: bY=self.innerHeight; break;
					case(document.documentElement!=null)	: bY=document.documentElement.clientHeight; break;
					case(document.body!=null)				: bY=document.body.clientHeight; break; } return bY;
}
function getScrolledY(){ var sY;
	switch(true){	case(self.pageYOffset!=null)			: sY=self.pageYOffset; break;
					case(document.documentElement!=null)	: sY=document.documentElement.scrollTop; break;
					case(document.body!=null)				: sY=document.body.scrollTop; break; } return sY;
}
function isEl(obj) { if (document.getElementById(obj)) { return true; } }
function gEBI(obj) { if(obj=='body') { this.el=document.body; }else{ this.el=document.getElementById(obj); }}
function showEl(obj) { var sOb=new gEBI(obj); sOb.el.style.display='block'; }
function hideEl(obj) { var hOb=new gEBI(obj); hOb.el.style.display='none'; }
function removeEl(par, chi) { var cOb=new gEBI(chi); var pOb=new gEBI(par); pOb.el.removeChild(cOb.el); }
function appendEl(par, chi) { var pOb=new gEBI(par); pOb.el.appendChild(chi); }
function createEl(typ, nid) { var el=document.createElement(typ); el.setAttribute('id', nid); return el; }
function confNav(){
	var scr = new findScr();
	var nDiv = new createEl('div', 'nav_div');
	nDiv.style.display="none";
	if (scr.bY>10000) {
		var nStr='position:fixed; left:' +(scr.cX-192)+ 'px; bottom:30px; width:385px; height:20px; z-index:22;';
		var nSty = new chaAtt(nDiv, nStr);
		nDiv.innerHTML = "<table style=\"font-family:'Times New Roman',Georgia,Serif; font-size: 11px; width: 385px; height: 20px; background: transparent; margin: 0; padding: 0;\" cellpadding=\"0\" cellspacing=\"0\"><tr style=\"border: 0;\"><td valign=\"middle\" onclick=\"javascript: changeImg('prev');\" onmouseover=\"this.style.cursor='pointer'; this.style.color='#990000'\" onmouseout=\"this.style.color='#111111';\" style=\"margin: 0; padding: 0; text-align: center; border: 0; width: 85px; height: 20px; margin: 0; background: transparent; background-image: url('http://dusty.my-site.me.uk/button_1.gif'); background-repeat: no-repeat;\"><p style=\"margin: 2px 0 0 0; padding: 0;\"><strong>&laquo;</strong> &nbsp; Previous</p></td><td style=\"border: 0; margin: 0; padding: 0; background: transparent; width: 15px;\"></td><td valign=\"middle\" onclick=\"javascript: changeImg('next');\" onmouseover=\"this.style.cursor='pointer'; this.style.color='#990000'\" onmouseout=\"this.style.color='#111111';\" style=\"margin: 0; padding: 0; text-align: center; border: 0; width: 85px; height: 20px; margin: 0; background: transparent; background-image: url('http://dusty.my-site.me.uk/button_1.gif'); background-repeat: no-repeat;\">Next &nbsp; <strong>&raquo;</strong></td><td style=\"border: 0; margin: 0; padding: 0; background: transparent; width: 15px;\"></td><td id=\"ss_but\" valign=\"middle\" onclick=\"javascript: slideShow(1);\" onmouseover=\"this.style.cursor='pointer'; this.style.color='#990000'\" onmouseout=\"this.style.color='#111111';\" style=\"margin: 0; padding: 0; text-align: center; border: 0; width: 85px; height: 20px; margin: 0; background: transparent; background-image: url('http://dusty.my-site.me.uk/button_1.gif'); background-repeat: no-repeat;\">Play</td><td style=\"border: 0; margin: 0; padding: 0; background: transparent; width: 15px;\"></td><td valign=\"middle\" onmouseover=\"this.style.cursor='pointer'; this.style.color='#990000'\" onclick=\"javascript: closeImg('aniImg', '9999');\" onmouseout=\"this.style.color='#111111';\" style=\"margin: 0; padding: 0; text-align: center; border: 0; width: 85px; height: 20px; background: transparent; background-image: url('http://dusty.my-site.me.uk/button_1.gif');background-repeat: no-repeat;\">[<strong>x</strong>] &nbsp; Close</td></tr></table>";
		nDiv.style.display="block";
	}
	appendEl('anchor', nDiv);
}
function confImg(endImg, fFr){
	var aPic = new createEl('img', 'aniImg');
	aPic.src=iArr[endImg][2];
	aPic.alt=iArr[endImg][6];
	var pStr='width:' +fFr.W+ 'px; height:' +fFr.H+ 'px; display:block;';
	var pSty = new chaAtt(aPic, pStr);
	var aDiv = new createEl('div', 'aniDiv');
	var dStr='position:absolute; left:' +fFr.L+ 'px; top:' +fFr.T+ 'px; margin:0; padding:0; filter:alpha(opacity=25); opacity:.25; z-index:25;';
	var dSty = new chaAtt(aDiv, dStr);
	aDiv.appendChild(aPic);
	appendEl('anchor', aDiv);
}
function confBac(aniStat) {
	if (aniStat==0) {
		if(isEl('trans_back')) {
		}else{
			var aBac= new createEl('div', 'trans_back');
			var pageHei = (document.body.offsetHeight+24) + 'px';
			var bStr='position:absolute; width:100%; height:' +pageHei+ '; background:#000000; z-index:20; left:0px; top:0px; display:none;';
			var bSty = new chaAtt(aBac, bStr);
			document.body.appendChild(aBac);
			var tBac=new gEBI('trans_back');
			setOpac('trans_back', 0);
			aBac.style.display = 'block';
			fadeInEl('trans_back', 90); }
	}else{	//fadeOutEl('trans_back',0)  
	}
}
function openImg(startImg) {
	var endImg = startImg;
	var loadImg=new Image(); loadImg.src=eval('iArr[' +endImg+ '][3]');
	curPic = startImg; 
	if(isEl('thuDiv')){ startImg=startImg+1023; var aniStat=3; showEl('nav_div'); }else{ var aniStat=0; }
	var sId=new gEBI(startImg);
	var con=new aniConfig();
	var scr=new findScr();
	var pos=new findPos(sId.el);
	var ePo=new getEndPos(endImg, scr);
	var cPo=new centerEndPos(ePo);
	var inc=new calcInc(pos, ePo, cPo, con);
	var fFr=new calcFirstFrame(inc, pos, ePo);
	var cIm=new confImg(endImg, fFr);

	var closeIcon = new createEl('img', 'close_icon');
	closeIcon.src="/assets/Picture/Symbol-Delete-15604.png";
	closeIcon.alt="Close Screen Shot";
	closeIcon.style.position="absolute";
	closeIcon.style.left=(ePo.tl + 4) + "px";
	closeIcon.style.top=(ePo.tt) + "px";
	closeIcon.style.zIndex="100";
	closeIcon.style.width="32px";
	closeIcon.style.height="32px";
	closeIcon.style.display="none";
	appendEl('anchor', closeIcon);
	closeIcon.onclick = function() { closeImg('aniImg', '9999'); }
	closeIcon.setAttribute("onMouseOver", "this.style.cursor='pointer';");

	var fAn=new animateEl(con, inc, fFr, endImg, aniStat, loadImg);
}
function closeImg(startImg, endImg) {
	var remoIcon = new removeEl('anchor', 'close_icon');
	setOpac('aniImg', 25);
	var loadImg=null;
	if (endImg=='9999') { endImg=curPic; }
	var aImg = new gEBI('aniImg');
	var aDiv = new gEBI('aniDiv');
	aDiv.el.style.backgroundImage='';
	var aniStat=1;
	var ssE=new slideShow(2);
	var sId=new gEBI(startImg);
	var eId=new gEBI(endImg);
	var con=new aniConfig();
	var scr=new findScr();
	var pos=new findPos(sId.el);
	var ePo=new findPos(eId.el);
	var cPo=new Object(); cPo.w = cPo.h = 0;
	var inc=new calcInc(pos, ePo, cPo, con);
	var fFr=new calcFirstFrame(inc, pos, ePo);
	sId.el.src = eId.el.src;
	var remo=new removeEl('body', 'trans_back');
	animateEl(con, inc, fFr, endImg, aniStat, loadImg);
}
function changeImg(nImg) {
	setOpac('aniImg', 10);
	var sId=new gEBI('aniImg');
	var aDiv=new gEBI('aniDiv');
	var con=new aniConfig();
	var scr=new findScr();
	var pos=new findPos(sId.el);
	switch(nImg){	case 'prev' : curPic--; if (curPic<0) { curPic=iArr.length--; } break;
					case 'next' : curPic++; if (curPic==iArr.length) { curPic=0; } break;
					case 'last' : curPic=iArr.length; break;
					case 'firs' : curPic=0; break; }
	
	aDiv.el.style.backgroundImage='';
	var endImg = curPic;
	var loadImg=new Image(); loadImg.src=eval('iArr[' +endImg+ '][3]');
	sId.el.src=iArr[endImg][3];
	var aniStat=2;
	con.noS=con.ssI;
	var ePo=new getEndPos(endImg, scr);
	var cPo=new centerEndPos(ePo);
	var inc=new calcInc(pos, ePo, cPo, con);
	var fFr=new calcFirstFrame(inc, pos, ePo);
	animateEl(con, inc, fFr, endImg, aniStat, loadImg);
}
function animateEl(con, inc, fFr, endImg, aniStat, loadImg) {
	var aDiv=new gEBI('aniDiv');
	var aPic=new gEBI('aniImg');
	var closeIcon=new gEBI('close_icon');
	var count=0;
	var fArr = new Array();
	for(var i=1; i<=con.noS; i++){
		var lPos = (fFr.L - (inc.lInc * i)) + 'px';
		var tPos = (fFr.T - (inc.tInc * i)) + 'px';
		var wPos = (fFr.W + (inc.wInc * i)) + 'px';
		var hPos = (fFr.H + (inc.hInc * i)) + 'px';
		fArr[i] = [lPos, tPos, wPos, hPos]
	}
	
	function animate() {	
		if (count<con.noS) {
			count++;
			aDiv.el.style.left=fArr[count][0];
			aDiv.el.style.top=fArr[count][1];
			aPic.el.style.width=fArr[count][2];
			aPic.el.style.height=fArr[count][3];
		}else{
			window.clearInterval(int);
			if(aniStat==1) {	fadeOutImg(); }
			else{				var newImg = iArr[endImg][3];
								aDiv.el.style.backgroundImage="url(" + loadImg.src + ")";
								setOpac('aniDiv', 100);
								if (document.all) { fadeOutEl('aniImg', 0); } else { newImg.onload=fadeOutEl('aniImg', 0); }
								aPic.el.onclick = function() { closeImg('aniImg', '9999'); }
								aPic.el.setAttribute("onMouseOver", "this.style.cursor='pointer';");
								closeIcon.el.style.display="block";
								if (aniStat==0) { confBac(aniStat); confNav(); }
								if (isEl('thuDiv')) { removeEl('anchor', 'thuDiv'); }
			}
		}
	}
	var int = self.setInterval(function() { animate(); }, con.msI);
}
function fadeOutImg() {
	//slideShow(2);
	confBac('1');
	hideEl('aniDiv'); hideEl('nav_div');
	removeEl('aniDiv', 'aniImg');
	removeEl('anchor', 'nav_div');
	removeEl('anchor', 'aniDiv');
	curPic=0;
}
function slideShow(cmd) {
	var but = new gEBI('ss_but');
	if(onOff==0 && cmd==1) { onOff=1; but.el.innerHTML='Stop'; }
	else if(onOff==1&&cmd==2 || onOff==1&&cmd==1) { clearTimeout(ss); but.el.innerHTML='Play'; onOff=0; }
	if(onOff==1) { changeImg('next'); var ss = setTimeout("slideShow (0)", 4500); }
}


/*
function mouseOver(this) {
    this.parentNode.style.backgroundColor = '#D3FF06';  // 4
    return this;
}
 
function mouseOut(this) {
    this.parentNode.style.backgroundColor = '#171717';
    return this;
}
*/


/* HOME PAGE SLIDE SHOW */

var imgArr = new Array() 
imgArr[0]=["http://dusty.my-site.me.uk/logos/ss_lucid.gif", "Lucid IT Services", "/Lucid.html"]
imgArr[1]=["http://dusty.my-site.me.uk/logos/ss_northdoor.gif", "Northdoor", "/northdoor.html"]
imgArr[2]=["http://dusty.my-site.me.uk/logos/ss_estm.gif", "EST Marketing", "/estmarketing.html"]
imgArr[3]=["http://dusty.my-site.me.uk/logos/ss_metadigm.gif", "Metadigm", "/metadigm.html"]
imgArr[4]=["http://dusty.my-site.me.uk/logos/ss_lyonsdown.gif", "Lyonsdown", "/lyonsdown.html"]
imgArr[5]=["http://dusty.my-site.me.uk/logos/ss_horizon.gif", "Horizon", "/horizon.html"]

function fadeLogo() {
	var toImg=-1;
	var nextLogo=0;
	var ssImg=document.getElementById('ss_img');
	var ssDiv=document.getElementById('ss_div');
	ssDiv.onclick = function () { parent.location = "/lucid.html" }
	ssDiv.onmouseover = function() { this.style.cursor='pointer' };

	function fadeIt() {
		var count=100;
		if (toImg==imgArr.length-2) { nextLogo=0; toImg=5;
		}else if (toImg==imgArr.length-1) { nextLogo=1; toImg=0;
		}else{ toImg++; nextLogo=toImg+1; }
		
		//ssImg.style.display="none";
		var newFront = imgArr[toImg][0];
		ssImg.src=newFront;
		ssImg.style.opacity=0.99;
		ssImg.style.filter='alpha(opacity=100)';
		var newBack = imgArr[nextLogo][0];

		ssDiv.onclick = function() { var linkTo = imgArr[nextLogo][2]; parent.location = linkTo };
		
		ssImg.style.display="block";
		ssDiv.style.background="url('" + newBack + "') no-repeat";

		for(var i=100; i>0; i=i-3){
		var tim = setTimeout( function(){
						ssImg.style.opacity=count/100;
						ssImg.style.filter='alpha(opacity='+count+')';
						count=count-3;
						}
		,16*i);
		}
	}
	var int = self.setInterval( function() { fadeIt() }, 4000);
}












































































