﻿// for the centering of the page depending monitor width
function centerPosition()
{
var documentWidth = screen.width;
//var documentHeight = screen.height;

var scrollBarWidth = 25;
var outerWrapper = document.getElementById("outerWrapper");
var innerWrapper = document.getElementById("innerWrapper");
outerWrapper.style.width = documentWidth - scrollBarWidth + "px";
innerWrapper.style.left = ( documentWidth / 2) - (innerWrapper.offsetWidth / 2)+ "px";

//outerWrapper.style.height = documentHeight - scrollBarWidth + "px";
//innerWrapper.style.top = (documentHeight / 2) - (innerWrapper.offsetHeight / 2)+"px";
}


	
// for the dropdown menu
function squishy(d){
    var p;
    p = document.getElementById('C' + d);
    if (p.style.display == 'none') {
        p.style.display = 'block';
    }
    else {
        p.style.display = 'none';
    }							    
}


							
// use rel='external' in links, when opening a new browser window is desired.
function externalLinks() 
{
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) 
	 {
	   var anchor = anchors[i];
	   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
	     anchor.target = "_blank";
	 }
}
window.onload = externalLinks;


	
// validates the form		
function validate()		
{
	 var s="";			 
	 if (document.info.name.value=="")
	   {s=s+"<li>Name is blank</li>";}		 
	 if ((document.info.email.value=="") && (document.info.phone.value==""))

	   {s=s+"<li>Please supply email or phone contact information.</li>";}
	if (s=="")
	{
		document.info.submit();
	}
	else
	{
		msg=window.open("validate.html","Error","scrollbars=no,width=400,height=300");		
		msg.document.write("<p>Problem</p><ul>"+s+"</ul>");		
		msg.document.write("<f"+"orm><p align='center'>Please enter the missing information and try again</p>");		
		msg.document.write("<p align='center'><input type='button' value='Close' onclick='self.close()'></p></for"+"m>");
	}
	return false;
}



// for the photo gallery
function image_click(f,pic)
{
 	eval("document.getElementById('large'+pic).src='images/"+pic+"/"+f+".jpg'");
}
