// JavaScript Document

 function clearMe(formfield){
  if (formfield.defaultValue==formfield.value)
   formfield.value = ""
 }




function validateForm(enquire)
{



if(""==document.getElementById('name').value)
{
alert("Please enter your name.");
return false;
}

if(""==document.getElementById('email').value)
{
alert("Please enter your email address.");
return false;
}

}



var floatingMenuId = 'floatdiv'; 
var floatingMenu = 
{ 
targetX: 0, 
targetY: 14, 

hasInner: typeof(window.innerWidth) == 'number', 
hasElement: document.documentElement 
&& document.documentElement.clientWidth, 

menu: 
document.getElementById 
? document.getElementById(floatingMenuId) 
: document.all 
? document.all[floatingMenuId] 
: document.layers[floatingMenuId] 
}; 

floatingMenu.move = function () 
{ 
if (document.layers) 
{ 
floatingMenu.menu.left = floatingMenu.nextX; 
floatingMenu.menu.top = floatingMenu.nextY; 
} 
else 
{ 
floatingMenu.menu.style.left = floatingMenu.nextX + 'px'; 
floatingMenu.menu.style.top = floatingMenu.nextY + 'px'; 
} 
} 

floatingMenu.computeShifts = function () 
{ 
var de = document.documentElement; 

floatingMenu.shiftX = 
floatingMenu.hasInner 
? pageXOffset 
: floatingMenu.hasElement 
? de.scrollLeft 
: document.body.scrollLeft; 
if (floatingMenu.targetX < 0) 
{ 
if (floatingMenu.hasElement && floatingMenu.hasInner) 
{ 
// Handle Opera 8 problems 
floatingMenu.shiftX += 
de.clientWidth > window.innerWidth 
? window.innerWidth 
: de.clientWidth 
} 
else 
{ 
floatingMenu.shiftX += 
floatingMenu.hasElement 
? de.clientWidth 
: floatingMenu.hasInner 
? window.innerWidth 
: document.body.clientWidth; 
} 
} 

floatingMenu.shiftY = 
floatingMenu.hasInner 
? pageYOffset 
: floatingMenu.hasElement 
? de.scrollTop 
: document.body.scrollTop; 
if (floatingMenu.targetY < 0) 
{ 
if (floatingMenu.hasElement && floatingMenu.hasInner) 
{ 
// Handle Opera 8 problems 
floatingMenu.shiftY += 
de.clientHeight > window.innerHeight 
? window.innerHeight 
: de.clientHeight 
} 
else 
{ 
floatingMenu.shiftY += 
floatingMenu.hasElement 
? document.documentElement.clientHeight 
: floatingMenu.hasInner 
? window.innerHeight 
: document.body.clientHeight; 
} 
} 
} 

floatingMenu.doFloat = function() 
{ 
var stepX, stepY; 

floatingMenu.computeShifts(); 

stepX = (floatingMenu.shiftX + 
floatingMenu.targetX - floatingMenu.nextX) * .07; 
if (Math.abs(stepX) < .5) 
{ 
stepX = floatingMenu.shiftX + 
floatingMenu.targetX - floatingMenu.nextX; 
} 

stepY = (floatingMenu.shiftY + 
floatingMenu.targetY - floatingMenu.nextY) * .25; 
if (Math.abs(stepY) < .5) 
{ 
stepY = floatingMenu.shiftY + 
floatingMenu.targetY - floatingMenu.nextY; 
} 

if (Math.abs(stepX) > 0 || 
Math.abs(stepY) > 0) 
{ 
floatingMenu.nextX += stepX; 
floatingMenu.nextY += stepY; 
floatingMenu.move(); 
} 

setTimeout('floatingMenu.doFloat()', 20); 
}; 

