﻿var OnSearch_pointer = OnSearch;


function formSubmit(form, searchString)
{
  window.location = "search-result.aspx?search=" + document.getElementById("ctl00$SearchBox").value;
}


var isNetscape = false;
var isIE = false;
var isWhoKnows = false;
	
//This determines which browser the user is using
if (parseInt(navigator.appVersion) >= 4) 
{
  if(navigator.appName == "Netscape") 
  {
    isNetscape = true;
  }
  else if (navigator.appName == "Microsoft Internet Explorer")
  {
    isIE = true;
  }
  else 
  {
    isWhoKnows = true;
  }
}


function OnChangeReport(select, current_page)
{
  select.form.action = current_page;
  select.form.submit();
}


function OnEnterHit(form, event, function_to_call)
{
  if(isIE)
    OnEnterHitIE(form, event, function_to_call);
  else if(isNetscape)
    OnEnterHitNetscape(form, event, function_to_call);
}


function OnEnterHitIE(form, event, function_to_call)
{
  var keycode;
  
  if (window.event) 
  {
    keycode = window.event.keyCode;
  }
  else 
    return true;

  if(keycode == 13)
  {
    function_to_call(form);
    return false;
  }
  else
    return true;
}


function OnEnterHitNetscape(form, event, function_to_call)
{
  if(event.which == 13)
  {
    function_to_call(form);
    return false;
  }
  else
    return true;
}


function OnGallery(IDDataImageGallery, path)
{
  var left, top1;
  
  width = 800;
  height = 800;

  left = (screen.width - width)/2;
  top1 = (screen.height - height)/4;

  window.open(path + '/gallery/image.aspx?IDDataImageGallery=' + IDDataImageGallery, 'image', 'width=' + width.toString() + ',height=' + height.toString() + ',alwaysLowered=1,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=1,status=1,titlebar=0,toolbar=0,left=' + left + ',top=' + top1 + ',z-lock=0');
}


function OnSearch()
{
  //alert(123);
  window.location = "search-result.aspx?search=" + document.getElementById("ctl00$SearchBox").value;
}


function CheckboxValid(validator_ID, column, num_checkbox)
{
  var element_name, i;
  var ok = false;
  for (i = 0; i < num_checkbox; i++)
  {
    element_name = column + "$" + i;
    if (document.getElementsByName(element_name)[0].checked)
    {
      ok = true;
      document.getElementById("ctl00_Content_" + validator_ID).style.display = 'none';
      break;
    }
  }
  if (!ok)
  {  
    document.getElementById("ctl00_Content_" + validator_ID).style.display = 'block';   
  }
  return ok;
}


function RadioButtonValid(source, args)
{
  alert(8);
  args.IsValid = false;
}