﻿//window.onload =
//window.onload=hitSearch_hideDiv;

var topOffset = 0;
var pos=hitSearch_Align;


//window.onload(JSFX_FloatTopDiv);
var ie = (navigator.userAgent.indexOf("MSIE") != -1);
var ie6 = (navigator.userAgent.indexOf("6") != -1);
if (ie && ie6)
{
window.setTimeout(hitSearch_showDiv, 1);
}
else
{
window.setTimeout(hitSearch_hideDiv, 1);
}

 var barPos;
var resPos;
if(pos == "topRight" || pos == "bottomRight")
{
	barPos = "right";
}
else if(pos == "topLeft" || pos == "bottomLeft")
{
	barPos = "left";
}
var agt=navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var nss  = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
var bSaf = (agt.indexOf("safari")!=-1);
var bSaf12 = (bSaf && (navigator.productSub > 20030107));

if (ie && win) {	pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer"); }
if (nss || !win || bSaf || bSaf12) {
		nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
		pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer");
}

function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

pluginlist += navigator.javaEnabled() ? "Java," : "";
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);

function hitSearch_showDiv()
{
	document.getElementById('links').style.height = 350+"px";
	if ((ns) && (!saf))
	{
	if (scrollMaxX == 0)
	{
	 topOffset = 324;
	}
	else
	{
         topOffset = 344;
        }
       }
       else
       {
          topOffset = 324;
       }
        JSFX_FloatTopDiv();

}
function hitSearch_hideDiv()
{
        
	document.getElementById('links').style.height = 26+"px";
	if ((ns) && (!saf))
	{
	if (scrollMaxX == 0)
	{
	 topOffset = 0;
	}
	else
	{
         topOffset = 20;
        } 
 }
 else
 {
  topOffset = 0;
 }
        JSFX_FloatTopDiv();

}
if(pos == "topRight" || pos == "topLeft")
{
	resPos = 27;
}
else if(pos == "bottomRight" || pos == "bottomLeft")
{
	resPos = (topOffset + (-350)+(-16));
}

if (pluginlist.indexOf("Flash")!= -1)
{
var myString = '<div id="links">'+
'<script language="javascript">AC_FL_RunContent = 0;</script>'+
'<script src="'+hitSearch_Path+'AC_RunActiveContent.js" language="javascript"></script>'+
'<script src="'+hitSearch_Path+'acjs.js" language="javascript"></script>'+
'<noscript>\r'+
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="100%" id="interface" align="middle">\r'+
		'<param name="allowScriptAccess" value="sameDomain">\r'+
		'<param name="allowFullScreen" value="false">\r'+
		'<param name="movie" value="'+hitSearch_Path+'interface.swf"><param name="quality" value="high"><param name="bgcolor" value="#999999">	<embed src="'+hitSearch_Path+'interface.swf" quality="high" bgcolor="#999999" width="400" height="100%" name="interface" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\r'+
		'</object>\r'+
	'</noscript>\r';
}
else
{
        var myString = '<div id="links">'+
        '<div id="myDiv" style="position:absolute; top:'+resPos+'px; left:0px; visibility:hidden; background-color:#666666;">'+
	'<iframe name="resulter" frameborder="0" style="width:400px; height: 350px; background-color:#666666; white-space: pre-wrap; word-wrap: break-word; color:#666666;" allowtransparency="true"></iframe>'+
	'<br />'+
	'<a href="javascript: closed()" style="color:#FFFFFF; text-decoration: none;">Close</a>'+
'</div>'+
'<table style="width:400px;">'+
'<tbody>'+
	'<tr>'+
		'<td>'+
		'<div style="background-image:url(\''+hitSearch_Path+'images/bar.jpg\'); height:25px; width:306px; background-repeat:no-repeat; float:'+barPos+';">'+
			'<form method="post" action="'+hitSearch_Path+'search.php" onsubmit="return submitIt(this)" target="resulter" name="myForm">'+
				'<div style="float:right; padding-top:2px; padding-right:2px">'+
						'<input type="image" src="'+hitSearch_Path+'images/submit.png" value="Submit" name="Submit"/>'+
					'</div>'+
				'<div style="padding-left:78px; padding-top:1px">'+
					'<input name="needle" type="text" style="width: 160px" />'+
					'<input type="hidden" name="action" value="getFiles"/>'+
					'<input type="hidden" name="folder" value="."/>'+
					'<input type="hidden" name="javaSearch" value="1"/>'+
				'</div>'+
			'</form>'+
			'</div>'+
		'</td>'+
	'</tr>'+
	'</tbody>'+
'</table>';
}

