var digits = "0123456789";
var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz";
var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var whitespace = " \t\n\r";
var decimalPointDelimiter = ".";
var invalidChar = "'";
var radioFlag = 'false';
var defaultEmptyOK = true;
var lang = 'EN';

function makeArray(n) {
   for (var i = 1; i <= n; i++) {
      this[i] = 0;
   }
   return this;
}
var daysInMonth = makeArray(12);
daysInMonth[1] = 31;
daysInMonth[2] = 29;   // must programmatically check this
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

function isEmpty(s) {
  return ((s == null) || (s.length == 0));
}
function isWhitespace (s) {
  var i;
  if (isEmpty(s)) return true;
  for (i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if (whitespace.indexOf(c) == -1) return false;
  }
  return true;
}
function stripWhitespace (s){
  return stripCharsInBag (s, whitespace);
}
function charInString (c, s){
  for (i = 0; i < s.length; i++) {
   if (s.charAt(i) == c) return true;
  }
  return false;
}
function stripInitialWhitespace (s){
  var i = 0;
  while ((i < s.length) && charInString (s.charAt(i), whitespace))
    i++;
  return s.substring (i, s.length);
}
function isLetter (c){
  return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) );
}
function isDigit (c){
  return ((c >= "0") && (c <= "9"));
}
function isLetterOrDigit (c) {
  return (isLetter(c) || isDigit(c));
}
function isInteger (s){
  var i;
  if (isEmpty(s)) {
    if (isInteger.arguments.length == 1) return defaultEmptyOK;
    else return (isInteger.arguments[1] == true);
  }
  for (i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if (!isDigit(c)) {
      return false;
    }
  }
  return true;
}
function isblank(s) {
    // removed reference for c!=0 to allow locclim geo-references with lat=0 and lon=0
    for (var i=0; i< s.length; i++) {
      var c = s.charAt(i);
      if ((c!=null) && (c !='') && (c !='\n') && (c !='\t') && c!='\e') return false;
    }
    return true;
}
function isSignedInteger (s) {
  if (isEmpty(s)) {
    if (isSignedInteger.arguments.length == 1) return defaultEmptyOK;
    else return (isSignedInteger.arguments[1] == true);
  } else {
    var startPos = 0;
    var secondArg = defaultEmptyOK;
    if (isSignedInteger.arguments.length > 1)
       secondArg = isSignedInteger.arguments[1];
        // skip leading + or -
       if ( (s.charAt(0) == "-") || (s.charAt(0) == "+")){
         startPos = 1;
       }
       return (isInteger(s.substring(startPos, s.length), secondArg));
    }
}
function isPositiveInteger (s){
  var secondArg = defaultEmptyOK;
  if (isPositiveInteger.arguments.length > 1) {
     secondArg = isPositiveInteger.arguments[1];
  }
  return ( (isEmpty(s) && secondArg)  || (parseInt (s) > 0));
}
function isNonnegativeInteger (s){
  var secondArg = defaultEmptyOK;
  if (isNonnegativeInteger.arguments.length > 1) {
    secondArg = isNonnegativeInteger.arguments[1];
  }
  return (isSignedInteger(s, secondArg) && ( (isEmpty(s) && secondArg) || (parseInt (s) >= 0)));
}
function isNegativeInteger (s){
   var secondArg = defaultEmptyOK;
   if (isNegativeInteger.arguments.length > 1){
     secondArg = isNegativeInteger.arguments[1];
   }
   return (isSignedInteger(s, secondArg) && ( (isEmpty(s) && secondArg)  || (parseInt (s) < 0)));
}
function isNonpositiveInteger (s){
  var secondArg = defaultEmptyOK;
  if (isNonpositiveInteger.arguments.length > 1){
     secondArg = isNonpositiveInteger.arguments[1];
  }
  return (isSignedInteger(s, secondArg) && ( (isEmpty(s) && secondArg)  || (parseInt (s) <= 0)));
}
function isFloat(s) {
  var seenDecimalPoint = false;
  if (isEmpty(s)) {
       if (isFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isFloat.arguments[1] == true);
   }
   if (s == decimalPointDelimiter) return false;
   for (var i = 0; i < s.length; i++) {
     var c = s.charAt(i);
     if ((c == decimalPointDelimiter) && !seenDecimalPoint) {
       seenDecimalPoint = true;
     }
     else if (!isInteger(c)) {
       return false;
     }
   }
   return true;
}
function isSignedFloat (s) {
  if (isEmpty(s)) {
    if (isSignedFloat.arguments.length == 1) return defaultEmptyOK;
    else return (isSignedFloat.arguments[1] == true);
  }
  else {
    var startPos = 0;
    var secondArg = defaultEmptyOK;
    if (isSignedFloat.arguments.length > 1)
       secondArg = isSignedFloat.arguments[1];
    // skip leading + or -
     if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
       startPos = 1;
       return (isFloat(s.substring(startPos, s.length), secondArg));
    }
}
function isAlphabetic (s){
  var i;
  if (isEmpty(s)) {
    if (isAlphabetic.arguments.length == 1) return defaultEmptyOK;
    else return (isAlphabetic.arguments[1] == true);
  }
  for (i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if (!isLetter(c))
      return false;
  }
  return true;
}
function isAlphanumeric (s) {
  var i;
  if (isEmpty(s)) {
     if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;
     else return (isAlphanumeric.arguments[1] == true);
  }
  for (i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if (! (isLetter(c) || isDigit(c) ) )
     return false;
  }
  return true;
}
function isIntegerInRange (s, a, b) {
  if (isEmpty(s)) {
     if (isIntegerInRange.arguments.length == 3) return defaultEmptyOK;
     else return (isIntegerInRange.arguments[3] == true);
  }
  if (!isInteger(s, false)) return false;
  var num = parseInt (s);
  return ((num >= a) && (num <= b));
}
function warnEmpty (theField, s) {
  theField.focus();
  alert(mPrefix + s + mSuffix);
  return false;
}
function warnInvalid (theField, s){
  theField.focus();
  theField.select();
  alert(s);
  return false;
}
function checkString (theField, s, emptyOK) {
  // Next line is needed on NN3 to avoid "undefined is not a number" error
  // in equality comparison below.
  if (checkString.arguments.length == 2) emptyOK = defaultEmptyOK;
  if ((emptyOK == true) && (isEmpty(theField.value))) return true;
  if (isWhitespace(theField.value)) {
      return warnEmpty (theField, s);
  }
  else return true;
}
function isYear (s){
  if (isEmpty(s)) {
     if (isYear.arguments.length == 1) return defaultEmptyOK;
     else return (isYear.arguments[1] == true);
  }
  if (!isNonnegativeInteger(s)) return false;
  return (s.length == 4);
}
function isMonth (s){
  if (isEmpty(s)) {
     if (isMonth.arguments.length == 1) return defaultEmptyOK;
     else return (isMonth.arguments[1] == true);
  }
  return isIntegerInRange (s, 1, 12);
}
function isDay (s){
  if (isEmpty(s)) {
     if (isDay.arguments.length == 1) return defaultEmptyOK;
     else return (isDay.arguments[1] == true);
  }
  return isIntegerInRange (s, 1, 31);
}
function daysInFebruary (year) {
  return ( ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}
function isDate (year, month, day) {
  if (! (isYear(year, false) && isMonth(month, false) && isDay(day, false))) return false;
  var intYear = parseInt(year);
  var intMonth = parseInt(month);
  var intDay = parseInt(day);
  if (intDay > daysInMonth[intMonth]) return false;
  if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;
  return true;
}
function isShortDate (year, month) {
  if (! (isYear(year, false) && isMonth(month, false))) return false;
  else return true;
}
function checkYear (theField, emptyOK){
  if (checkYear.arguments.length == 1) emptyOK = defaultEmptyOK;
  if ((emptyOK == true) && (isEmpty(theField.value))) return true;
  if (!isYear(theField.value, false)) {
       return warnInvalid (theField, iYear);
  } else {
    return true;
  }
}
function checkMonth (theField, emptyOK){
  if (checkMonth.arguments.length == 1) emptyOK = defaultEmptyOK;
  if ((emptyOK == true) && (isEmpty(theField.value))) return true;
  if (!isMonth(theField.value, false)) {
       return warnInvalid (theField, iMonth);
  } else {
    return true;
  }
}
function checkDay (theField, emptyOK){
  if (checkDay.arguments.length == 1) emptyOK = defaultEmptyOK;
  if ((emptyOK == true) && (isEmpty(theField.value))) return true;
  if (!isDay(theField.value, true)) {
     return warnInvalid (theField, iDay);
  } else {
    return true;
  }
}
function alertOnError(form_obj, input_obj, obj_value, error_msg) {
  alert(error_msg);
  return false;
}
function checkFormFields(obj, obj_type){
  if (obj_type=="checkbox") {
    for (i=0; i< obj.length; i++) {
      if (obj[i].checked) {
        return true;
        break;
      }
    }
    return false;
  }
  if (obj_type == "radio") {
    for (i=0; i< obj.length; i++) {
      if (obj[i].checked) {
        return true;
        break;
      }
    }
    return false;
  }
  else if (obj_type == "hidden") {
    if (!isblank(obj.value))  return true;
    else {
     return false;
    }
  }
  else if (obj_type == "text" || obj_type=="textarea" || obj_type=="file" ) {
    if (!isblank(obj.value))  return true;
    else {
     return false;
    }
  }
  else if (obj_type == "select" || obj_type =="select-one" || obj_type =="select-multiple") {
    if (!isblank(obj.value)) {
      for (i=0 ; i< obj.length; i++) {
        if (obj.options[i].selected) {
           return true;
           break;
        }
      }
      return false;
    }
    else {
      return false;
    }
  }
}
function checkIntegerValue(val, emptyOK) {
  if (checkIntegerValue.arguments.length == 1) emptyOK = defaultEmptyOK;
  if (!isblank(val.value)){
    if ((emptyOK == true) && isInteger(val.value)) return true;
    else {
       alert ( invalidNum + ' ' + val.value + '. ' + mIntegerValue);
       val.value=""; val.focus();
       return false;
    }
  }
}
function checkFloatValue(val, emptyOK) {
  if (checkFloatValue.arguments.length == 1) emptyOK = defaultEmptyOK;
  if (!isblank(val.value)){
    if ((emptyOK == true) && !isAlphabetic(val.value) && isFloat(val.value)) return true;
    else {
       alert ( invalidNum + ' ' + val.value + '. ' + mFloatValue);
       val.value="";
       val.focus();
       return false;
    }
  }
}
function checkNegativeFloatValue(val, emptyOK){
  if (checkNegativeFloatValue.arguments.length == 1) emptyOK = defaultEmptyOK;
  if (!isblank(val.value)) {
    if ((emptyOK == true) && !isAlphabetic(val.value) && (isSignedFloat(val.value) || isFloat(val.value))) return true;
    else {
      alert(invalidNum + ' ' +  val.value + '. ' + mNegFloatValue);
      val.value = "";
      return false;
    }
  }
}
function setAVGvalue(val1,val2,val3){
  if (!isblank(val1.value) || !isblank(val2.value)) {
    if (checkNegativeFloatValue(val1) && checkNegativeFloatValue(val2)) {
      var avg = (parseFloat(val1.value) + parseFloat(val2.value)) /2;
      if (isNaN(avg)){
        avg.value= "";
      } else { val3.value = avg.toString().slice(0,5); }
    }
  }
}
function toggle(p_img, p_tx_File) {
  p_img.src = p_tx_File;
}
function resetValue(f,val1,val2){
  val1.value = "";
  val2.value = "";
}
function logout(){
  if (confirm(mLogout)) {
    return true;
  }
  else return false;
}
function goToPage(val) {
  location.href = val;
}
function goToLogout(){
  if (goToLogout.arguments[0] == "../") {
    var ahref = "../hortivar.htm?TRX=Logout";
  } else {
    var ahref = "hortivar.htm?TRX=Logout";
  }
  location.href = ahref;
}
function goToAdmin(){
  if (goToAdmin.arguments[0] == "../") {
    var ahref = "../hortivar.htm?TRX=Redirect&TO=ADM";
  } else {
    var ahref = "hortivar.htm?TRX=Redirect&TO=ADM";
  }
  window.location.href = ahref;
}
function editUser() {
  var ahref = "hortivar.htm?TRX=CreateNewUserAdmin&ACTION=SETUP";
  if (navigator.appName=="Netscape") { window.setResizable(true);}
  window.open(ahref, "popUp", "status=yes,resizable=yes,scrollbars=yes,height=590,width=640,top=0,left=0");
}
function editSeedSupUser() {
  var ahref = "hortivar.htm?TRX=CreateNewUserAdmin&ACTION=SETUPPSS";
  if (navigator.appName=="Netscape") { window.setResizable(true);}
  window.open(ahref, "popUp", "status=yes,resizable=yes,scrollbars=yes,height=700,width=650,top=0,left=0");
}
function changeLN(val){
   var ahref = "hortivar.htm?TRX=Redirect&TO=LN&LN="+val;
   window.location.href = ahref;
}
function changeImg(input, file){
   input.src = file;
}
function stripInvalidChar (s,val,bag){
  var returnString = "";
  for (var i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if (bag.indexOf(c) == -1) returnString += c;
    else{
       if (bag == ','){
         c = '.';
       } else {
         c = '';
       }
       returnString += c;
    }
  }
  val.value  = returnString;
}
function stripApostf (s,val){
  return stripInvalidChar (s,val,invalidChar);
}
function stripComman (s,val){
  return stripInvalidChar (s,val,',');
}
function isEmail (s){
  if (isEmpty(s))
  if (isEmail.arguments.length == 1) return defaultEmptyOK;
    else return (isEmail.arguments[1] == true);
  if (isWhitespace(s)) return false;
  var i = 1;
  var sLength = s.length;
  // look for @
   while ((i < sLength) && (s.charAt(i) != "@")) { i++ }
   if ((i >= sLength) || (s.charAt(i) != "@")) return false;
   else i += 2;
  // look for .
   while ((i < sLength) && (s.charAt(i) != ".")) { i++ }
  // there must be at least one character after the .
   if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
   else return true;
}
function checkEmail (theField, emptyOK){
   if (checkEmail.arguments.length == 1) emptyOK = defaultEmptyOK;
   if ((emptyOK == true) && (isEmpty(theField.value))) return true;
   else if (!isEmail(theField.value, false))
       return warnInvalid (theField, iEmail);
   else return true;
}
function checkDate(yearField,monthField,dayField,type) {
  var flag = false;
  if (type==1) {
    flag = isDate(yearField.value, monthField.value, dayField.value);
  } else if (type==2 && dayField==null) {
    flag = isShortDate(yearField.value, monthField.value);
  } else if (type==3 && monthField==null && dayField==null){
    flag = isYear(yearField.value);
  } else if (type==4 && yearField==null && dayField==null){
    flag = isMonth(monthField.value);
  }
  if (!flag){
    alert(mDateInvalid);
    return false;
  }
  else return true;
}
function checkValues(a,b,c, emptyOK){
  if (checkValues.arguments.length ==3) emptyOK = defaultEmptyOK;
  if ((emptyOK == true) && isblank(a.value) && isblank(b.value) && isblank(c.value)) return 4;
  else if (!isblank(a.value) && !isblank(b.value) && !isblank(c.value)) return 1;
  else if (!isblank(a.value) && !isblank(b.value)) return 2;
  else if (!isblank(a.value)) return 3;
  else if (!isblank(b.value)) return 0;
}
function checkRange(s, minValue, maxValue){
  if (isEmpty(s.value)) {
     if (checkRange.arguments.length == 4) return defaultEmptyOK;
     else return (checkRange.arguments[3] == true);
  }
  var e = s.value;
  if (!isAlphabetic(e) && isIntegerInRange(parseInt(e),minValue,maxValue)) return true;
  else {
    alert (invalidNum + ':' + e + '\n' + invalidRange + ' ' + minValue + '-' + maxValue);
    s.value = "";
    return false;
  }
}
function canSubmitForm(f){
 var flag = false;
 for (var i=0; i< f.length; i++){
   var obj = f.elements[i];
   if (obj.type != "hidden" && obj.type != "radio"){
     var flag = checkFormFields(obj, obj.type);
     if (flag) break;
   }
 }
 return flag;
}
function setRadioFlag(flag){
 radioFlag = flag;
}
function disableIt(obj){
	obj.disabled = !(obj.disabled);
	var z = (obj.disabled) ? 'disabled' : 'enabled';
	obj.value = mButtonSubmit;
	//alert(obj.type + ' now ' + z);
}
function ChangeRollover(id){
  var element = document.getElementById( id );
  if ( element ) {
    element.style.cursor = "pointer";
    element.style.cursor = "hand";
  }
}
function changeCursor(){
   doc = document.getElementById('MYFORM');
   doc.style.cursor = "wait";
}
function executeLink(){
    if (IE4){
    	window.onscroll=changeCursor;
    	changeCursor();     	
    }
    showWaiting();
}
function submitForm(obj){
  var flag = verify(this.document.forms[0]);
  if (flag==true){
    submitOnce(this.document.forms[0]);
    disableIt(obj);
    this.document.forms[0].submit();
    executeLink();
  }
}
function resetForm(){
  if (confirm (mReset)) {
    this.document.forms[0].reset();
  }
}
function checkLength(obj, min, max){
   var text = obj.value;
   var num = parseInt(text.length);
   if (num >= parseInt(min) && num <= (parseInt(max))) return true;
   else {
   	  alert(mMinLenght + min + ". " + mMaxLenght + max);
   	  return false;
   }	
}
function newImage(arg) {
  if (document.images) {
	rslt = new Image();
	rslt.src = arg;
	return rslt;
  }
}
var preloadFlag = false;
function preloadImages() {
  if (!preloadFlag && document.images) {
	newImage('images/detalhe.gif');
	newImage('images/destaque_top.jpg');
	newImage('images/destaque_bot.jpg');
	newImage('images/printer.gif');
	newImage('images/details.gif');
	newImage('images/ok.gif');
	newImage('images/delete.gif');
	newImage('images/Bomb.gif');
	newImage('images/copy.gif');
	newImage('images/photo.gif');
	newImage('images/first.gif');
	newImage('images/first_dn.gif');
	newImage('images/last.gif');
	newImage('images/last_dn.gif');
	newImage('images/next.gif');
	newImage('images/next_dn.gif');
	newImage('images/prev.gif');
	newImage('images/prev_dn.gif');
    newImage('images/redball.gif');
    preloadFlag = true;
  }
}
function setCheckBox(obj){
 if (obj.value== 'T'){
   obj.value = 'F';
 } 
 else if (obj.value== 'F') {
   obj.value = 'T';
 }
}
function printDocument(){
  window.print();
}
function valueInRange(s, min, max){
  var flag = false;
  if (!isEmpty(s)){
    if ((isFloat(s) || isInteger(s)) && (parseFloat(s) >= parseFloat(min) && parseFloat(s) <= parseFloat(max))) {
      flag = true;
    }
  }
  return flag;
}
function switchFocus(objID, status){
  document.getElementById(objID).style.visibility = status;
}
function switchDisplay(objID){
  if(document.getElementById(objID).style.display == "block"){
    changeFocus(objID, "none");
  }
  else changeFocus(objID, "block");
}
function changeFocus(objID, status){
  document.getElementById(objID).style.display = status;
}
function popupCentered(loc, name, width, height) {
  bVer = parseInt(navigator.appVersion);
  var newWin=null;
  var _params = "width="+width+",height="+height+",resizable=yes,status=yes,scrollbars=yes";
  // CENTER ON BROWSERS THAT SUPPORT JSCRIPT 1.2
  if (bVer >= 4) {
    _left = ((screen.width-width) >>1 );
    _top = ((screen.height-height) >>1 );
  } else {
     _left = ((800-width) >>1 );
     _top = ((600-height) >>1 );
  }
  if (navigator.appName =="Microsoft Internet Explorer") _params += ",top=" + _top + ",left=" + _left;
  else if (navigator.appName=="Netscape") _params += ",screenX=" + _left + ",screenY=" + _top;
  newWin = window.open(loc, name, _params);
  if (newWin!=null && !(navigator.appName =="Microsoft Internet Explorer" && bVer<5)){
     newWin.focus(); // MSIE4 DOESN'T FOCUS WINDOWS
  }
}
function setWinBarText(text){
  if (!isblank(text)){
     window.status=text;
  }
}
function lookupPRJ(){
  var prj_code = document.forms[0].prj_code.options[document.forms[0].prj_code.selectedIndex].value;
  var recipient = document.forms[0].recipient.options[document.forms[0].recipient.selectedIndex].value;
  var prj_num = document.forms[0].prj_num.value;
  var donor = document.forms[0].donor.options[document.forms[0].donor.selectedIndex].value;
  if (!isblank(prj_code) || !isblank(recipient) || !isblank(prj_num) || !isblank(donor)) {
     var ahref = "hortivar.htm?TRX=LookupPRJ&ACTION=FIND&orderby=1&prj_code="+prj_code+"&recipient="+recipient+"&prj_num="+prj_num+"&donor="+donor;
     if (navigator.appName=="Netscape") { window.setResizable(true);}
     window.open(ahref, "popUpExtra", "status=yes,resizable=yes,scrollbars=yes,height=200,width=600,top=0,left=0");
  }
  else alert(mProjectFind);
}
function resetProjectValues(){
  document.forms[0].prj_key.value ="";
  document.forms[0].prj_num.value ="";
  document.forms[0].prj_code.options[0].value ="";
  document.forms[0].recipient.options[0].value = "";
  document.forms[0].donor.options[0].value = "";
  document.forms[0].prj_code.options[0].text ="";
  document.forms[0].recipient.options[0].text = "";
  document.forms[0].donor.options[0].text = "";
}
function resetHHI(){
  document.forms[0].hhi_key.value = "";
  document.forms[0].hhi_name.value = "";
}
function lookupHHI(){
  var e = document.forms[0].hhi_name.value;
  if (!isblank(e)) {
    var ahref = "hortivar.htm?TRX=LookupHHI&ACTION=FIND&FROM=RV&hhi_country=9999&hhi_name="+e.toUpperCase();
  }
  else {
    var ahref = "hortivar.htm?TRX=LookupHHI&ACTION=FIND&FROM=RV&hhi_country=9999";
  }
  if (navigator.appName=="Netscape") { window.setResizable(true);}
  window.open(ahref, "popUpExtra", "status=yes,resizable=yes,scrollbars=yes,height=210,width=720,top=0,left=0");
}
function openThumbnail(value){
   if (navigator.appName=="Netscape") { window.setResizable(true);}
   window.open("thumbnail.jsp?imgs=" + value, "popUp", "width=400,height=270,scrollbars=yes,resizable=yes,top=0,left=0");
}
function setHomePage(url) {
	var agt = navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie3 = (is_ie && (is_major < 4));
	var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) );
	var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) && (agt.indexOf("msie 6")==-1));
	var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
	var is_win  = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
	if (is_win && is_ie5up) {
   		HTVHomePage.style.behavior='url(#default#homepage)';
   		HTVHomePage.setHomePage(url);
	}
	else alert(mNotSuportBrowserFunction);
}
function highlightButton(s) {
	if (IE4 && event.srcElement.tagName=="INPUT"){
	  event.srcElement.className=s;
	}
}
function resize(){
   var pos=0;
   if (navigator.appName == 'Netscape') pos=40;
   if (document.images[0]) {
   	  maxWidth  = '500'; maxHeight = '300';
   	  displayWidth = (document.images[0].width+70 < maxWidth? document.images[0].width+70 : maxWidth);
   	  displayHeight =(document.images[0].height+100-pos < maxHeight? document.images[0].height+100-pos: maxHeight);
   	  window.resizeTo(displayWidth, displayHeight);
      self.focus();
   }
}
/*
 ____________________________________
/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Another JavaScript from Uncle Jim   |
| Feel free to copy, use and change   |
| this script as long as this part    |
| remains unchanged. You can visit    |
| my website at http://jdstiles.com   |
| for more scripts like this one.     |
| Created: 1996 Updated: 2006         |
\_____________________________________/
 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/
function resizeWin(maxX, maxY, speed, delay, win){
	this.obj = "resizeWin" + (resizeWin.count++);
	eval(this.obj + "=this");
	if (!win)     this.win = self;    else this.win = eval(win);
	if (!maxX)    this.maxX = 500;    else this.maxX = maxX;
	if (!maxY)    this.maxY = 400;    else this.maxY = maxY;
	if (!speed)   this.speed = 1/7;   else this.speed = 1/speed;
	if (!delay)   this.delay = 30;    else this.delay = delay;
	this.doResize = (document.all || document.getElementById);
	this.stayCentered = false;	
	
	this.initWin = 	function(){
		if (this.doResize){
			this.resizeMe();
		}
		else {
			this.win.resizeTo(this.maxX + 10, this.maxY - 20);
		}
	}
	this.resizeMe = function(){
		this.win.focus();
		this.updateMe();
	}	
	this.resizeTo = function(x,y){
		this.maxX = x;
		this.maxY = y;
		this.resizeMe();
	}		
	this.stayCentered = function(){
		this.stayCentered = true;
	}
	this.updateMe = function(){
		this.resizing = true;
		var x = Math.ceil((this.maxX - this.getX()) * this.speed);
		var y = Math.ceil((this.maxY - this.getY()) * this.speed);
		if (x == 0 && this.getX() != this.maxX) {
			if (this.getX() > this.maxX) x = -1;
			else  x = 1;
		}
		if (y == 0 && this.getY() != this.maxY){
			if (this.getY() > this.maxY) y = -1;
			else y = 1;
		}
		if (x == 0 && y == 0) {
			this.resizing = false;
    	}
		else {
			this.win.top.resizeBy(parseInt(x),parseInt(y));
			if (this.stayCentered == true) this.win.moveTo((screen.width - this.getX()) / 2,(screen.height - this.getY()) / 2);
			setTimeout(this.obj + '.updateMe()',this.delay)
		}
	}		
	this.write =  function(text){
		if (document.all && this.win.document.all["coords"]) this.win.document.all["coords"].innerHTML = text;
		else if (document.getElementById && this.win.document.getElementById("coords")) this.win.document.getElementById("coords").innerHTML = text;
	}		
	this.getX =  function(){
		if (document.all) return (this.win.top.document.body.clientWidth + 10)
		else if (document.getElementById)
			return this.win.top.outerWidth;
		else return this.win.top.outerWidth - 12;
	}	
	this.getY = function(){
		if (document.all) return (this.win.top.document.body.clientHeight + 29)
		else if (document.getElementById)
			return this.win.top.outerHeight;
		else return this.win.top.outerHeight - 31; 
	}	
	this.onResize =  function(){
		if (this.doResize){
			if (!this.resizing) this.resizeMe();
		}
	}
	return this;
}
resizeWin.count = 0;

// This script is copyright (c) Henrik Petersen, NetKontoret
// Feel free to use this script on your own pages as long as you do not change it.
// It is illegal to distribute the script as part of a tutorial / script archive.
// Updated version available at: http://www.echoecho.com/toolfloatinglayer.htm
// This comment and the 4 lines above may not be removed from the code.
// begin loading layer -->
floatX=5;
floatY=10;
layerwidth=110;
layerheight=30;
halign="left";
valign="bottom";
delayspeed=1;

NS6=false;
IE4=(document.all);
if (!IE4) {NS6=(document.getElementById);}
NS4=(document.layers);

function adjust() {
	if ((NS4) || (NS6)) {
		if (lastX==-1 || delayspeed==0){
			lastX=window.pageXOffset + floatX;
			lastY=window.pageYOffset + floatY;
		}
		else{
			var dx=Math.abs(window.pageXOffset+floatX-lastX);
			var dy=Math.abs(window.pageYOffset+floatY-lastY);
			var d=Math.sqrt(dx*dx+dy*dy);
			var c=Math.round(d/10);
			if (window.pageXOffset+floatX>lastX) {lastX=lastX+delayspeed+c;}
			if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}
			if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
			if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
		}
		if (NS4){
			document.layers['floatlayer'].pageX = lastX;
			document.layers['floatlayer'].pageY = lastY;
		}
		if (NS6){
			document.getElementById('floatlayer').style.left=lastX;
			document.getElementById('floatlayer').style.top=lastY;
		}
	}
	else if (IE4){
		if (lastX==-1 || delayspeed==0){
			lastX=document.body.scrollLeft + floatX;
			lastY=document.body.scrollTop + floatY;
		}
		else{
			var dx=Math.abs(document.body.scrollLeft+floatX-lastX);
			var dy=Math.abs(document.body.scrollTop+floatY-lastY);
			var d=Math.sqrt(dx*dx+dy*dy);
			var c=Math.round(d/10);
			if (document.body.scrollLeft+floatX>lastX) {lastX=lastX+delayspeed+c;}
			if (document.body.scrollLeft+floatX<lastX) {lastX=lastX-delayspeed-c;}
			if (document.body.scrollTop+floatY>lastY) {lastY=lastY+delayspeed+c;}
			if (document.body.scrollTop+floatY<lastY) {lastY=lastY-delayspeed-c;}
		}
		document.all['floatlayer'].style.posLeft = lastX;
		document.all['floatlayer'].style.posTop = lastY;
	}
	setTimeout('adjust()',50);
}
function define(){
	if ((NS4) || (NS6)){
		if (halign=="left") {floatX=ifloatX};
		if (halign=="right") {floatX=window.innerWidth-ifloatX-layerwidth-20};
		if (halign=="center") {floatX=Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)};
		if (valign=="top") {floatY=ifloatY};
		if (valign=="bottom") {floatY=window.innerHeight-ifloatY-layerheight};
		if (valign=="center") {floatY=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2)};
	}
	if (IE4){
		if (halign=="left") {floatX=ifloatX};
		if (halign=="right") {floatX=document.body.offsetWidth-ifloatX-layerwidth-20}
		if (halign=="center") {floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)}
		if (valign=="top") {floatY=ifloatY};
		if (valign=="bottom") {floatY=document.body.offsetHeight-ifloatY-layerheight}
		if (valign=="center") {floatY=Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)}
	}
}
function showWaiting() {
	if (NS6) document.getElementById('floatlayer').style.visibility = "visible";
	else document.all['floatlayer'].style.visibility = "visible";
	return true;
}
// end -->

function increaseSize(image, w, h){
  while(image.width <= w){image.width++;}
  while(image.height <= h){image.height++;}
}
function decreaseSize(image, w, h){
  while(image.width >= w){image.width--;}
  while(image.height >= h){image.height--;}
}
function popUpImage(ahref, width, height, pos){
  if (ahref=='null') {
     alert(mInvalidLink);
  }
  else if (ahref!=null && ahref!='') {
    if(pos=="random"){
		LeftPosition=(screen.width)? Math.floor(Math.random()*(screen.width-width)):100;
		TopPosition=(screen.height)? Math.floor(Math.random()*((screen.height-height)-75)):100;
	}
	if(pos=="center"){
		LeftPosition=(screen.width)?(screen.width-width)/2:100;
		TopPosition=(screen.height)?(screen.height-height)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){
		LeftPosition=0;TopPosition=20
	}
    window.open("viewpicture.jsp?&ahref=" + ahref, "popUpPicture" ,"toolbar=no,resizable=yes,location=no,scrollbars=yes,width=" + width +",height=" + height +",top="+TopPosition+",left="+LeftPosition);
  }
}
function popUp(ahref){
  if (ahref=='null') {
     alert(mInvalidLink);
  }
  else if (ahref!=null && ahref!='') {
     window.open(ahref, "popUp","toolbar=yes,location=yes,resizable=yes,scrollbars=yes,width=800,height=600,top=0,left=0");
  }
}
function po(o){o.className=='p1'?o.className='p2': o.className=o.className; }
function px(o){o.className=='p2'?o.className='p1': o.className=o.className; }
function pc(o){o.className='p3'; }

/***********************************************
* Cool DHTML tooltip script II- İ Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
// begin-->
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="images/arrow2.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thewidth, thecolor){
  if (ns6||ie){
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    tipobj.innerHTML=thetext
    enabletip=true
    return false
  }
}
function positiontip(e){
 if (enabletip){
   var nondefaultpos=false
   var curX= (ns6)? e.pageX : event.clientX+ietruebody().scrollLeft;
   var curY= (ns6)? e.pageY : event.clientY+ietruebody().scrollTop;
   //Find out how close the mouse is to the corner of the window
   var winwidth= ie&&!window.opera ? ietruebody().clientWidth : window.innerWidth-20
   var winheight= ie&&!window.opera ? ietruebody().clientHeight : window.innerHeight-20
   var rightedge= ie&&!window.opera ? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
   var bottomedge= ie&&!window.opera ? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
   var leftedge= (offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
   //if the horizontal distance isn't enough to accomodate the width of the context menu
   if (rightedge<tipobj.offsetWidth){
     //move the horizontal position of the menu to the left by it's width
     tipobj.style.left= curX-tipobj.offsetWidth+"px"
     nondefaultpos=true
   }
   else if (curX<leftedge)
      tipobj.style.left= "5px"
   else{
      //position the horizontal position of the menu where the mouse is positioned
      tipobj.style.left= curX+offsetfromcursorX-offsetdivfrompointerX+"px"
      pointerobj.style.left= curX+offsetfromcursorX+"px"
   }
   //same concept with the vertical position
   if (bottomedge<tipobj.offsetHeight){
     tipobj.style.top= curY-tipobj.offsetHeight-offsetfromcursorY+"px"
     nondefaultpos=true
   }
   else{
     tipobj.style.top= curY+offsetfromcursorY+offsetdivfrompointerY+"px"
     pointerobj.style.top= curY+offsetfromcursorY+"px"
   }   
   tipobj.style.visibility="visible"
   if (!nondefaultpos)
      pointerobj.style.visibility="visible"
   else
      pointerobj.style.visibility="hidden"
  }
}
function hideddrivetip(){
  if (ns6||ie){
    enabletip=false
	tipobj.style.visibility="hidden"
	pointerobj.style.visibility="hidden"
	tipobj.style.left="-1000px"
	tipobj.style.backgroundColor=''
	tipobj.style.width=''
   }
}
document.onmousemove=positiontip
// end -->

/***********************************************
// Submit Once form validation- 
// İ Dynamic Drive (www.dynamicdrive.com)
// For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
***********************************************/
// begin -->
function submitOnce(theform){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
	//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				//disable em
				tempobj.disabled=true;
		}
	}
}
// end-->
