<!--//

function strlen(str)
{
	return str.length
}


function isInt(string) {
    if (string.length == 0)
        return false;
    for (var i=0;i < string.length;i++)
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
            return false;
    
    return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); 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 isEmpty(s)
{   return ((s == null) || (s.length == 0))
}


function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}


function y2k(number)
{
  return (number < 1000) ? number + 1900 : number;
}


function isValidDate (day,month,year)
{
  // checks if date passed is valid
 
    var today = new Date();
    year = ((!year) ? y2k(today.getFullYear()):year);
	month = ((!month) ? today.getMonth():month-1);
  

    if (!day) return false


    var test = new Date(year,month,day);
    if ( (y2k(test.getFullYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) )
        return true;
    else
        return false

}




function replaceCarriageReturn(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replaceCarriageReturn(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}


function trim(strText) { 

    strText = replaceCarriageReturn(replaceCarriageReturn(strText,'\r',''),'\n','');

	// this will get rid of leading spaces 
    while ((strText.substring(0,1) == ' ')||(strText.substring(0,2) == '\r')) 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while ((strText.substring(strText.length-1,strText.length) == ' ')||(strText.substring(strText.length-2,strText.length) == '\r'))
        strText = strText.substring(0, strText.length-1);

   return strText;
} 


function is_empty(form, field)
{
  form.field.value = trim(form.field.value);
  if ( (temp_str == null) || (temp_str == " ") || (temp_str == '\t') || (temp_str == "") )
	return true;
  else
	return false;
}


function mOvr(src,colorOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = colorOver; 
	} 
} 
function mOut(src,colorIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = colorIn; 
	} 
} 
function mClk(src){ 
	if(event.srcElement.tagName=='TD')
		src.children.tags('A')[0].click();
}

function confirmLogout()
{
  if (confirm("Are you sure you want to log out?"))
  {
	  document.location.href = "logout.dti"
  }
}

//-->