//**********************************************************************************
//function open Window starts----------------------------------------------------------
function openWindowFull(ImageName)
{
    w = parseInt( screen.width  - 10 ) ;
    h = parseInt( screen.height - 65 ) ;
    
    wind = window.open("show_big_image.php?ImageName=" + ImageName , "" , 
                           "height=" + h + ", width=" + w + ", scrollbars=yes, " +
                           "resizable=yes" + ", left=0, top=0");


}//openWindowFull()

//**********************************************************************************

function openWindow(path,w,h)
{
  a = window.open(path,"","height=" + h + ",width=" + w + ",scrollbars=yes," +
       "resizable=yes" + ",left=" + (screen.width-w)/2 + ",top=" + (screen.height-h)/2);
}

//**********************************************************************************
function getBrowser(){
  var agtStr = navigator.userAgent;
  var browser = 0;
  var ver;
  var ind = agtStr.indexOf('Gecko');  
  if (ind != -1){
    ver = agtStr.substr(ind+6, 8);
    if (ver < 20020823){
      browser = 1;
    } else {
      browser = 2;    
    }
  } else {
    ind = agtStr.indexOf('Konqueror');
    if (ind != -1){
      ver = agtStr.substr(ind+10, 1);
      if (ver >= 2){
        browser = 1;
      }      
    } else {
      ind = agtStr.indexOf('Opera');
      if (ind != -1){
        ver = agtStr.substr(ind+6, 1);
        if (ver >= 6){
          browser = 1;
        }      
      } else {
        ind = agtStr.indexOf('MSIE');
        if (ind != -1){
          ver = agtStr.substr(ind+5, 3);
          if (ver >= 5.5){
            browser = 3;
          } else {
            browser = 1;
          }      
        }                
      }      
    }       
  }
  return browser;
}

//**********************************************************************************

function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2C').replace(/\"/g,'%22').replace(/\'/g, '%27');
  }


//**********************************************************************************
function reDirect(pageLocation) {
   location.href = pageLocation;
}

//**********************************************************************************
function setOptions(selectedValue, frmObj, catOptionObj, subCatOptionObj)  {
   subCatOptionObj.options.length = 0;
   catArr    = catSubCatArr[0];
   subCatArr = catSubCatArr[1];
   subCatOptionObj.options[subCatOptionObj.options.length] = new Option( "" , "" ); // adds a blank one at the top
   for ( var x = 0 ; x < catArr.length  ; x++ ) {
      if ( catArr[x] == selectedValue ) {
         subCatOptionObj.options[subCatOptionObj.options.length] = new Option( subCatArr[x] , subCatArr[x] );
      }
   }
   
    subCatOptionObj.options.selectedIndex = 0;
}


//**********************************************************************************
function setOptions2(selectedValue, frmObj, catOptionObj, subCatOptionObj, subCatSelected)  {
   subCatOptionObj.options.length = 0;
   subCatSelectedNum = 0
   internalCount     = 1
   
   catArr    = catSubCatArr[0];
   subCatArr = catSubCatArr[1];
   subCatOptionObj.options[subCatOptionObj.options.length] = new Option( "Please select" , "" ); // adds a blank one at the top
   for ( var x = 0 ; x < catArr.length  ; x++ ) {
      if ( catArr[x] == selectedValue ) {
         subCatOptionObj.options[subCatOptionObj.options.length] = new Option( subCatArr[x] , subCatArr[x] );

         if ( subCatArr[x] == subCatSelected) {
            subCatSelectedNum = internalCount;
         }
         internalCount++;
      }
   }
    
   if ( subCatSelectedNum > 0 ) {
      subCatOptionObj.options.selectedIndex = subCatSelectedNum;
   } else {
      subCatOptionObj.options.selectedIndex = 0;
   }
}

//**********************************************************************************
function addToListBox(sourceObj, destObj) {
   sourceListLength      = sourceObj.options.length;
   destinationListLength = destObj.options.length;
   var counter = 0;
   while (counter < sourceObj.length){
      if(sourceObj.options[counter].selected == true) {
         destObj.options[destObj.length] = new Option(sourceObj.options[counter].text, sourceObj.options[counter].value);
         sourceObj.options[counter] = null;
      }
      else {
         counter ++;
      }
   }
   sourceObj.selectedIndex = 0;

} // addToListBox 

//**********************************************************************************
function selectAllInListBox(sourceObj) {
   sourceListLength      = sourceObj.options.length;
   for (var i=0; i < sourceObj.length; i++){
      sourceObj.options[i].selected = true;
   }
} // addToListBox 
