/////////////////////////////////////
/// Preload Rollover Image ///
//////////////////////////////
image01= new Image
image01.src="/assets/images/nav/services-over.jpg"
image02= new Image
image02.src="/assets/images/nav/staff-over.jpg"
image03= new Image
image03.src="/assets/images/nav/gallery-over.jpg"
image04= new Image
image04.src="/assets/images/nav/kudos-over.jpg"
image05= new Image
image05.src="/assets/images/nav/faq-over.jpg"
image06= new Image
image06.src="assets//images/nav/contact-over.jpg"
image07= new Image
image07.src="assets//images/nav/home-over.jpg"

/////////////////////////////////////
/// Mouse Over ///
//////////////////
function move_in(img_name,img_src){document[img_name].src=img_src;}
function move_out(img_name,img_src){document[img_name].src=img_src;}

function AWDIS(){
	this.agt    	= navigator.userAgent.toLowerCase();
	this.ver        = navigator.appVersion.toLowerCase();
	this.dom        = document.getElementById?1:0;
    this.major  	= parseInt(navigator.appVersion);
    this.minor  	= parseFloat(navigator.appVersion);
	this.mac    	= (this.agt.indexOf("mac")!=-1);
	this.gecko      = (this.agt.indexOf('gecko') != -1)?1:0;
	this.ns         = (this.agt.indexOf('mozilla') != -1 && (this.agt.indexOf('spoofer') == -1 && this.agt.indexOf('compatible') == -1))?1:0;
	this.ns45       = (this.ns && this.minor >= 4.5 && !this.dom)?1:0;
	this.ns6        = (this.ns && this.dom && this.major == 5 && this.gecko && window.sidebar && !document.layers)?1:0;
	this.opera5     = (this.agt.indexOf("opera 5")>-1 && window.opera)?1:0;
	this.opera6     = (this.agt.indexOf("opera 6")>-1 && window.opera)?1:0;
	this.ie4        = (!window.opera && document.all && !this.dom)?1:0;
	this.ie5        = (!window.opera && this.ver.indexOf("msie 5")>-1 && this.dom)?1:0;
	this.ie6        = (!window.opera && this.ver.indexOf("msie 6")>-1 && this.dom)?1:0;
	this.good	= (this.ns6 || this.ie || this.opera6) // browser that can visit site.
	this.writable_text	= (this.ns6 || this.ie4 || this.ie5 || this.ie6) // writable layers capable browsers
}
var AWDis = new AWDIS();

function AWD_get_center_pos_of_screen(){
	this.w=(AWDis.ns6 || AWDis.ns45)?window.innerWidth:document.body.clientWidth;
	return this.w/2;
}

function AWD_Position_Objects(way,obj,center,top){
	if(AWDis.ns){
		var arg = window.innerWidth - document.body.clientWidth;
		center = (center - (arg));
	}
	if(arg){ center = center + 7; }
	this.subtitle=(AWDis.ns6 || AWDis.ie6)?document.getElementById(obj):document.all[obj];
	this.subtitle_center=(way == 'left')?WE_get_center_pos_of_screen()-center:AWD_get_center_pos_of_screen()+center;
	this.subtitle.style.left=this.subtitle_center;
	this.subtitle.style.top=top;
	this.subtitle.style.visibility='visible';
}

function init(){
	AWD_Position_Objects('center','body',-350,'0px');
}

onload=init;

/////////////////////////////////////
/// Navigation Bar ///
//////////////////////
function nav(page){window.location=page}

////////////////////////////////////////////////////
///// Dynamic pop_up window ///
///////////////////////////////
function openPictureWindow(source,imageWidth,imageHeight,alt,left,top){
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+50+",top="+50);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title>');
	newWindow.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"');
	newWindow.document.write(' onBlur="self.close()">');
	newWindow.document.write('<img src="'+source+'" width='+imageWidth+' height='+imageHeight+' alt="'+alt+'">');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

////////////////////////////////////////////////////
///// hidden layer effect ///
/////////////////////////////
function find_obj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=find_obj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function show_hide_layers() { 
  var i,p,v,obj,args=show_hide_layers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=find_obj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

////////////////////////////////////////////////////
///// Validate the contact form ///
///////////////////////////////////
function validate_contact() {
	if(document.contact.name.value == '') {
		alert("Please enter Your Name.");
		document.contact.name.focus();
		return false;
	}
	else if(document.contact.email.value == '') {
		alert("Please enter Your Email Address.");
		document.contact.email.focus();
		return false;
	}
	else if(document.contact.email.value != document.contact.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi)) {
		alert("Please enter a valid Email address.");
		document.contact.email.focus();
		return false;
	}
	else if(document.contact.number_responce.value == '') {
		alert("Please type number you see to the left.");
		document.contact.number_responce.focus();
		return false;
	}
	else {
		return true;
	}
}