﻿// Copyright 2007 by Developer Utility
// Please see http://www.developerutility.com/Terms.htm for terms of use.

/*
==============================================
Grid Marshall Hyper Link Quick list definition
==============================================
- HyperLinkCall            : Call any event/function/window from the current grid cell
- CloseHyperLink           : Hide the hyper link explanation box
*/

/////////////////////////////////////////////////////////////////////////////////
//    THE FUNCTIONS BELOW ARE FOR ROUTING THE HYPER LINK CALL TO ANY EVENT     //
/////////////////////////////////////////////////////////////////////////////////
function HyperLinkCall(evt, currentGrid, oCell, oHyperLink) {
  try {
    // This is where you call any event/function/window/etc from the column type "hyperlink" 
    // of the xml node head. You can use this column type to update the picture ID inside 
    // this grid, upload, download, start a video/audio clip, open a new window, request a 
    // report, etc.
    //
    // This function is call every time the user click the hyperlink text or image. You can 
    // take advantage of the object (currentGrid, oCell, oHyperLink) past in the parameter 
    // to customize on a per key field basis the function you wish to implement.
    //
    // The event (evt) is pass only as reference in case you want to tailor some special coding.
    
    var oCellString = (browser.isIE) ? oCell.outerHTML : oCell.xml();
    
    var text = (browser.isIE) ? oHyperLink.innerText : oHyperLink.textContent;
    switch(text.toLowerCase()) {
      case "google":
        // Open a new window and display the Google page
        window.open("http://www.google.com", "newWindow");
        break;
      case "yahoo":
        // Open a new window and display the Yahoo page
        window.open("http://www.yahoo.com", "newWindow");
        break;
      default:
        var oLink = document.getElementById("hyperlink");
        if(oLink) { oLink.style.display = "block"; }
        break;
    }
    
    
  } catch(e) {
      StatusBarWrite("Error (fnc : " + "HyperLinkCall" + "). " + e.message, 3000);
    }
}

function CloseHyperLink(evt) {
  try {
    // This is where you hide the hyperlink box.
    // This function is call every time the "hyperlink close icon" is trigger.
    // The event (evt) is pass only as reference in case you want to tailor some special coding.
    
    var oLink = document.getElementById("hyperlink");
    if(oLink) { oLink.style.display = "none"; }
		
  } catch(e) {
      StatusBarWrite("Error (fnc : " + "CloseFilterGrid" + "). " + e.message, 3000);
    }
}
