// JavaScript Document

var homeArrowPos=67;
var servicesArrowPos=221;
var clientsArrowPos=378;
var blogArrowPos=539;
var aboutArrowPos=700;
var contactArrowPos=855;
var mattyBoy;
var google_conversion_id = 1040480426;
var google_conversion_language = "en_GB";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "WpcGCPrpigEQqvGR8AM";
var newPos;

function menuArrowMove (pagePos,onOff) {
	if (onOff==1) {
		if (pagePos != curPageArrowPos) {
			if (mattyBoy != null) {
				mattyBoy.cancel(mattyBoy);
			}
			mattyBoy = new Effect.Move('menuArrow', { x: pagePos, y: 0, mode: 'absolute', transition: Effect.Transitions.spring });	
			newPos=pagePos;
		}
	}
	else {
		if (mattyBoy != null) {
			mattyBoy.cancel(mattyBoy);
		}
		mattyBoy = new Effect.Move('menuArrow', { x: curPageArrowPos, y: 0, mode: 'absolute', transition: Effect.Transitions.full });
	}
}

function dhtmlLoadScript()
{
   var e = document.createElement("script");
   e.src = 'http://www.googleadservices.com/pagead/conversion.js';
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}

var emailBoxOn=0;
function emailBox() {
	if (emailBoxOn==0) {
		new Effect.Appear('emailBox1');
		emailBoxOn=1;
	}
	else {
		new Effect.Fade('emailBox1');
		emailBoxOn=0;
	}
}

var videoBoxOn=0;
function videoBox() {
	if (videoBoxOn==0) {
		//$('vidBoxContent').innerHTML= videoSource;
		new Effect.Appear('videoBox1');
		videoBoxOn=1;
	}
	else {
		$('videoBox1').style.display='none';
		//$('vidBoxContent').innerHTML= '';
		videoBoxOn=0;
	}
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function ElmHeight(elmID,spacer,diff) {
var arrayPageSize = getPageSize();
var theHeight;
var spacerHeight;
	if(document.getElementById(elmID).clientHeight) {
		theHeight=(document.getElementById(elmID).clientHeight-diff);
	}
	else {
		if(document.getElementById(elmID).offsetHeight) {
			theHeight=(document.getElementById(elmID).offsetHeight-diff);
		}
	}
	//alert('PageSize: ' + arrayPageSize[1] + '\ntheHeight: ' + theHeight);
	if (arrayPageSize[1] > theHeight) {
		document.getElementById(spacer).style.height=(arrayPageSize[1]-theHeight-158-53) + 'px';
	}
	else document.getElementById(spacer).style.height ='18px';
	if (newPos==null) newPos = curPageArrowPos;
}