// Keeps all the global Functions Used everywhere within the page

function winWidth() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.documentElement) return document.documentElement.offsetWidth;
    else if (document.body.clientWidth) return document.body.clientWidth;
}

function winHeight() {
	if (window.innerHeight) return window.innerHeight;
	else if (document.documentElement) return document.documentElement.offsetHeight;
    else if (document.body.clientHeight) return document.body.clientHeight;
}
function placeIt(id, x, y) {
   object=document.getElementById(id);
   object.style.left=x+"px";
   object.style.top=y+"px";
}
function hideIt(object) {
   object.style.visibility="hidden";
}

function showIt(object) {
   object.style.visibility="visible";
}


var activeMenu=null;
var activeTitle=null;
var mainMenu_interval = null;
var activeDiv = document.getElementById('content');
  
function hideActive() {
	if ( activeMenu !== null ) {
	  hideIt(activeMenu);
	  activeMenu = null;
	}
	
}

function popMenu(M, T) {
	hideActive();
	fillTitleD(T);
	activeMenu = document.getElementById(M);
	showIt(activeMenu);
}

function fillTitle(id) {
if (mainMenu_interval !== null) {
clearInterval(mainMenu_interval);
}
var object = document.getElementById(id);
name = id;
returnTitle();
activeTitle = document.getElementById(id);
object.style.backgroundImage = "url('menu_blank_hover.png')";
object.style.backgroundPosition = "0px"
object.style.color = "white";
object.style.textDecoration = 'none';
}

function returnTitle() {
if (activeTitle !== null) {
activeTitle.style.backgroundImage = "url('menu_blank.png')";
activeTitle.style.color = "#6587E0";
activeTitle.style.backgroundPosition = "0";
}
}

function fillBackground(id) {
var object = document.getElementById(id);
position = parseInt(object.style.backgroundPosition);
if ( position < 0 ) {
position += 5;
object.style.backgroundPosition = position + "px";
} else clearInterval(mainMenu_interval);
}

function fillTitleD(id) {
if (mainMenu_interval !== null) {
clearInterval(mainMenu_interval);
}
var object = document.getElementById(id);
name = id;
returnTitle();
activeTitle = document.getElementById(id);
object.style.backgroundRepeat = "no-repeat";
object.style.backgroundPosition = "-140px";
object.style.backgroundImage = "url('menu_blank_hover_D.png')";
object.style.color = "white";
object.style.textDecoration = 'none';
mainMenu_interval = setInterval("fillBackground(name)", 15);
}

function fillBackgroundD(id) {
var object = document.getElementById(id);
position = parseInt(object.style.backgroundPosition);
if ( position < 0 ) {
position += 5;
object.style.backgroundPosition = position + "px";
} else clearInterval(mainMenu_interval);
}

	function testLength(field) {
		if (field.value.length == 0) {
			field.style.backgroundColor = "#ffff77";
			return false;
		} else {
			field.style.backgroundColor = "white";
			return true;
		}
	}
	
	function testPattern(field, reg) {
		if ( reg.test(field.value) == false ) {
			field.style.backgroundColor = "#ffff77";
			field.style.color="green";
			return false;
		} else {
			field.style.backgroundColor = "white";
			field.style.color="black";
			return true;
		}
	}
	
	function validateForm() {
		var valid = true;
		if ( testPattern(document.request_form.client_email, /^\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,8}$/) == false )
			valid = false;
		if ( valid == false )
			alert("Please enter your email address in the correct format");
	return valid;
	}
	

<!--

//*****************************************
// Blending Image Slide Show Script- 
// © Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("menu_blank.png","menu_blank_hover.png","img3.jpg","img4.jpg")



var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}

//-->

