/* --------------------------------------------------------------------------------------------------------------------------------------------- 
   Client Side Scripting

*/

//OpenWindow
//Opens a Client Window
function OpenModelessWindow( url, title, width, height){
 var style = "toolbar=yes,status=no,menubar=no,resizable=yes,directories=no,width=" + width.toString() + ",height=" + height.toString()
  window.open( url, "", style);
}
function OpenModelessWindowWithoutToolbar(url, title, width, height) {
    var style = "toolbar=no,status=no,menubar=no,resizable=yes,directories=no,scrollbars=yes,width=" + width.toString() + ",height=" + height.toString()
    window.open(url, "", style);
}
function OpenModalWindow( url, title, width, height){
  width+=10;
  height+=35;
  var style = "toolbar=no;status=no;menubar=no;resizable=yes;scroll=no;directories=no;dialogWidth=" + width.toString() + "px; dialogHeight=" + height.toString() +"px"
  var DocUrl = url;
  window.showModalDialog( DocUrl, title, style);
}

function CloseWindow(){ 
  window.close();
}

function ShowHovered( item ){
  var src  = item.src; 
  try{  
    var name = src.substring(0, src.indexOf(".gif"));
    item.src = name + "_hovered.gif";
  }
  catch(e){
  
  }
}
function ShowNormal( item ){
  var src  = item.src; 
  try{  
    var name = src.substring(0, src.indexOf("_hovered"));
    item.src = name + ".gif";
  }
  catch(e){
  
  }
}
//Reload
//Reloads the current window
function Reload(){ 
  window.location.reload();
}

// SetFocus
// Sets focus to a control
function FocusControl(ctl) {
  try {
    ctl.focus();
  }
  catch(e) {
  }
}
function ClientSideDisable(ctl,disable){
    var control;
    if(typeof ctl =='string')
        control = $(ctl);
    else
        control =ctl;
    try{
    if(disable)
        control.disabled = 'disabled';
    else
        control.removeAttribute('disabled');

    }
    catch(e){
    }
}
function $(ctl) {
    return document.getElementById(ctl);
}
function empty(ctl) {
    return ctl.innerHTML.match(/^\s*$/);
  }
  
