/***********************************************
* Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var defaultMenuWidth="215px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

//In Our Stores
linkset[0]='<hr>' //Optional Separator
linkset[0]+='<a href="repair.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Computer Repair</a>'
linkset[0]+='<a href="upgrade.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Computer Upgrade</a>'
linkset[0]+='<a href="spyware.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Virus and Spyware Removal</a>'
linkset[0]+='<hr>' //Optional Separator
linkset[0]+='<a href="pm.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Preventive Maintenance</a>'
linkset[0]+='<hr>' //Optional Separator

//At Your Business
linkset[1]='<hr>' //Optional Separator
linkset[1]+='<a href="busirepair.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Troubleshoot and Repair</a>'
linkset[1]+='<a href="corporatelan.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Corporate LAN Solutions</a>'
linkset[1]+='<a href="database.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Database Integrations</a>'
linkset[1]+='<hr>' //Optional Separator
linkset[1]+='<a href="pm.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Preventive Maintenance</a>'
linkset[1]+='<hr>' //Optional Separator

//At Your Home
linkset[2]='<hr>' //Optional Separator
linkset[2]+='<a href="network.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Wired or Wireless Setup</a>'
linkset[2]+='<a href="install.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Computer Installation</a>'
linkset[2]+='<a href="homerepair.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Computer Repair</a>'
linkset[2]+='<a href="upgrade.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Computer Upgrade</a>'
linkset[2]+='<a href="spyware.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Virus and Spyware Removal</a>'
linkset[2]+='<hr>' //Optional Separator
linkset[2]+='<a href="pm.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Preventive Maintenance</a>'
linkset[2]+='<hr>' //Optional Separator

//Contact
linkset[3]='<hr>' //Optional Separator
linkset[3]+='<a href="locations.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Locations / Maps / Directions</a>'
//linkset[3]+='<a href="phoneemail.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Phone or Email</a>'
linkset[3]+='<hr>' //Optional Separator

//About
linkset[4]='<hr>' //Optional Separator
//linkset[4]+='<a href="latest.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Latest News</a>'
linkset[4]+='<a href="testimonials.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Testimonials</a>'
linkset[4]+='<a href="ourhistory.html"><img src="images/accentphotos/r_1.gif" width="8" height="8" border="0" alt=""/> Our History</a>'
linkset[4]+='<hr>' //Optional Separator

////No need to edit beyond here

var ie5=document.all && !window.opera //Returns 'true' if ie
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
	return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

//function showmenu(e, which, optWidth, stPos){  //Added stPos to get the X coordinate
function showmenu(e, which, evX, optWidth){
if (!document.all&&!document.getElementById)
return

document.onmouseup=getXYPosition;
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth //default=150px
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
ourWidth=(document.body.clientWidth<774)? 774 : document.body.clientWidth //ie total Width
otherWidth=(window.outerWidth<744)? 744 : window.outerWidth //Other Browser Total Width
//alert("ie is " + ourWidth + "\nSa is " + otherWidth);
eventX=evX 
eventY=148  //Vertical distance from the top
//Find out how close the mouse is to the corner of the window
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (ie5? document.body.clientWidth<(ourWidth/2)-304+eventX+150 : window.outerWidth<(otherWidth/2)-304+eventX+150)
//move the horizontal position of the menu to the left by it's width
	menuobj.style.left=ie5? document.body.clientWidth+document.documentElement.scrollLeft-150+"px" : window.outerWidth-150+"px"
else
//position the horizontal position of the menu where it is supposed to display
	menuobj.style.left=ie5? (ourWidth/2)-304+eventX+"px" : (window.otherWidth/2)-314+eventX+"px" //change from 409 becaus eof safari
//Y Position
	menuobj.style.top=ie5? eventY+"px" : (eventY-2)+"px"
	menuobj.style.visibility="visible"
return false
}

/* Original: 
var rightedge=ie5? document.body.clientWidth : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY

if (rightedge<menuobj.contentwidth)

var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
	menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
	menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"

//Y Position
if (bottomedge<menuobj.contentheight)
	menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
	menuobj.style.top=ie5? iecompattest().scrollTop+eventY+"px" : window.pageYOffset+eventY
	menuobj.style.visibility="visible"
return false */


function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu
// Cursor coordinate functions
var myX, myY, xyOn, myMouseX, myMouseY;
xyOn = true;
function getXYPosition(e){
myMouseX=(e||event).clientX;
myMouseY=(e||event).clientY;
if (document.documentElement.scrollTop > 0) {
myMouseY = myMouseY + document.documentElement.scrollTop;
}
if (xyOn) {
// alert("X is " + myMouseX + "\nY is " + myMouseY);
}
}
function toggleXY() {
xyOn = !xyOn;
document.getElementById('xyLink').blur();
return false;
} 
