<!--
 /*
 (C) Copyright 2000 - 2003 Nabh Information Systems, Inc.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
var MMM_d_yyyy_format = 0;
var d_MMM_yyyy_format = 1;
var yyyy_MMM_d_format = 2;

var newWindow;  
function openWindow(url,name,w,h) {
  newWindow= window.open(url, name, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
  newWindow.focus();
}

function openSingleWindow(url,name,w,h) {
  if (newWindow != null) newWindow.close();
  newWindow = window.open(url, name, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
  self.focus();
  //setTimeout('self.close()', 10000);
}

function openOnParentWindow(url) {
	if (window.opener && !window.opener.closed) {
		window.opener.location.href= url;
		window.opener.focus();
		//self.close();
		//return false;
	} else {
		window.location.href=url;
		return false;
	
	}
}

function setFocusOnLoginField() {
    if (document.loginForm != null) {
    	document.loginForm.j_username.focus();
    } else if (document.registerForm != null) {
    	if (document.registerForm.username != null)
    	    document.registerForm.username.focus();
	else if (document.registerForm.oemail != null)
	    document.registerForm.oemail.focus();
    }
}

function showToolTips(obj) {
    if (document.layers && document.layers[obj] != null) {
        //netscape 4.x || Mozilla < 1.5
        document.layers[obj].visibility = 'visible';
    }else if (document.all) {
        //IE4+
        document.all[obj].style.visibility = 'visible';
    }else {
        //Netscape 6+ || Mozilla 1.5+
        document.getElementById(obj).style.visibility ='visible';
    
    }
}

function hideToolTips(obj) {
    if(document.layers && document.layers[obj] != null) {
        //netscape 4.x || Mozilla < 1.5
        document.layers[obj].visibility = 'hide';
    } else if (document.all) {
        //IE4+
        document.all[obj].style.visibility = 'hidden';
    } else {
        //Netscape 6+ || Mozilla 1.5+
        document.getElementById(obj).style.visibility ='hidden';
    }
}

function verifyCheckboxes(fields) {
    //check if the fields is an array (more than 1 check box)
    if (fields.length == undefined) {
        if (fields.checked == true) 
            return true;
        return false;
    } else {
        for (i=0; i < fields.length; i++) 
            if (fields[i].checked == true)
                return true;
        return false;
    }
}

// Calculate four digit year.
function fourdigits(number) {
  return (number < 1000) ? number + 1900 : number;
}

function getDateFormat(theformat) {
    switch (theformat) {
        case "yyyy_MMM_d":
            return yyyy_MMM_d_format;
        case "d_MMM_yyyy":
            return d_MMM_yyyy_format;
        default:        
            return MMM_d_yyyy_format;
    
    }

}

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];}
}
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];}}
}

//-->
