 /************************************************************************************
 	NOTE:  a chunk of the initialize code was moved to header.cfm so that 
	the application.basedir variable could be used instead of hard-coding
	path for the images.
	wsd 10.11.07
 *************************************************************************************/
 
 // simple image replacement

    function swapImg(imgDocID,imgObjName){ 
		if (document.images)
		{ 
    	    document.images[imgDocID].src = eval(imgObjName + ".src"); 
	   	}
    }
	
	function ClearField (thefield) {
		thefield.value = "";
	}

    // functions to show and hide quotes in sidebar
    function showQuote(id){
        if (quote = document.getElementById(id))
        {
            //quote.style.top = document.body.scrollTop + 200;
            quote.style.top = document.body.scrollTop + (document.body.clientHeight / 2) - 100;			
            //quote.style.left = document.body.clientWidth - 187;
            quote.style.visibility = "visible";
        }
    }

    function hideQuote(id)
    {
        if (quote = document.getElementById(id))
        {
            quote.style.visibility = "hidden";
        }
    }	
	
	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_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_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_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_openBrWindow(theURL,winName,features) { //v2.0
  		window.open(theURL,winName,features);
	}

	var trigger=0
	// There is no activated Layer
	var vis=0
	hidenvar=1
	
	function dopic(name,auto,event) {
		var browser=navigator.appName
		var b_version=navigator.appVersion
		var version=parseFloat(b_version)
		if (browser=="Microsoft Internet Explorer")
		{
			if(name.length > 56)
			{
				hidenvar=0;	
				picx=event.x + 50;
				picy=event.y + document.body.scrollTop;
				if (vis == 0) // No layer active, as double layers would bug :(
				{
					// Default coordinates/offsets
					var oldpicx=100;
					var oldpicy=100;
					//border-color
					var rahmen='silver'
					// Alt-text
					var alttext=""

					// When there is no layer...
					if (trigger!=1)
					{
						trigger=1 // There is a layer now!
						// Create hidden layer (Netscape)
						if(document.layers){
							//Piclayer
							document.layers['picarea'] = new Layer(1);
							document.layers['picarea'].left = oldpicx;
							document.layers['picarea'].top = oldpicy;
							document.layers['picarea'].height = 20;
							document.layers['picarea'].visibility = "hidden";
						}
						// Create hidden Layer in Internet Explorer
						else if (document.all){
							document.body.insertAdjacentHTML("BeforeEnd",'<DIV ID="picarea" STYLE="z-index:200;position:absolute;left:"+picx+";top:"+picy></DIV>');
						}
					}

					// If there is a layer, hide it!
					if (trigger != 0){
						if (document.layers){document.layers['picarea'].visibility="hide"} //Netscape
						if (document.all){picarea.style.visibility="hidden"}
					}
					// Define the layer's content
					content="<a href=\"javascript:clearpic()\" ><img src=\"";
					content=content+name+"\" name=\"pic\" alt=\""+alttext+"\" border=0";
					content=content+"></A>";
					// Write content into layer and show it (Netscape)
					if (document.layers) {
						sprite=document.layers['picarea'].document;
	  					sprite.open();
						sprite.write(content);
						sprite.close();
						// If there is no auto set, place the layer at picx and picy
						if (picx != null && auto == ''){ 
							document.layers['picarea'].left = picx;
							document.layers['picarea'].top = picy;
						}
						// If auto is set:
						if (auto != "")
						{ 
							// get the picture width/height
							xw=document.layers['picarea'].document.images['pic'].width 
							yw=document.layers['picarea'].document.images['pic'].height
							// center the picture at mouseposition
							newpicx = fx - (xw/2)
					  	 	newpicy = fy - (yw/2)
							// if there are offsets, set them
							if (picx) 
								newpicx=newpicx + picx
							if (picy) 
								newpicy=newpicy + picy
							// place layer
							document.layers['picarea'].left = newpicx;
							document.layers['picarea'].top = newpicy;
						}
						// show layer
						document.layers['picarea'].visibility="show";
						// set trigger vor visible layer
						vis=1
					 }  // end if document.layers

					// Write content into layer and show it (Internet Explorer)
					if (document.all) {
						document.all['picarea'].innerHTML = content;
						// If there is no auto set, place the layer at picx and picy
						if (picx != null && auto == ''){
							picarea.style.top=picy
							picarea.style.left=picx;
						}
						// If auto is set:
						if (auto != "")	{ 
							// get the picture width/height
							xw=document.all['pic'].width
							yw=document.all['pic'].height
							// center the picture at mouseposition
					     	 newpicx = fx - (xw/2)
					     	 newpicy = fy - (yw/2)
							// if there are offsets, set them
							if (picx) 
								newpicx=newpicx + picx
							if (picy) 
								newpicy=newpicy + picy
							// place layer
							picarea.style.top=newpicy;
							picarea.style.left=newpicx;
						}
						// show layer
						// name is not dummy 		
						if (name != "dummy") {
							picarea.style.visibility="visible";
							// set trigger vor visible layer
							vis=1
						}
					}  // end if document.all
					// Older javascript able browser, show the pic
					else if (document.layers == null && document.all == null) 
						self.location=name;
				}  // end if vis == 0 
			} // end if name.length > 56
		} // end if browser ID
	}  // end function
	
	// Hide layers on click
	function clearpic()	{
		// deactivate visible trigger 
		if (hidenvar!=1)
		{
			vis=0
			if (document.layers)
				document.layers['picarea'].visibility="hide";
			if (document.all)
				picarea.style.visibility="hidden";
		}
	}
	