// JavaScript Document


function YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}

/* =========================================================================================================== */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
	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=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { 
		obj=obj.style; 
		v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
	}
    obj.visibility=v; }
}


function MWW_displayRemoverLayers() { //v6.0
  var i,p,v,obj,args=MWW_displayRemoverLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { 
		obj=obj.style; 
		v=(v=='show')?'block':(v=='hide')?'none':v; 
	}
    obj.display=v; }
}


function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MWW_validateForm() { //v4.0
	if (document.getElementById){
		var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
			for (i=0; i<(args.length-2); i+=3) { 
				test=args[i+2]; 
				val=document.getElementById(args[i]);
				if (val) { nm=val.name; if ((val=val.value)!="") {
					if (test.indexOf('isEmail')!=-1) { 
						p=val.indexOf('@');
						if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
					} 
					else if (test!='R') { 
						num = parseFloat(val);
						if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
						if (test.indexOf('inRange') != -1) { 
						p=test.indexOf(':');
						min=test.substring(8,p); 
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					} 
				} 
			} 
				else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; 
			}
		} 
		if (errors) alert('The following error(s) occurred:\n'+errors);
		document.MM_returnValue = (errors == '');
	} 
}

/* customised version of the Macromedia OpenWindow Behaviour
This makes sure that the newly opened window is always 
at the front i.e focussed */