function submitIt(f)
{
	if(document.myForm.needle.value != '')
	{
 		//alert('Not Blank');
 		document.getElementById('myDiv').style.visibility = 'visible';
		f.submit();
 		return true;
 	}
 	else
 	{
 		return false;
 	}
}
function closed()
{
	document.getElementById('myDiv').style.visibility = 'hidden';
}





//if (!document.layers)
//{


 document.write('<div id="divStayTopLeft" style="position:absolute">');
 document.write(myString);

 //document.getElementById('divStayTopLeft').innerHTML = myString;

//}
//else
//{
 // document.write('<layer id="divStayTopLeft">');
 // document.write(myString);
  //document.getElementById('divStayTopLeft').innerHTML = myString;

//}

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"

//var horizontalpos="right";

/*if (!document.layers)
{
 document.write('</div>')
}
else
{
 document.write('</div>')
}  */
var newX=0;
var newY=0;
var startX=0;
var startY=0;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var saf = (navigator.userAgent.indexOf("Safari") != -1);
function JSFX_FloatTopDiv()
{
	if(pos=="bottomRight" || pos == "topRight")
	{
		if ( window.innerWidth)
		{
			newX = window.innerWidth-20;//Firefox
		}

		if (document.body.clientWidth)
		{
			newX = document.body.clientWidth-20;//IE
		}
	}
	if(pos=="topLeft" || pos == "bottomLeft")
	{
		if ( window.innerWidth)
		{
			newX = 0;//Firefox
		}

		if (document.body.clientWidth)
		{
			newX = 0;//IE
		}

	}
	if(pos=="topRight" || pos =="topLeft")
	{
		startX = newX,
		startY = 0;
	}
	if(pos=="bottomLeft" || pos=="bottomRight")
	{
		startX = newX,
		startY = 26+topOffset;
	}
	
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		if (document.body.clientHeight)
		{
		 el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		}
		if (window.innerHeight)
		{
                  el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
                }
                if (pos=="topLeft" || pos=="bottomLeft")
		{
		    el.x = startX;
		}
                else
                {
		    el.x = ns ? pageXOffset + innerWidth : document.body.scrollLeft + document.body.clientWidth;
		    if ((ns) && (!saf))
		    {
		        if (scrollMaxY == 0)
		        {
                            el.x -= 400;
                        }
		        else
		        {
                            el.x -= 420;
                        }
                    }
                    else
                    {
                        if (saf)
			{
                            el.x -= 420;
                        }
                        else
                        {
                            el.x -= 400;
                        }
                    }
                }
		if (pos=="topLeft" || pos=="topRight")
		{
		    el.y = startY;
		}
                else
                {
		    el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
                    el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{       
          /*if ((pos=="topLeft") || (pos=="bottomLeft"))
                {
                  var pX = ns ? pageXOffset : document.body.scrollLeft;
                   ftlObj.x += (pX + startX - ftlObj.x)/8;
                }
                else
                {
                    var pX = ns ? pageXOffset + innerWidth : document.body.scrollLeft + document.body.clientWidth;
		    ftlObj.x += (pX - startX - ftlObj.x)/8;
                }   */
                if (pos=="topLeft" || pos=="topRight"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
	
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
}
//JSFX_FloatTopDiv();
window.onresize = JSFX_FloatTopDiv;
window.onload = JSFX_FloatTopDiv;