function preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=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 viewerpopup(url) {
  w = 675;
  h = screen.availHeight-48;
  features = "width="+w+",height="+h;
  features += ",toolbar=0,location=0,directories=0,status=0,menubar=no,scrollbars=1,resizable=1,left=0,top=0,screenX=0,screenY=0";
  ssgpopwin = window.open(url, "pop", features);
  ssgpopwin.focus();
}

function jumpto() {
  var w = document.jumpform.jumplist.selectedIndex;
  var url_add = document.jumpform.jumplist.options[w].value;
  window.location.href = url_add;
}

function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");      
  if (restore) selObj.selectedIndex=0; 
} 

function SetFormSaveWarning(){
  document.getElementById('top_nav_selector').onclick=function(){return confirm('You have not saved your changes. Are you sure you want to exit the current form?')};
  document.getElementById('main_nav_selector').onclick=function(){return confirm('You have not saved your changes. Are you sure you want to exit the current form?')};
  document.getElementById('tool_selector').onclick=function(){return confirm('You have not saved your changes. Are you sure you want to exit the current form?')};
  document.getElementById('tab_selector').onclick=function(){return confirm('You have not saved your changes. Are you sure you want to exit the current form?')};
} 

function SetRadioButtonStates(clicked_id, classname){
  var radiocontrols = document.getElementsByClassName(classname);
  var fields = $A(radiocontrols);
  fields.each(function(uncheckme){
      uncheckme.checked = false;
      uncheckme.value = '0';
  });

  var hiddenclickedid = 'hidden_fieldvalue_' + clicked_id;
  var hiddenclassname = 'hiddenvalue_' + classname;
  var hiddencontrols = document.getElementsByClassName(hiddenclassname);
  var hiddenfields = $A(hiddencontrols);
  hiddenfields.each(function(uncheckthem){
      var previous_event = uncheckthem.onClick;
      uncheckthem.onClick = '';
      uncheckthem.value = '0';
      uncheckthem.onClick = previous_event;
  });

  document.getElementById(clicked_id).checked=true;
  document.getElementById(clicked_id).value='1';
  document.getElementById(hiddenclickedid).value='1';
  SetFormSaveWarning();
}


function SetTextFieldProperties(clicked_id, classname){
  var value = document.getElementById(clicked_id).value;
  var hiddenclickedid = 'hidden_fieldvalue_' + clicked_id;
  document.getElementById(hiddenclickedid).value=value;
  SetFormSaveWarning();
}