function MM_openBrWindow(theURL,winName,features) { //v2.0
  var wintwo = window.open(theURL,winName,features);
  wintwo.focus();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {
	  if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
	
MM_reloadPage(true);

/* 
function showPrintIcon() {
	if (window.print) {
		document.write("<a title=\"Print\" href=\"javascript:window.print();\" >" )
		document.write("<img src=../scripts//"images/print.gif/" alt=\"Print\" width=\"15\" height=\"15\" hspace=\"2\" vspace=\"1\" border=\"0\"><br>Print</a>")
	}
}


function showFavouriteIcon() {
	if (window.print) {
		document.write("<a title=\"Add to favorites\" ")
		document.write("href=\"javascript:window.external.AddFavorite(location.href,document.title);\" >")
		document.write("<img src=../scripts//"images/star.gif/" alt=\"Add to favorites\" width=\"15\" height=\"15\" hspace=\"2\" vspace=\"1\" border=\"0\"><br>Favorite</a>")
	}
}
*/


function showFirstLayer() {
	var i,m,layer,args=showOther.arguments;

/*  Go through all the layers in the arguments list and hide them
	then show the first one on the list.
*/
	
	MM_showHideLayers(args[0],'','show') ;
    for (i=1; i<(args.length-1); i=i+1) {
		MM_showHideLayers(args[i],'','hide') ;
	}
}



//document.MM_returnValue = true;


function compareSize() {
	// takes in 5 paremater, 
	//first value, 
	//second value, 
	//value to change depending if first value > second value, 
	//value to change to if true, 
	//value to change to if false 
	var args =compareSize.arguments ;
	
	if ( args.length == 5 ) {  
		if ( (firstField=MM_findObj(args[0]))!=null) {
			if ( (secondField=MM_findObj(args[1]))!=null) {
				if ( (resultField=MM_findObj(args[2]))!=null) {
		
					if (firstField.value > secondField.value) {
						resultField.value = args[3] ;
					}
					else {
						resultField.value = args[4] ;
					}
				}
			}
		}
	}	
}



function validatFields() { 
  var args = validatFields.arguments; 
  var myDot=true; 
  var myV=''; 
  var myErr='';
  var addErr=false;
  var myReq;

  for (var i=1; i<args.length;i=i+4){

    if (args[i+1].charAt(0)=='#'){
		
		myReq=true; 
		args[i+1]=args[i+1].substring(1);
		}
		else{
			myReq=false
		}

    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){
		  addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}


//========================================================== //
// Set the variable that show whish page is curreclt selected in the 
// left hand navigation menu.  If No page is selected at the monet,
// the variable should be set to [""]
//========================================================== //

var arr_LeftNavSelected = [""];

//========================================================== //
//========================================================== //

//Powered by Softery.com
//Ver: 3//
function FlashSolver() {
n=navigator;
nav=n.appVersion.toLowerCase();
if ((nav.indexOf('win')!=-1) || (nav.indexOf('nt')!=-1)) 
	{
	if (navigator.appName == "Microsoft Internet Explorer")
		{
		var tmpObject = document.getElementsByTagName('object');
		if (tmpObject && tmpObject.length) 
			{
			for (var i = 0; i < tmpObject.length; i++) 
				{
				if (tmpObject[i].getAttribute('classid').toLowerCase() == 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000') 
					{
					var ps = tmpObject[i].getElementsByTagName('param');
					if (ps && ps != null)
						{
						for (var j = 0; j < ps.length; j++) 
							{
							if (ps[j].getAttribute('name').toLowerCase() == 'flashvars') 
								{
								var variables = ps[j].getAttribute('value');
								break;
								}
							}
						}
					var obj = tmpObject[i].outerHTML + "\n";
					obj = obj.replace(/FLASHVARS" VALUE=""/i,'FLASHVARS" value="'+variables+'"');
					tmpObject[i].outerHTML = obj;
					}
				}
			tmpObject = null;
			}
		}
	}
}


window.onunload = function()
{
n=navigator;
nav=n.appVersion.toLowerCase();
if ((nav.indexOf('win')!=-1) || (nav.indexOf('nt')!=-1)) 
	{
	if (navigator.appName == "Microsoft Internet Explorer")
		{
		if (document.getElementsByTagName) 
			{
			var tmpObject = document.getElementsByTagName("object"); 
			for (i=0; i<tmpObject.length; i++)
				{
				tmpObject[i].outerHTML = ""; 
				}
			}
		}
	}
}


/* end of flashsolver */
/* ======================================================================= */

/*
function writeCookie(cookieName, cookieValue, expiry) {
	var expDate = new Date();
	if(expiry) {
		expDate.setMonth (expDate.getMonth() + expiry);
		document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString();
	}
	else {
		document.cookie = cookieName + "=" + escape (cookieValue);
	}
}
*/

function writeCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 	expire.setTime(today.getTime() + 3600000*24*nDays);
 	document.cookie = cookieName+"="+escape(cookieValue)  + ";expires="+expire.toGMTString();
}

function readCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}



function cookieThis(theInput) {
	alert("writing " + theInput.name + " = " + theInput.value + " to cookie")
//	window.status("writing " + theInput.name + " = " + theInput.value + " to cookie" ) ;
	writeCookie(theInput.name, theInput.value, 180) ;
}


function getImageSize(theImageArg,widthFieldArg,heightFieldArg,formNameArg) {
// Arguments are theImage Name, the Width Field Name and the height Field name 

var args	=	getImageSize.arguments
//if (args.length == 3 ) {
	var theImage 		= MM_findObj(theImageArg)
	var widthField 		= MM_findObj(widthFieldArg)
	var heightField 	= MM_findObj(heightFieldArg)
	
//	alert("widthField.value is '" + widthField + "'\nand image width is " +  theImage.width + "\nimage height is " + theImage.height)
	
	widthField.value = theImage.width ;

	heightField.value = theImage.height;

}


// This shows a preview of the picture to be included with the paragraph
// It also populates the width and height fields with the values taken 
// from the image.

/* replaced by the one below 


function changePreview(fileName,imageName,folder) { 
	if (fileName == "") { 
		imageObj.src = folder + "transpix.gif" ;
	}
	else {
		imageObj.src = folder + fileName ;
	}
}


*/

function changeStyleSheet() {
	var args	=	changeStyleSheet.arguments ;
	
	
	if (args.length == 2 ) { 
		if (( cssObj=MM_findObj(args[0])) != null ) {	
			cssObj.href = "/ourwedding/themes/" + args[1] + "/style.css"  ; 
			
//			alert(" changed style sheet to \n" + cssObj.href ) ;
		}
	}
}


function changePreview(fileName,imageObjName,folderName) { 
	if (( imageObj=MM_findObj(imageObjName)) != null ) {		
		if ( fileName == "") { 
			fileName = "transpix.gif" ;
		}
		imageObj.src = folderName + fileName ;
	}
}


function changePreviewBackground(fileName,imageObjName,folderName) { 

	if ((imageObj=MM_findObj(imageObjName))!=null) {
		
//		alert("changing picture " + imageObjName + " to\n " + folderName + fileName)		  
		  
		if (fileName == "") { 
			fileName = "transpix.gif" ;
		}
		
		if (imageObj.style) {
			imageObj = imageObj.style ;
		}
		
//		imageObj.background = "url(" + folderName + fileName + ") center center no-repeat" ;
		imageObj.backgroundImage = "url(" + folderName + fileName + ")" ;
	}
}



function checkFileChars(field){
	var agt = navigator.userAgent.toLowerCase();
	var is_mac = (agt.indexOf("mac") != -1);
  	var is_ie = document.all;
	var is_ns6 = (!document.all && document.getElementById ? true : false);
	var fileURL = field.value;

//	window.alert("found " + field.name + " in form " + field.form.length )
//	window.alert("found formObj " +field.form.name )
	
	if (is_ie && is_mac) {
		begPos = fileURL.indexOf('/',1);
		if (begPos != -1) {
			fileURL = fileURL.substring(begPos+1,fileURL.length);
		}
	}

// loop through all the elements on the form and make sure the Submit button is visible
	var formname = field.form.name
	var formObj = MM_findObj(formname)
	
	for (j=0 ; j< formObj.length ; j++) { 
		obj = formObj.elements[j]
	
		if ( obj.type == "submit" ) {
			if (obj.style) { 
				obj=obj.style;
			}
			obj.visibility="visible";
		}
	}

	fileURL = 'file:///' + fileURL.replace(/:\\/gi,'|/').replace(/\\/gi,'/').replace(/:([^|])/gi,'/$1').replace(/"/gi,'').replace(/^\//,'');
	
	var fileParts = fileURL.split("/")
	
	var actualfilename = fileParts[fileParts.length-1]

//	window.alert("checking\n" + fileURL + "\n and actual file of " + actualfilename );
	
	var illegalchars = ",.~#:;+=-)(*&^%$£!'@|\<>/?¬"
	
	for ( i=0 ; i < illegalchars.length ; i++ ) {
		badChar = illegalchars.charAt(i) 
		
		if ( actualfilename.indexOf(badChar,0) > -1 ) {
			window.alert("File name cannot contain any of these characters:\n" + illegalchars )

			
			for (j=0 ; j< formObj.length ; j++) { 
				obj = formObj.elements[j]
//				alert( formObj.elements[j].name + " is type = " + formObj.elements[j].type )
			
				if ( obj.type == "submit" ) {
					if (obj.style) { 
						obj=obj.style;
					}
					obj.visibility="hidden";
					
					document.MM_returnValue = false;
					break 
					return false
				}	

			}
		}
	}
	document.MM_returnValue = true;
	return true
}


/* =================================================================== */


/* =================================================== */


/* 
var clickmessage="Right click disabled over images!"

function disableclick(e) {
if (document.all) {
	if (event.button==2 || event.button==3) {
		if (event.srcElement.tagName=="IMG"){
			window.alert(clickmessage);
			return false;
		}
	}
}
else if (document.layers) {
		if (e.which == 3) {
			window.alert(clickmessage);
			return false;
		}
	}
	else if (document.getElementById){
		if (e.which==3&&e.target.tagName=="IMG"){
			window.alert(clickmessage)
			return false
		}
	}
}

function locateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
	document.onmousedown=disableclick
else if (document.getElementById)
		document.onmouseup=disableclick
	else if (document.layers)
	locateimages()
	
*/
	
/* ================================================================== */
/* make left navigation pop-up */


var arr_NavTiers = [];
var itv_HideAll = "none";

/*
function to determine which left nav parent item is currently being viewed - 
please use at the top of each .asp page. 

on parent pages: set var arr_LeftNavSelected=[""]:
*/
function leftnav_SetSelected() {
	for(var i = 0;i<arr_LeftNavSelected.length;i++) {
		try {
			document.getElementById(arr_LeftNavSelected[i]).className = "toplinkselected";			
		}//end try
		catch(e) {
			return false;
		}//end catch
	}//end for
}//end function leftnav_SetSelected


function init() {
  if (!document.getElementById) return false;
  arr_MainNav = document.getElementById("leftnav").getElementsByTagName("a");
  for(i=0;i<arr_MainNav.length;i++) {
    if(arr_MainNav[i].parentNode.getElementsByTagName("ul").length>0) {
	  arr_MainNav[i].obj_SubNav = arr_MainNav[i].parentNode.getElementsByTagName("ul")[0];
	  if(arr_MainNav[i].className.indexOf("selected")>-1) {
	    arr_MainNav[i].className = (arr_MainNav[i].className!="toplinkselected") ? "parentnavselected" : "toplinkselected";
	  } else {
	    arr_MainNav[i].className = (arr_MainNav[i].className!="toplink") ? "parentnav" : "toplink";
	  }
	} else {
	  arr_MainNav[i].obj_SubNav = "none";
	}
	int_Temp = 0;
	obj_Temp = arr_MainNav[i];
	while(obj_Temp.id!="leftnav") {
	  obj_Temp = obj_Temp.parentNode;
	  int_Temp++;
	}
	arr_MainNav[i].origClass = arr_MainNav[i].className;
	arr_MainNav[i].int_NavTier = ((int_Temp-1)/2)-1;
	arr_MainNav[i].style.zIndex = arr_MainNav[i].int_NavTier * 10;
	arr_MainNav[i].onmouseover = new Function("showSub(this)");
	arr_MainNav[i].onmouseout = new Function("hideSub(this)");
		
	}
	/*make call to: function leftnav_SetSelected()*/
	leftnav_SetSelected();

}

// makes sub menu visible
function showSub(obj_Temp) {
  if(itv_HideAll!="none") {
    clearInterval(itv_HideAll);
	itv_HideAll = "none";
  }
  for(i=obj_Temp.int_NavTier;i<arr_NavTiers.length;i++) {
    if(arr_NavTiers[i]!="none") {
	  arr_NavTiers[i].obj_SubNav.className = "";
	  arr_NavTiers[i].className = arr_NavTiers[i].origClass;
	}
  }
  arr_NavTiers[obj_Temp.int_NavTier] = obj_Temp;
  if(obj_Temp.obj_SubNav!="none") {
  if(obj_Temp.locY==null) {
    if(navigator.platform=="Win32") {
	  if(obj_Temp.className.indexOf("toplink")>-1) {
        obj_Temp.obj_SubNav.style.top = (obj_Temp.offsetTop) + "px";
	  } else {
        obj_Temp.obj_SubNav.style.top = (obj_Temp.offsetTop) + "px";
	  }
    } else {
	  if(obj_Temp.className.indexOf("toplink")>-1) {
        obj_Temp.obj_SubNav.style.top = (navigator.userAgent.indexOf("MSIE")!=-1) ? (obj_Temp.offsetTop - 7) + "px" : (obj_Temp.offsetTop) + "px";
	  } else {
        obj_Temp.obj_SubNav.style.top = (navigator.userAgent.indexOf("MSIE")!=-1) ? (obj_Temp.offsetTop - 7) + "px" : (obj_Temp.offsetTop) + "px";
	  }
    }
	obj_Temp.locY = obj_Temp.obj_SubNav.style.top;
  }
  if(obj_Temp.className.indexOf("selected")==-1) {
    obj_Temp.className = obj_Temp.origClass + "active";
  }
  obj_Temp.obj_SubNav.className = "shownav";
  }
  leftnav_SetSelected();
}


// starts timer to hide current sub nav
function hideSub(obj_Temp) {
  if(itv_HideAll!="none") {
    clearInterval(itv_HideAll);
	itv_HideAll = "none";
  }
  itv_HideAll = setInterval("hideAll()",300);
  
  /*make call to: function leftnav_SetSelected()*/
  leftnav_SetSelected();
}


// clears all nav items when the mouse is off of the nav area
function hideAll() {
  for(i=0;i<arr_NavTiers.length;i++) {
    if(arr_NavTiers[i]!="none") {
	  arr_NavTiers[i].obj_SubNav.className = "";
	  arr_NavTiers[i].className = arr_NavTiers[i].origClass;
	  arr_NavTiers[i] = "none";
	}
  }
  
  /*make call to: function leftnav_SetSelected()*/
  leftnav_SetSelected();
}


/* ================================================ */
/* ================================================ */
/* ====================== AJAX =====================*/

/* This is the function that gets the Features for a particular page (2nd param) to a named DIV (1st param)  on the page */

function ajaxGetFeatures(){  


	var xmlHttp, theScript, theField, theSearch , args , urlString , theDIVname, theFullDIVname, theDivObj;
	args = ajaxGetFeatures.arguments ; 

	theSearch = args[0] ; 
	theDIVname = args[1] ; 
	urlString = "../ScriptLibrary/get_features.asp?pageId=" + theSearch ;

	if ( args.length > 1 ) { 
		onAdmin = args[2] ; 
		urlString = urlString + "&admin=true"
	}
	
	try
	{    // Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest();    
	}
	catch (e){    // Internet Explorer    
		try {      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		}
		catch (e) {      
			try {        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
			catch (e) {        
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	xmlHttp.onreadystatechange=function(theValue) {
		if(xmlHttp.readyState==4) {	
			if ((theDivObj=MM_findObj(theDIVname))!=null) {
				if (xmlHttp.responseText != "") { 
					theDivObj.innerHTML = xmlHttp.responseText;

				}
			}
		}
	}
	
	
//	urlString = "get_features.asp?pageID=" + theSearch ;
	xmlHttp.open("GET",urlString,true);
    xmlHttp.send(null);
	
	return false ;
	
//	return true ;
}

/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */

//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/
//** Menu created: Nov 12, 2008

//** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth

//** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items.

//** May 1st, 09" (v1.3):
//** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v'
//** 2) In IE6, shadows are now always disabled

//** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired.
//** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below

//** Dec 17th, 10" (v1.5): Updated menu shadow to use CSS3 box shadows when the browser is FF3.5+, IE9+, Opera9.5+, or Safari3+/Chrome. Only .js file changed.

var ddsmoothmenu={

//Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs):
arrowimages: {down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', '../images/Next_grey.gif']},
transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds
shadow: {enable:true, offsetx:5, offsety:5}, //enable shadow?
showhidedelay: {showdelay: 100, hidedelay: 500}, //set delay in milliseconds before sub menus appear and disappear, respectively

///////Stop configuring beyond here///////////////////////////

detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc)
detectie6: document.all && !window.XMLHttpRequest,
css3support: window.msPerformance || (!document.all && document.querySelector), //detect browsers that support CSS3 box shadows (ie9+ or FF3.5+, Safari3+, Chrome etc)

getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs
	var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu
	$menucontainer.html("Loading Menu...")
	$.ajax({
		url: setting.contentsource[1], //path to external menu file
		async: true,
		error:function(ajaxrequest){
			$menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText)
		},
		success:function(content){
			$menucontainer.html(content)
			ddsmoothmenu.buildmenu($, setting)
		}
	})
},


buildmenu:function($, setting){
	var smoothmenu=ddsmoothmenu
	var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL
	$mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu"
	var $headers=$mainmenu.find("ul").parent()
	$headers.hover(
		function(e){
			$(this).children('a:eq(0)').addClass('selected')
		},
		function(e){
			$(this).children('a:eq(0)').removeClass('selected')
		}
	)
	$headers.each(function(i){ //loop through each LI header
		var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header
		var $subul=$(this).find('ul:eq(0)').css({display:'block'})
		$subul.data('timers', {})
		this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
		this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header?
		$subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0})
		$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: smoothmenu.arrowimages.down[2]} : {}).append( //add arrow images
			'<img src="'+ (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[1] : smoothmenu.arrowimages.right[1])
			+'" class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0])
			+ '" style="border:0;" />'
		)
		if (smoothmenu.shadow.enable && !smoothmenu.css3support){ //if shadows enabled and browser doesn't support CSS3 box shadows
			this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets
			if (this.istopheader)
				$parentshadow=$(document.body)
			else{
				var $parentLi=$curobj.parents("li:eq(0)")
				$parentshadow=$parentLi.get(0).$shadow
			}
			this.$shadow=$('<div class="ddshadow'+(this.istopheader? ' toplevelshadow' : '')+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'})  //insert shadow DIV and set it to parent node for the next shadow div
		}
		$curobj.hover(
			function(e){
				var $targetul=$subul //reference UL to reveal
				var header=$curobj.get(0) //reference header LI as DOM object
				clearTimeout($targetul.data('timers').hidetimer)
				$targetul.data('timers').showtimer=setTimeout(function(){
					header._offsets={left:$curobj.offset().left, top:$curobj.offset().top}
					var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w
					menuleft=(header._offsets.left+menuleft+header._dimensions.subulw>$(window).width())? (header.istopheader && setting.orientation!='v'? -header._dimensions.subulw+header._dimensions.w : -header._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent
					if ($targetul.queue().length<=1){ //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime)
						if (smoothmenu.shadow.enable && !smoothmenu.css3support){
							var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft
							var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y
							if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full
								header.$shadow.css({opacity:1})
							}
							header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime)
						}
					}
				}, ddsmoothmenu.showhidedelay.showdelay)
			},
			function(e){
				var $targetul=$subul
				var header=$curobj.get(0)
				clearTimeout($targetul.data('timers').showtimer)
				$targetul.data('timers').hidetimer=setTimeout(function(){
					$targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime)
					if (smoothmenu.shadow.enable && !smoothmenu.css3support){
						if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them
							header.$shadow.children('div:eq(0)').css({opacity:0})
						}
						header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime)
					}
				}, ddsmoothmenu.showhidedelay.hidedelay)
			}
		) //end hover
	}) //end $headers.each()
	if (smoothmenu.shadow.enable && smoothmenu.css3support){ //if shadows enabled and browser supports CSS3 shadows
		var $toplevelul=$('#'+setting.mainmenuid+' ul li ul')
		var css3shadow=parseInt(smoothmenu.shadow.offsetx)+"px "+parseInt(smoothmenu.shadow.offsety)+"px 5px #aaa" //construct CSS3 box-shadow value
		var shadowprop=["boxShadow", "MozBoxShadow", "WebkitBoxShadow", "MsBoxShadow"] //possible vendor specific CSS3 shadow properties
		for (var i=0; i<shadowprop.length; i++){
			$toplevelul.css(shadowprop[i], css3shadow)
		}
	}
	$mainmenu.find("ul").css({display:'none', visibility:'visible'})
},

init:function(setting){
	if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set?
		var mainmenuid='#'+setting.mainmenuid
		var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
		document.write('<style type="text/css">\n'
			+mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n'
			+mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n'
		+'</style>')
	}
	this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow
	jQuery(document).ready(function($){ //ajax menu?
		if (typeof setting.contentsource=="object"){ //if external ajax menu
			ddsmoothmenu.getajaxmenu($, setting)
		}
		else{ //else if markup menu
			ddsmoothmenu.buildmenu($, setting)
		}
	})
}

} //end ddsmoothmenu variable

/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */
/*==================================================================================== */

/*

function initMenu() {
ddsmoothmenu.init({
 mainmenuid: "middle_left", //menu DIV id
 orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
 classname: 'menu', //class added to menu's outer DIV
 //customtheme: ["#1c5a80", "#18374a"],
 contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})
}

*/

// window.onload = initMenu ;
