//Pop-it menu- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var linkset=new Array()

// <!-- begin sub menu 1 -->
linkset[0]='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Stay/default.html"> Lodging Directory</a></div>'
linkset[0]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Stay/Lodging_Search.html">Customized Lodging Search</a></div>'
linkset[0]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Stay//North_Myrtle_Beach_Lodging.html">All Lodging North</a></div>'
linkset[0]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Stay/Central_Myrtle_Beach_Lodging.html">All Lodging Central</a></div>'
linkset[0]+='<div class="menuitems"><a href="http://www.VisitMyrtleBeach.com/Stay/South_Myrtle_Beach_Lodging.html">All Lodging South</a></div>'
// <!-- begin sub menu 2 -->
linkset[1]='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/default.html">Things To Do</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/Live_Entertainment.html">Live Entertainment</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Dine/default.html">Dining</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/Fishing.html">Fishing</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/Shopping.html">Shopping</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/Amusements_and_Attractions.html">Amusements</a></div>'
linkset[1]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Play/Water_Sports.html">Water Sports</a></div>'
linkset[1]+='<div class="menuitems"><a href="http://www.VisitMyrtleBeach.com/Play/Additional_Services.html">Additional Services</a></div>'
// <!-- begin sub menu 3 -->
linkset[2]='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.myrtlebeachareachamber.com/relocation/default.html">Retirement Information</a></div>'
linkset[2]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.myrtlebeachareachamber.com/relocation/default.html">Newcomer Information</a></div>'
linkset[2]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.myrtlebeachareachamber.com/relocation/realestate.html">Real Estate</a></div>'
linkset[2]+='<div class="menuitems"><a href="http://www.myrtlebeachareachamber.com/relocation/gsliving.html">Official Guide for Newcomers</a></div>'
// <!-- begin sub menu 4 -->
linkset[3]='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Area_Information">About the Area</a></div>'
linkset[3]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.myrtlebeachareachamber.com/directory/default.htm">Business Directory</a></div>'
linkset[3]+='<div class="menuitems" style="border-bottom: 1px solid #000000;"><a href="http://www.VisitMyrtleBeach.com/Area_Information/Tourism_Partners.html">Tourism Partners</a></div>'
linkset[3]+='<div class="menuitems"><a href="http://www.VisitMyrtleBeach.com/Area_Information/Beach_Information.html">Beach Information</a></div>'


////No need to edit beyond here

var ie4=document.all
var ns6=document.getElementById&&!document.all
var ns4=document.layers
var isMac=""
if(navigator.userAgent.indexOf("Mac") != -1){
    isMac = 1;
}

function showmenu(e,which,ofst){

if (!document.all&&!document.getElementById&&!document.layers)
return

clearhidemenu()

menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

if (ie4||ns6)
menuobj.innerHTML=which
else{
menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=220 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
menuobj.document.close()
}

if (ofst) {
eventX=(ie4? event.clientX : ns6? e.clientX : e.x)-ofst
}
else {
eventX=ie4? event.clientX : ns6? e.clientX : e.x
}
eventY=ie4? event.clientY : ns6? e.clientY : e.y



menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height

//Find out how close the mouse is to the corner of the window
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie4? document.body.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
if (ofst) {
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth-ofst : ns6? window.pageXOffset+eventX-menuobj.contentwidth-ofst : eventX-menuobj.contentwidth
}
else {
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
}
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX

//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight
else
menuobj.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY
menuobj.thestyle.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.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e){
if (ie4&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
if (ie4||ns6||ns4)
delayhide=setTimeout("hidemenu()",600)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

function highlightmenu(e,state){
if (document.all)
source_el=event.srcElement
else if (document.getElementById)
source_el=e.target
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
else{
while(source_el.id!="popmenu"){
source_el=document.getElementById? source_el.parentNode : source_el.parentElement
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
}
}
}
if (ie4||ns6)
document.onclick=hidemenu

// setup an event handler to hide popups for generic clicks on the document
function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if (isMac && getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}
function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj
function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}
function explorerMacResizeFix () {
    location.reload(false);
}


window.onload = initializeHacks;

// JS Library Routines
//

function pwin(d,w,h,s,p,n) {
// Position Window (popup)
// d = destination URL
// w = window width, h= window height
// s = scrollbars, p = position 
// 1 = top left, 2 = top right, 3 = bottom left, 4 = bottom right, 0 = center
// n = window name (optional)
if (n) {
WinName = n;
}
else {
WinName = "popup";
}
if (p == 1) {
tx = 10; 
ty = 10;
}
else
if (p == 2) {
tx = (screen.width - (w+10));
ty = 0;
}
else
if (p == 3) {
tx = 10;
ty = (screen.height - (h+65));
}
else
if (p == 4) {
tx = tx = (screen.width - (w+10));
ty = (screen.height - (h+65));
}
else {
tx = (screen.width - w) / 2;
ty = (screen.height - h) / 2;
}
	 nWindow = window.open(d,WinName,"width="+w+",height="+h+",top="+ty+",left="+tx+",titlebar=0,resizable=1,status=0,menubar=0,scrollbars="+s+",fullscreen=0");
	 nWindow.focus() 
}

function go(fm){
// drop down launch list
// fm = form name that contains the dd
// dropdown name must be quicklink
// URLs beginning with http:// will open in a new window
var menObj=fm.quicklink;
if (menObj.options[menObj.selectedIndex].value != "")
{
var dest = menObj.options[menObj.selectedIndex].value;
var dtest = /^http\:/i;
var result = dest.match(dtest)
if (result != null)
{
Newwindow = window.open(); Newwindow.location = dest;
}
else
{ window.location = dest; }
}
}
function later() {
// inactive link dialogue
alert('Coming Soon!');
}
