﻿// JScript File
//************************************************************************
//Generic new window dialog popup
/*
url = the page you want to display
name = name of the window
tbar = if the toolbar is present, 0 = no:1 = yes
w = width you want for the window
h = height you want for the window
*/

function fPopUpWin(url, name, tbar, sbars, rsize, w, h, bModal) 
{
  l = (screen.availWidth-10 - w) / 2;
  t = (screen.availHeight-20 - h) / 2;

  //features = "width="+w+",height="+h+",left="+l+",top="+t;
  //features += ",screenX="+l+",screenY="+t;
  //features += ",scrollbars="+sbars+",resizable="+rsize+",location=0";
  //features += ",menubar=1,toolbar="+tbar+",status=1"; 

  //window.open(url, name, features);
  
	if (bModal == 1)
	{
		features = "dialogWidth:"+w+";dialogHeight:"+h+";dialogLeft:"+l+";dialogTop:"+t;
		features += ";scroll:"+sbars+";resizable:"+rsize+"";
		features += ";status:0"; 
		
		window.showModalDialog(url, name, features);	
	}
	else
	{
		features = "width="+w+",height="+h+",left="+l+",top="+t;
		features += ",screenX="+l+",screenY="+t;
		features += ",scrollbars="+sbars+",resizable="+rsize+",location=0";
		features += ",menubar=0,toolbar="+tbar+",status=0"; 
		
		window.open(url, name, features);	
	}  
}

function SelectAllCheckboxes(spanChk)
{
    // Added as ASPX uses SPAN for checkbox
    var oItem = spanChk.children;
    var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];

    xState=theBox.checked;
    elm=theBox.form.elements;

    for(i=0;i<elm.length;i++)
    
        if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
        {
        //elm[i].click();
        if(elm[i].checked!=xState)
        elm[i].click();
        //elm[i].checked=xState;
        }
}

function fGoToAnchor(AnchorName) 
{
	var myAnchor = '#'+ AnchorName	
	location.href = myAnchor;
}

function fGoToAnchorByDropDown(dropdown) 
{
	var myIndex = dropdown.selectedIndex
	var mySelValue = dropdown.options[myIndex].value
	var myAnchor = '#'+ AnchorName	
	location.href = myAnchor;		
}
function Popup(w,h,params) 
{
	var popup = window;
	popup=window.open( params,'viewer','toolbar=no,resizable=no,menubar=no,scrollbars=yes,width=' + w + ',height=' + h);
	popup.focus();
}