document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='includes/config.js'  TYPE='text/javascript'><\/SCR" + "IPT>");

/*   W I N D O W   E V E N T   H A N D L I N G   */

/*   R O L L O V E R   I M A G E S   */

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_findObj(n, d) { //v4.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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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_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;
}



/*   P O P U P   W I N D O W S   */

function MM_openBrWindow(theURL,winName,features) { //v2.1 by LV
  if(_DEBUGGING) alert("MM_openBrWindow: " + theURL);
  if(MM_openBrWindow.arguments[3]) { 
    caller=MM_openBrWindow.arguments[3]; 
    if(caller.href) { caller.href="#"; } //clear simple HTML link provided for compatibility
  } 
  close_MM_popupWindow();
  document.MM_popupWindow = window.open(theURL,winName,features);
}

function close_MM_popupWindow() {
    if(document.MM_popupWindow != null) { 
      if((document.all && document.MM_popupWindow) || (document.MM_popupWindow.document)){ 
        document.MM_popupWindow.close()
        document.MM_popupWindow = null
    }  }

}

/*   C O O K I E   H A N D L I N G   */

//
// sets a specific cookie
function setCookie(name,value) {
   document.cookie = name + "=" + escape(value) + ';path=' + _BASE_HREF;
}

//
// gets specified cookie's value
function getCookie(name) {
   var search = name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      } 
   }
}


/*   S P E C I A L   F U N C T I O N S   */

//
// Shows a specified popup window
function showPopup(popupId) {
	var params = new Array;
	if(_DEBUGGING) alert(popupId);
        if(!showPopup.arguments[1]) return false;
	params['zoom']    = new Array ( makeUrl('zoom', _BASE_HREF+'photos/'+showPopup.arguments[1]),
					'zoom', 
					'scrollbars=0,resizable=0,width=612,height=445');
	if(params[popupId] && params[popupId][0]) {
		if(_DEBUGGING > 1) {
		  alert(params[popupId][0]+', '+params[popupId][1]+', '+params[popupId][2]);
		  return false; 
	        }
		
		MM_openBrWindow(params[popupId][0],params[popupId][1],params[popupId][2]);
		
	} else {
	  if(_DEBUGGING) alert("showPopup: error in params" + params[popupId][0]);
	}
	
	return false;
}

//
// Returns new URL dervied from original 
// following a specified rule
function makeUrl(type) { // url: optional 2nd parameter
	var params = new Array;
	    params['zoom']  = '/cgi-bin/zoom/'+_LANGUAGE+'/';
	var url = (makeUrl.arguments[1]) ? makeUrl.arguments[1] : document.location.pathname;
	if(_DEBUGGING > 1) alert(params[type] + ' : ' + url);
	if(!params[type] || !url) return false;			// BAD FUNCTION CALL

	var newUrl = false;
	var insertPos = (url.indexOf(_BASE_HREF)>=0) ? url.indexOf(_BASE_HREF)+_BASE_HREF.length : 0;
	
	if(_DEBUGGING > 1) alert(insertPos);
	if(insertPos) {
		newUrl  = ''; //url.substring(0,insertPos);
		newUrl += params[type] + url.substring(insertPos, url.length);
		if(_DEBUGGING > 1) alert('makeUrl: ' + newUrl);
	}	
	return newUrl;
}





