/*****************************************
*                                        *
* windows.js                             *
*                                        *
*****************************************/

function OpenWindow(sAddress, boolClone, iWidth, iHeight, boolStretch) 
{
   if (boolStretch && screen.Width > 640)
      {
      iWidth += 100;
      iHeight += 100;
      }

   var iLeft = (screen.width - iWidth) / 2;
   var iTop = (screen.height - iHeight) / 2;

   if (boolClone)
      openWin = window.open(sAddress, "", "buttons=no,scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes");
   else
      openWin = window.open(sAddress, "", "top="+iTop+",left="+iLeft+",width="+iWidth+",height="+iHeight+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
   openWin.focus();
}


/*****************************************
*                                        *
* frames.js                              *
*                                        *
*****************************************/

function loadFrames(page1, page2) 
{
   framecode = "<frameset rows='32,100%' border=0>" + "<frame src='" + page1 + "'>" + "<frame src='" + page2 + "'>" + "</frameset>";

   page = window.open("");
   page.document.open();
   page.document.write(framecode);
   page.document.close();
}


/*****************************************
*                                        *
* rollover.js                            *
*                                        *
*****************************************/

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_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 = MM_findObj(n, d.layers[i].document); 
   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];
      }
}


/*****************************************
*                                        *
* rollup.js                              *
*                                        *
*****************************************/

function WinRollup_NEW(elementName) 
{
   var HeadElement = null;
   var BodyElement = null; 
   var i = 0;

   if (document.getElementsByName) 
      {
      HeadElement = document.getElementById(elementName+"_Head");
      UpImage = document.getElementById(elementName+"_Up");
      DownImage = document.getElementById(elementName+"_Down");
      BodyElement = document.getElementsByName(elementName+"_Body");
      if (BodyElement[i].style.display == "none") 
         {
         HeadElement.className = "WinRollupHeader";
         UpImage.style.display = "block";
         DownImage.style.display = "none";
	     while (BodyElement[i])
    	    { 
            BodyElement[i++].style.display = "block";
            } 
		 }
      else 
         {
         HeadElement.className = "WinRollupHeaderClosed";
         UpImage.style.display = "none";
         DownImage.style.display = "block";
		 while (BodyElement[i])
		 	{
            BodyElement[i++].style.display = "none";
            }
         }  
      }

   if (window.event) 
		window.event.cancelBubble = true;
   return false;
}


function WinRollup(elementName) 
{
   var HeadElement = null;
   var BodyElement = null; 
   var i = 0;

   if (document.getElementsByName) 
      {
      HeadElement = document.getElementsByName(elementName+"_Head");
      BodyElement = document.getElementsByName(elementName+"_Body");
      UpImage = document.getElementsByName(elementName+"_Up");
      DownImage = document.getElementsByName(elementName+"_Down");
      while (BodyElement[i])
         { 
         if (BodyElement[i].style.display == "none") 
            {
            HeadElement[0].className = "WinRollupHeader";
            UpImage[0].style.display = "block";
            DownImage[0].style.display = "none";
            BodyElement[i].style.display = "block";
            } 
         else 
            {
            HeadElement[0].className = "WinRollupHeaderClosed";
            UpImage[0].style.display = "none";
            DownImage[0].style.display = "block";
            BodyElement[i].style.display = "none";
            }
         i = i + 1;
         }  
      }

   if (window.event) 
		window.event.cancelBubble = true;
   return false;
}


/*****************************************
*                                        *
* swap                                   *
*                                        *
*****************************************/

function SwapPositionImage() 
{
	switch (document.frmAdvSearch.CB_OrgPosition.value)
		{
		case "0":
			document.frmAdvSearch.Img_Position.src = "../images/i_none.gif";
			break;
		case "1":
			document.frmAdvSearch.Img_Position.src = "../images/i_monitor.gif";
			break;
		case "2":
			document.frmAdvSearch.Img_Position.src = "../images/i_support.gif";
			break;
		case "3":
			document.frmAdvSearch.Img_Position.src = "../images/i_oppose.gif";
			break;
		case "H":
			document.frmAdvSearch.Img_Position.src = "../images/i_hot.gif";
			break;
		default:
			document.frmAdvSearch.Img_Position.src = "../images/clear.gif";
			break;
		}

	return true;
}

