//------------------------------------------------------------------
//common_gep.js
//Shared JavaScript code
//Grand Events Photography
//------------------------------------------------------------------

//******************************************************************

/*******************************************************************
* Function		: RightClick
* Language		: JavaScript
* Description	: Opens a Copyright window on a "Right Click"
* Called By	: Web page
********************************************************************/

function RightClick()
	{
	var theYear = new Date().getYear()
	if(event.button==2)
		{
			alert('This advertisement is under Copyright (c) '+theYear+' Grand Events Phtography.  All Rights Reserved !');
 		}
 	}
	document.onmousedown=RightClick

// -----------------------------------------------------------------
// Function		: NewWindow
// Language		: JavaScript
// Description	: Opens a link to a page in a new window
// Called By	: Web page
// Original		: Eric King (eric_andrew_king@hotmail.com)
// Web Site		: http://redrival.com/eak/
// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com
// -----------------------------------------------------------------

function NewWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}

/*******************************************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm (script source page)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
********************************************************************/

//Contents for menu 1, Portraits / LifeStyle
var menu1=new Array()
menu1[0]='<a href="/portraits.htm">Children</a>'
menu1[1]='<a href="/portraits.htm">Engagement</a>'
menu1[2]='<a href="/portraits.htm">Families & Groups</a>'
menu1[3]='<a href="/portraits.htm">Holiday</a>'
menu1[4]='<a href="/portraits.htm">Pets</a>'
menu1[5]='<a href="/portraits.htm">Portraits</a>'
menu1[6]='<a href="/portraits.htm">Religious</a>'
menu1[7]='<a href="/portraits.htm">Senior Pictures</a>'
menu1[8]='<a href="/portraits.htm">Special Kids & Adults</a>'
menu1[9]='<a href="/portraits.htm">~ LifeStyle ~</a>'
menu1[10]=' ' //alt-255 value for a blank line
menu1[11]='<a href="/portraits.htm#Gallery">* GALLERY *</a>'
menu1[12]='<a href="/portraits.htm#Packages">* PRICING *</a>'

//Contents for menu 2, Sports / Clubs
var menu2=new Array()
menu2[0]='<a href="/sports_clubs.htm">Clubs & Groups</a>'
menu2[1]='<a href="/sports_clubs.htm">Cheerleading</a>'
menu2[2]='<a href="/sports_clubs.htm">Dance</a>'
menu2[3]='<a href="/sports_clubs.htm">Event Shows</a>'
menu2[4]='<a href="/sports_clubs.htm">Individual Action</a>'
menu2[5]='<a href="/sports_clubs.htm">Team Sports</a>'
menu2[6]='<a href="/sports_clubs.htm">$$ Programs $$</a>'
menu2[7]=' ' //alt-255 value for a blank line
menu2[8]='<a href="/sports_clubs.htm#Gallery">* GALLERY *</a>'
menu2[9]='<a href="/sports_clubs.htm#Packages">* PRICING *</a>'

//Contents for menu 3, Weddings / Events
var menu3=new Array()
menu3[0]='<a href="/events.htm">Anniversary</a>'
menu3[1]='<a href="/events.htm">Baptism / Bar Mitzvah</a>'
menu3[2]='<a href="/events.htm">Birthdays</a>'
menu3[3]='<a href="/events.htm">Engagement</a>'
menu3[4]='<a href="/events.htm">Family Reunion</a>'
menu3[5]='<a href="/events.htm">Funeral</a>'
menu3[6]='<a href="/events.htm">Graduation</a>'
menu3[6]='<a href="/events.htm">Grand Openings</a>'
menu3[7]='<a href="/events.htm">Weddings</a>'
menu3[8]=' ' //alt-255 value for a blank line
menu3[9]='<a href="/events.htm#Gallery">* GALLERY *</a>'
menu3[10]='<a href="/events.htm#Packages">* PRICING *</a>'

//Contents for menu 4, Glamour
var menu4=new Array()
menu4[0]='<a href="/glamour.htm">Boudoir</a>'
menu4[1]='<a href="/glamour.htm">Fashion / Cosmetology</a>'
menu4[2]='<a href="/glamour.htm">Glamour</a>'
menu4[3]='<a href="/glamour.htm">Models</a>'
menu4[4]='<a href="glamour.htm">Portfolios</a>'
menu4[5]=' ' //alt-255 value for a blank line
menu4[6]='<a href="/glamour.htm#Gallery">* GALLERY *</a>'
menu4[7]='<a href="/glamour.htm#Packages">* PRICING *</a>'

//Contents for menu 5, Commercial
var menu5=new Array()
menu5[0]='<a href="/commercial.htm">Advertising</a>'
menu5[1]='<a href="/commercial.htm">Church Directories</a>'
menu5[2]='<a href="/commercial.htm">Grand Openings</a>'
menu5[3]='<a href="/commercial.htm">Investigation</a>'
menu5[4]='<a href="/commercial.htm">Legal Documentation</a>'
menu5[5]='<a href="/commercial.htm">Press Conferences</a>'
menu5[6]='<a href="/commercial.htm">Product Stills</a>'
menu5[7]='<a href="/commercial.htm">Real Estate</a>'
menu5[8]='<a href="/commercial.htm">Staff Portraits</a>'
menu5[9]='<a href="/commercial.htm">Website Images</a>'
menu5[10]=' ' //alt-255 value for a blank line
menu5[11]='<a href="/commercial.htm#Gallery">* GALLERY *</a>'
menu5[12]='<a href="/commercial.htm#Packages">* PRICING *</a>'

var menuwidth='150px' //default menu width
var menubgcolor='#F5F8DE'  //menu bgcolor - #F5F8DE #663300 #EBDE96
var disappeardelay=200  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu