
 


var popbackground="#FFFFCC" //specify backcolor or background image for pop window

function detectexist(obj){
return (typeof obj !="undefined")
}

//function jkpopimage(windowtitle,imgpath, popwidth, popheight, textdescription){
function popDerf(windowtitle,imgpath, popwidth, popheight, textdescription){

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+inncaridth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
//var winattributes='width='+popwidth+',height='+popheight+',resizable=no,left='+leftpos+',top='+toppos
var winattributes='width='+popwidth+',height='+popheight+',resizable=no,left=60,top=60'
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
//jkpopwin.resizeTo(popwidth, popheight)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+'><img src="%27%2Bimgpath%2B%27" style="margin-bottom: 0.5em"><br /><span style="font-size:9pt; font-family:verdana">'+textdescription+'</span></body></html>')
//jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+'>'+textdescription+'</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}

function CheckFormsubscriber () {
	//Check field if not blank
	if (document.form1.subscriberEmail.value==""){
		//alert("Please enter email address");
		//document.form1.subscriberEmail.focus();
		return false;
	}
	window.open('', 'mailingList','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,left=60,top=60,width=360,height=227')
	return true
}

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function setText(thefield,theText){
if (thefield.value=="")
thefield.value = theText
} 

function menuOn(which){
	which.style.backgroundColor="#F1F1F1"
	which.style.border="#cccccc 1px solid"
	which.style.color="#000000"
	which.style.cursor= "hand"
}

function menuOff(which){
	which.style.backgroundColor="#D2E4FC"
	which.style.border="#D2E4FC 1px solid"
	which.style.color="#000000"
}

function menuOffActive(which){
	//which.style.border="#FFFFFF 1px none"
	which.style.backgroundColor="#E9967A"
	which.style.color="#000000"
}

function menuGo(where){
	window.location=where;
}

function link1(){
	if (document.linkmenu.weblink1.value!="car") {
	window.open(document.linkmenu.weblink1.value); }
}

function link2(){
	if (document.linkmenu.weblink2.value!="car") {
	window.open(document.linkmenu.weblink2.value); }
}

function link3(){
	if (document.linkmenu.weblink3.value!="car") {
	window.open(document.linkmenu.weblink3.value); }
}
function link4(){
	if (document.linkmenu.weblink4.value!="car") {
	window.open(document.linkmenu.weblink4.value); }
}

/* uncomment the lines below if you don't want to show text on the status bar*/
//function hidestatus(){
//window.status=''
//return true
//}

//if (document.layers)
//document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

//document.onmouseover=hidestatus
//document.onmouseout=hidestatus

/*the 3 functions below are used in getting the value of the xhtml editor!*/
function myonsubmitEventHandler() {
	document.getElementById('editor1').EscapeUNICODE = true;
	document.getElementById('xhtml1').value = document.getElementById('editor1').value;
}

function submitKnowIT() {
	document.getElementById('editor1').EscapeUNICODE = true;
	document.getElementById('knowit').value = document.getElementById('editor1').value;
}

function submitTrivia() {
	document.getElementById('editor1').EscapeUNICODE = true;
	document.getElementById('trivia').value = document.getElementById('editor1').value;
}

function checkCheckBox(f){
if (f.agree.checked == false )
{
alert('Please check the box to indicate that you agree with the posting Agreement.');
return false;
}else
return checkchars();
}

function checkchars(){
//change max length below to desired value
var maxlength=300
if (document.form1.Message.value.length>maxlength){
alert("Message is limited only to 300 characters or less.")
return false
}
}

/* this function needs further testing */
function update() {
var maxchars=Math.floor(299-document.form1.Message.value.length);
document.form1.charleft.value = (maxchars);
if (maxchars<1)
	return false;
}

function postIss() {
var maxchars=Math.floor(299-document.form1.Description.value.length);
document.form1.charleft.value = (maxchars);
if (maxchars<1)
	return false;
}

function checkDescription(){
//change max length below to desired value
var maxlength=300
if (document.form1.Description.value.length>maxlength){
alert("Description is limited only to 300 characters or less.")
return false
}
}

function postQuote() {
var maxchars=Math.floor(499-document.form1.Quote.value.length);
document.form1.charleft.value = (maxchars);
if (maxchars<1)
	return false;
}

function checkQuote(){
//change max length below to desired value
var maxlength=500
if (document.form1.Quote.value.length>maxlength){
alert("Quote is limited only to 500 characters or less.")
return false
}
}

function enableName()
{
document.form1.employeeName.disabled=false;
document.form1.office.disabled=true;
}

function enableOffice()
{
document.form1.employeeName.disabled=true;
document.form1.office.disabled=false;
}

function callenableopen() {
	if (document.form2.group.value=="Summary report")
		{ document.form2.show.disabled=false; }
	else 
		{ document.form2.show.disabled=true; }
}

function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}

var newwindow = '';

function popitup(url,name,height,width,scrol,top,left)
{
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow=window.open(url,name,'height='+ height +',width=' + width +',scrollbars='+ scrol + ',top='+ top + ',left='+ left +'');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}

function pastetoChat(msg)
{
	window.opener.document.form1.txtMessage.value=window.opener.document.form1.txtMessage.value+' '+msg;
	return false;
}

function updatecaller() {
document.user.elapsed.value =parseInt(document.user.startsec.value)+1;
document.user.startsec.value =parseInt(document.user.startsec.value)+1;
setTimeout("updatecaller()", 1000)
}

startday = new Date();
clockStart = startday.getTime();

function initStopwatch() { 
	var myTime = new Date(); 
   	return((myTime.getTime() - clockStart)/1000); 
}

function getSecs() { 
	var tSecs = Math.round(initStopwatch()); 
   	var iSecs = tSecs % 60;
   	var iMins = Math.round((tSecs-30)/60);   
	var sSecs ="" + ((iSecs > 9) ? iSecs : "0" + iSecs);
   	var sMins ="" + ((iMins > 9) ? iMins : "0" + iMins);
   	document.user.elapsed.value = sMins+":"+sSecs;
   	window.setTimeout('getSecs()',1000); 
}

function faqURL(url) {
	rExp = /<font color=#ff0000>/gi;
	sExp = /<\/font>/gi;
	newString = new String ("")
	results = url.replace(rExp, newString)
	results = results.replace(sExp, newString)
	window.open(results)
}

function printit(){  
if (window.print) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}

// find in page starts here
var TRange = null;
var dupeRange = null;
var TestRange = null;
var win = null;

//  SELECTED BROWSER SNIFFER COMPONENTS DOCUMENTED AT
//  http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var nom = navigator.appName.toLowerCase();
var agt = navigator.userAgent.toLowerCase();
var is_major   = parseInt(navigator.appVersion);
var is_minor   = parseFloat(navigator.appVersion);
var is_ie      = (agt.indexOf("msie") != -1);
var is_ie4up   = (is_ie && (is_major >= 4));
var is_not_moz = (agt.indexOf('netscape')!=-1)
var is_nav     = (nom.indexOf('netscape')!=-1);
var is_nav4    = (is_nav && (is_major == 4));
var is_mac     = (agt.indexOf("mac")!=-1);
var is_gecko   = (agt.indexOf('gecko') != -1);
var is_opera   = (agt.indexOf("opera") != -1);

//  GECKO REVISION
var is_rev=0
if (is_gecko) {
temp = agt.split("rv:")
is_rev = parseFloat(temp[1])
}

//  If you want to search another frame, change from "self" to
//  the name of the target frame:
//  e.g., var frametosearch = 'main'
var frametosearch = self;

function search(whichform, whichframe) {

//  TEST FOR IE5 FOR MAC (NO DOCUMENTATION)

if (is_ie4up && is_mac) return;

//  TEST FOR NAV 6 (NO DOCUMENTATION)

if (is_gecko && (is_rev <1)) return;

//  TEST FOR Opera (NO DOCUMENTATION)

if (is_opera) return;

//  INITIALIZATIONS FOR FIND-IN-PAGE SEARCHES

if(whichform.findthis.value!=null && whichform.findthis.value!='') {
       str = whichform.findthis.value;
       win = whichframe;
       var frameval=false;
       if(win!=self)
{
       frameval=true;  // this will enable Nav7 to search child frame
       win = parent.frames[whichframe];
}
    
}

else return;  //  i.e., no search string was entered

var strFound;

//  NAVIGATOR 4 SPECIFIC CODE

if(is_nav4 && (is_minor < 5)) {
  
  strFound=win.find(str); // case insensitive, forward search by default

//  There are 3 arguments available:
//  searchString: type string and it's the item to be searched
//  caseSensitive: boolean -- is search case sensitive?
//  backwards: boolean --should we also search backwards?
//  strFound=win.find(str, false, false) is the explicit
//  version of the above
//  The Mac version of Nav4 has wrapAround, but
//  cannot be specified in JS
 
        }

//  NAVIGATOR 7 and Mozilla rev 1+ SPECIFIC CODE (WILL NOT WORK WITH NAVIGATOR 6)

if (is_gecko && (is_rev >= 1)) {
   
    if(frameval!=false) win.focus(); // force search in specified child frame
    strFound=win.find(str, false, false, true, false, frameval, false);

//  The following statement enables reversion of focus 
//  back to the search box after each search event 
//  allowing the user to press the ENTER key instead
//  of clicking the search button to continue search.
//  Note: tends to be buggy in Mozilla as of 1.3.1
//  (see www.mozilla.org) so is excluded from users 
//  of that browser.

    if (is_not_moz)  whichform.findthis.focus();

//  There are 7 arguments available:
//  searchString: type string and it's the item to be searched
//  caseSensitive: boolean -- is search case sensitive?
//  backwards: boolean --should we also search backwards?
//  wrapAround: boolean -- should we wrap the search?
//  wholeWord: boolean: should we search only for whole words
//  searchInFrames: boolean -- should we search in frames?
//  showDialog: boolean -- should we show the Find Dialog?

}

 if (is_ie4up) {

  // EXPLORER-SPECIFIC CODE revised 5/21/03

  if (TRange!=null) {
	  
   TestRange=win.document.body.createTextRange();

   if (dupeRange.inRange(TestRange)) {

   TRange.collapse(false);
   strFound=TRange.findText(str);
    if (strFound) {
        //the following line added by Mike and Susan Keenan, 7 June 2003
        win.document.body.scrollTop = win.document.body.scrollTop + TRange.offsetTop;
        TRange.select();
        }
   }
   
   else {

     TRange=win.document.body.createTextRange();
     TRange.collapse(false);
     strFound=TRange.findText(str);
     if (strFound) {
        //the following line added by Mike and Susan Keenan, 7 June 2003
        win.document.body.scrollTop = TRange.offsetTop;
        TRange.select();
        }
   }
  }
  
   if (TRange==null || strFound==0) {
   TRange=win.document.body.createTextRange();
   dupeRange = TRange.duplicate();
   strFound=TRange.findText(str);
    if (strFound) {
        //the following line added by Mike and Susan Keenan, 7 June 2003
        win.document.body.scrollTop = TRange.offsetTop;
        TRange.select();
        }
   }
 }

  if (!strFound) alert ("Sorry, string '"+str+"' not found.") // string not found
        
}

function startupLoad(){
var maxlength=1000 

if (document.form1.description.value==""){
	alert("Please type the document description.");
	document.form1.description.focus();
	return false;
} 

if (document.form1.description.value.length>maxlength){
	alert("The document description is limited to 1,000 characters only.");
	document.form1.description.focus();
	return false;
}
	
if (document.form1.date.value==""){
	alert("Please type the date.");
	document.form1.file.focus();
	return false;
} 

if (document.form1.file.value==""){
	alert("Please select a file to upload.");
	document.form1.file.focus();
	return false;
}
	
if ((document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf(" ") > -1) || (document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf("'") > -1) || (document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf("&") > -1)) {
	alert("The filename cannot contain a space, an apostrophe (') or an ampersand (&) character.");
	return false; 
}

if (document.form1.file.value!=""){
	document.form1.action="post.asp";
	return true;
	} else {
	alert("Please select a file to upload.");
	document.form1.file.focus();
	return false; }
}

function startupdateLoad(){
var maxlength=1000 

if (document.form1.description.value==""){
	alert("Please type the document description.");
	document.form1.description.focus();
	return false;
} 

if (document.form1.description.value.length>maxlength){
	alert("The document description is limited to 1,000 characters only.");
	document.form1.description.focus();
	return false;
}
	
if (document.form1.date.value==""){
	alert("Please type the date.");
	document.form1.file.focus();
	return false;
} 
	
if ((document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf(" ") > -1) || (document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf("'") > -1) || (document.form1.file.value.substring(document.form1.file.value.lastIndexOf("\\")+1,document.form1.file.value.length).indexOf("&") > -1)) {
	alert("The filename cannot contain a space, an apostrophe (') or an ampersand (&) character.");
	return false; 
	} else {
	document.form1.action="edit.asp";
	return true; }
}
