var popWin = "";

function openwin(URL, strWidth, strHeight){

if (popWin != ""){popWin.close()}
leftStr = (screen.width-strWidth)/2;
topStr = (screen.height-strHeight)/2;
windowProperties = "toolbar=no,menubar=no,scrollbars=yes,statusbar=yes,height="+strHeight+",width="+strWidth+",left="+leftStr+",top="+topStr+"";
isDay = new Date();
isID = isDay.getTime();
popWin = window.open(URL,isID,windowProperties);
}

function confirmAction(text, url)
{
  if (confirm(text))
    {
      window.location = url;
    }
}

function GetAjaxSearch(url)
{
  var criteria = document.search["tix_search"].value;
  var oururl = url+criteria;
  ajaxpage(oururl, 'panelb');
}

function createPopup() {
  //Get the data from the form fields
  var background = '#ffffff';
  var text = document.custom.text.value;

  //Now create the HTML code that is required to make the popup
  var content = "<html><head><title>Project Followups</title></head>\
<body bgcolor='"+background+"' style='font-face: arial'>"+text+"</body></html>";

  //Create the popup
  var popup = window.open("","window","scrollbars=yes");
  popup.document.write(content); //Write content into it.
}



  function hidediv(pass) {
    var divs = document.getElementsByTagName('div');
    for(i=0;i<divs.length;i++){
      if(divs[i].id.match(pass)){ //if they are 'see' divs
        if (document.getElementById) // DOM3 = IE5, NS6
        divs[i].style.visibility="hidden";// show/hide
        else
        if (document.layers) // Netscape 4
        document.layers[divs[i]].display = 'hidden';
        else // IE 4
        document.all.hideshow.divs[i].visibility = 'hidden';
      }
    }
  }

  function showdiv(pass) {

    var divs = document.getElementsByTagName('div');
    for(i=0;i<divs.length;i++){
      if(divs[i].id.match(pass)){
        if (document.getElementById)
        divs[i].style.visibility="visible";
        else
        if (document.layers) // Netscape 4
        document.layers[divs[i]].display = 'visible';
        else // IE 4
        document.all.hideshow.divs[i].visibility = 'visible';
      }
    }
  }

  function get_radio_value()
    {
      for (var i=0; i < document.COMPANY.company.length; i++)
         {
         if (document.COMPANY.company[i].checked)
            {
            var rad_val = document.COMPANY.company[i].value;
            }
         }
    }

 function addIcon(selectedicon)
  {

    window.opener.document.FightsForm.fight_icon.value = selectedicon;
    window.close();

  }

 function clearText()
  {
    document.FORM_COO.Consignee_Name.value = '';
  }


 function confirm_prompt(text, url)
  {
    if (confirm(text))
      {
        window.location = url;
      }
  }


 function CreateBookmarkLink() {

 title = "Services Portal";
 url = "http://apache/intranet/";

  if (window.sidebar) { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
  } else if( window.external ) { // IE Favorite
    window.external.AddFavorite( url, title); }
  else if(window.opera && window.print) { // Opera Hotlist
    return true; }
 }



  var min=8;
  var max=18;

  function increaseFontSize() {
     var p = document.getElementsByTagName('p');
     for(i=0;i<p.length;i++) {
        if(p[i].style.fontSize) {
           var s = parseInt(p[i].style.fontSize.replace("px",""));
        } else {
           var s = 12;
        }
        if(s!=max) {
           s += 1;
        }
        p[i].style.fontSize = s+"px"
     }
  }

  function decreaseFontSize() {
     var p = document.getElementsByTagName('p');
     for(i=0;i<p.length;i++) {
        if(p[i].style.fontSize) {
           var s = parseInt(p[i].style.fontSize.replace("px",""));
        } else {
           var s = 12;
        }
        if(s!=min) {
           s -= 1;
        }
        p[i].style.fontSize = s+"px"
     }
  }


function selectAllOptions( cb, selName )
  {
    var f = cb.form;
    var sel = f.elements[selName];

    var opt, i = 0;
    while( opt = sel.options[i++] )
    {
      opt.selected = cb.checked;
    }
  }

// Set the default "show" mode to that specified by W3C DOM
// compliant browsers

var showMode = 'table-cell';

// However, IE5 at least does not render table cells correctly
// using the style 'table-cell', but does when the style 'block'
// is used, so handle this

if (document.all) showMode='block';

// This is the function that actually does the manipulation

function toggleVis(btn){

  // First isolate the checkbox by name using the
  // name of the form and the name of the checkbox

  btn   = document.forms['tcol'].elements[btn];

  // Next find all the table cells by using the DOM function
  // getElementsByName passing in the constructed name of
  // the cells, derived from the checkbox name

  cells = document.getElementsByName('t'+btn.name);

  // Once the cells and checkbox object has been retrieved
  // the show hide choice is simply whether the checkbox is
  // checked or clear

  mode = btn.checked ? showMode : 'none';

  // Apply the style to the CSS display property for the cells

  for(j = 0; j < cells.length; j++) cells[j].style.display = mode;
}


function dirtypop(title,data)
{
  var generator=window.open('','name','height=800,width=800');
  var title=(title);
  var data=(data);
  
  generator.document.write('<html><head><title>'+title+'</title>');
  generator.document.write('<link rel="stylesheet" href="style.css">');
  generator.document.write('</head><body><form name="BigForm">');
  generator.document.write('<textarea style="width:100%; height: 95%;" name="bigdata" id="bigdata">'+data+'</textarea>');
  generator.document.write('<p><a href="javascript:self.close()">Close Window</a></p>');
  generator.document.write('</form></body></html>');
  generator.document.close();
}

