
//Main Navigation
// Create image objects and preload all active and inactive images
if (document.images) { 
    // Six image objects for the active images
    var img1on = new Image();   
    img1on.src = "../images/nav/main_hov.gif"; 
    var img2on = new Image();         
    img2on.src = "../images/nav/gallery_hov.gif";
    var img3on = new Image();
    img3on.src = "../images/nav/process_hov.gif";
    var img4on = new Image();
    img4on.src = "../images/nav/tools_hov.gif";
    var img5on = new Image();
    img5on.src = "../images/nav/about_hov.gif";
	var img6on = new Image();
	img6on.src = "../images/nav/toolsx_hov.gif"
    
    // Six image objects for the inactive images
    var img1off = new Image();         
    img1off.src = "../images/nav/main_norm.gif";
    var img2off = new Image();         
    img2off.src = "../images/nav/gallery_norm.gif";
    var img3off = new Image();
    img3off.src = "../images/nav/process_norm.gif";
    var img4off = new Image();
    img4off.src = "../images/nav/tools_norm.gif";
    var img5off = new Image();
    img5off.src = "../images/nav/about_norm.gif";
    var img6off = new Image();
    img6off.src = "../images/nav/toolsx_norm.gif";
}

// Function to activate an image
function imgon(imgName) {
    if (document.images) {
        document.images[imgName].src = eval(imgName + "on.src");
    }
}

// Function to deactivate an image
function imgoff(imgName) {          
    if (document.images) {
        document.images[imgName].src = eval(imgName + "off.src");
    }
}

/*Javascript used to open window to display special.php */
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

/*Larger image javascript used on Process page */
/***********************************************
* Image Thumbnail viewer- © Dynamic Drive (www.dynamicdrive.com)
* Last updated Sept 26th, 03'. This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/



var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")



// Drop Down Menu used on Gallery pages

function fillSelect()
{
  var pageNames=new Array("../gallery","../unique_gifts","../links");
  var pageTitles=new Array("Gallery","Unique Gifts","Where to Purchase");

  var numPages=pageNames.length;
  var j=1;

  var URLbits=self.location.href.split("/");
  var currPage=URLbits[URLbits.length-1];
  var currPageName=currPage.split(".")[0];

  for(var i=0;i<numPages;i++)
  {
    if(currPageName!=pageNames[i])
    {
      document.navForm.menu.options[j]=new Option(pageTitles[i],pageNames[i]);
      j++;
    }
  }
}

function goThere(form)
{
  if(form.menu.selectedIndex)
    self.location.href=form.menu.options[form.menu.selectedIndex].value+".php";
}

/* Used for contact.php form validation */

function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("Email addresses you entered do not match.  Please re-enter.")
    email.focus()
  }
  if (thesubject.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the subject.")
    thesubject.focus()
  }
  if (themessage.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the details for your inquiry.")
    themessage.focus()
  }
  if (okSoFar==true)  submit();
  }
 }
