// any link menus

// AnyLink CSS Menu script Dynamic Drive DHTML code library (www.dynamicdrive.com) This notice MUST stay intact for legal use. Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code //

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=1 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

var ie5=document.all
var ns6=document.getElementById&&!document.all

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){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
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=ie5 && !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=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !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 dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
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 ((ie5||ns6) && !enableanchorlink) 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 (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

// begin rollover code

function mouseOut() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}

function mouseOver() { //v3.0
  var i,j=0,x,a=mouseOver.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// end rollover code

function rollover() {
  if (!document.getElementById) return
  var imgOrSrc;
  var imgPreload = new Array();
  var images = document.getElementsByTagName('img');
  for (var i = 0; i < images.length; i++) {
    if (images[i].getAttribute('rsrc')) {
      imgPreload[i] = new Image();
      imgPreload[i].src = images[i].getAttribute('rsrc');
      images[i].onmouseover = function() {
        imgOrSrc = this.getAttribute('src');
        this.setAttribute('src',this.getAttribute('rsrc'))
      }
      images[i].onmouseout = function() {
        this.setAttribute('src',imgOrSrc)
      }
    }
  }
}
function pasuser(form) {if (form.id.value=="staffonly") { if (form.pass.value=="c1pr1an1") { location="forstaffonly.html"} else {alert("Oops! That password is invalid. This area is for Cipriani staff only.") }} else {  alert("Oops! That username is invalid. This area is for Cipriani staff only.")}}

// open new window code

function ow(theURL,custom,w,h,resize,stat,tool,loc,menu,scroll,x,y)

//determine browser name and version.  Four options: netscape 4.x, netscape 6.0, IE 4.0 or greater, and other browsers	

	{
							
		if ((navigator.appName  == "Netscape")	&& (parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5))	{
			
			browser = "netscape";			
		}
		else if ((navigator.appName == "Netscape") && (parseFloat(navigator.appVersion) >= 5))	{
			browser ="netscape6";
		}
		else if ((navigator.appName  == "Microsoft Internet Explorer") 	&& (parseFloat(navigator.appVersion) >= 4))	{
			browser = "ie";			
		}
		else	{
			browser = "altBrowser";
		}
	
//make sure that either 2 or 12 arguments are passed, if not provide the default window

if (arguments.length == 2 || arguments.length == 12) {	
		
//since netscape and IE have different naming schema for the window positioning properties, it is necessary to check for browser type as performed above.  This will serve the correct parameter names as variables in the window.open function which actually opens the new window as can be seen below.

if (custom == 1){
	
	if (browser  == "netscape")	{
			window.open(theURL,"","width=" + w + ",height=" + h + 						",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",screenX=" + x + ",screenY=" + y)
		}
		
	if (browser == "netscape6")	{							
			window.open(theURL,"","width=" + w + ",height=" + h + 						",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",screenX=" + x + ",screenY=" + y)
	}
		
	else if (browser == "ie")	{
		
window.open(theURL,"","width=" + w + ",height=" + h + ",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll + ",left=" + x +",top=" + y)
		}		
		
	else {
		
window.open(theURL,"","width=" + w + ",height=" + h + ",resizable=" + resize + ",status=" + stat + ",toolbar=" + tool + ",location=" + loc + ",menubar=" + menu + ",scrollbars=" + scroll)
		}			
		
	}

else {

	if (browser  == "netscape" || "netscape6")	{
			window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes,screenX=25,screenY=50")
		}
		
	else if (browser == "ie")	{
		
window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes,left=25,top=50")
		}		
		
	else	{
		
window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes")
		}			
		
	} 
}
else{
	window.open(theURL,"","width=640,height=480,resizable=yes,status=yes,toolbar=yes,history=no,location=yes,menubar=no,scrollbars=yes")
}
}