// addEvent designed by Aaron Moore 
floatingMenu.addEvent = function(element, listener, handler) 
{ 
if(typeof element[listener] != 'function' || 
typeof element[listener + '_num'] == 'undefined') 
{ 
element[listener + '_num'] = 0; 
if (typeof element[listener] == 'function') 
{ 
element[listener + 0] = element[listener]; 
element[listener + '_num']++; 
} 
element[listener] = function(e) 
{ 
var r = true; 
e = (e) ? e : window.event; 
for(var i = element[listener + '_num'] -1; i >= 0; i--) 
{ 
if(element[listener + i](e) == false) 
r = false; 
} 
return r; 
} 
} 

//if handler is not already stored, assign it 
for(var i = 0; i < element[listener + '_num']; i++) 
if(element[listener + i] == handler) 
return; 
element[listener + element[listener + '_num']] = handler; 
element[listener + '_num']++; 
}; 

floatingMenu.init = function() 
{ 
floatingMenu.initSecondary(); 
floatingMenu.doFloat(); 
}; 

// Some browsers init scrollbars only after 
// full document load. 
floatingMenu.initSecondary = function() 
{ 
floatingMenu.computeShifts(); 
floatingMenu.nextX = floatingMenu.shiftX + 
floatingMenu.targetX; 
floatingMenu.nextY = floatingMenu.shiftY + 
floatingMenu.targetY; 
floatingMenu.move(); 
} 

if (document.layers) 
floatingMenu.addEvent(window, 'onload', floatingMenu.init); 
else 
{ 
floatingMenu.init(); 
floatingMenu.addEvent(window, 'onload', 
floatingMenu.initSecondary); 
} 

















// Ticker startup
function startTicker()
{
 // Define run time values
 theCurrentStory	 = -1;
 theCurrentLength	= 0;
 // Locate base objects
 if (document.getElementById) { 
	  theAnchorObject	 = document.getElementById("tickerAnchor");
   runTheTicker();	
   }
 else {
			document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
			return true;
 }
}
// Ticker main run loop
function runTheTicker()
{
 var myTimeout;  
 // Go for the next story data block
 if(theCurrentLength == 0)
 {
  theCurrentStory++;
  theCurrentStory	  = theCurrentStory % theItemCount;
  theStorySummary	  = theSummaries[theCurrentStory].replace(/&quot;/g,'"');  
  theTargetLink		= theSiteLinks[theCurrentStory];
  theAnchorObject.href = theTargetLink;
  thePrefix 	  = "<span class=\"tickls\">"+theLeadString+"</span>";
 }
 // Stuff the current ticker text into the anchor
 theAnchorObject.innerHTML = thePrefix + 
 theStorySummary.substring(0,theCurrentLength) + whatWidget();
 // Modify the length for the substring and define the timer
 if(theCurrentLength != theStorySummary.length)
 {
  theCurrentLength++;
  myTimeout = theCharacterTimeout;
 }
 else
 {
  theCurrentLength = 0;
  myTimeout = theStoryTimeout;
 }
 // Call up the next cycle of the ticker
 setTimeout("runTheTicker()", myTimeout);
}
// Widget generator
function whatWidget()
{
 if(theCurrentLength == theStorySummary.length)
 {
  return theWidgetNone;
 }

 if((theCurrentLength % 2) == 1)
 {
  return theWidgetOne;
 }
 else
 {
  return theWidgetTwo;
 }
}


 var theCharacterTimeout = 30;
 var theStoryTimeout	 = 5000;
 var theWidgetOne		= "_";
 var theWidgetTwo		= "&nbsp;";
 var theWidgetNone	   = "";
 var theLeadString	   = "";

 var theSummaries = new Array();
 var theSiteLinks = new Array();

 var theItemCount = 4;

 
  theSummaries[0] = "fadein is the website of digital designer chris kentish.";
  theSiteLinks[0] = "mailto:info@fadein.co.uk";
 
  theSummaries[1] = "web design and development, rich media, online advertising, motion graphics, print design and illustration.";
  theSiteLinks[1] = "mailto:info@fadein.co.uk";
  
  theSummaries[2] = "clients include: channel4, kpmg, glaxosmithkline, heinz, sharp, birmingham city council and numerous smaller clients across many sectors.";
  theSiteLinks[2] = "mailto:info@fadein.co.uk";
  
  theSummaries[3] = "this is a temporary site, to see further examples of work and/or to discuss a project that I could help you with please get in touch.";
  theSiteLinks[3] = "mailto:info@fadein.co.uk";
  

 

 

 startTicker();










