//////////////////////////////////////////////////////////////////////////// // // Copyright TheDeal LLC 2006 // // This script depends on main_script for encodeXML and decode XML // //////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------- // Get HTML table from collection of DealObjects // Each DealObject must have method of getTR or getDeleteTR // @param p_collection - collection of DealObjects // @param p_delete - if this is delete table // @return HTML table string //------------------------------------------------------------------- function getDealObjectTable (p_collection, p_delete) { var m_rtn = ""; var iSize = p_collection.size(); var iRow = 1; var tableHeader = ""; for (var i=0; i"; } else { m_rtn += tempObj.getTR(bgc); if ( tempObj.tableHeader != "" ) tableHeader = "" + tempObj.tableHeader + ""; } iRow++; } } if ( iSize > 0 ) { m_rtn = "" + tableHeader + m_rtn + "
"; } return m_rtn; } //------------------------------------------------------------------- // Get XML string from collection of DealObjects // Each DealObject must have getXML method // @param p_collection - collection of DealObjects // @return XML string //------------------------------------------------------------------- function getDealObjectXML (p_collection, p_tag) { var m_rtn = ""; var iSize = p_collection.size(); var m_tag = "js-collection"; if ( p_tag != null ) m_tag = p_tag; for (var i=0; i 0 ) m_rtn = "<" + m_tag + ">" + m_rtn + ""; return m_rtn; } //--------------------------------------------------------------- // JSCollection object // : Empty constructor // : add(obj) -- adds object to collection // : remove(index) -- removes object from collection with given index // : get(index) -- gets object from collection with given index // : size() -- gets collection size //--------------------------------------------------------------- function JSCollection () { this.objList = new Array(); this.add = JSCollection_Add; this.remove = JSCollection_Remove; this.get = JSCollection_Get; this.set = JSCollection_Set; this.size = JSCollection_Size; } //--------------------------------------------------------------- // JSHashtable object // : Empty constructor // : put(key, obj) -- puts object into hashtable with given key // : get(key) -- gets object from hashtable with given key // : remove(key) -- removes object from hashtable with given key // : size() -- gets hashtable size //--------------------------------------------------------------- function JSHashtable () { this.objList = new Array(); this.put = JSHashtable_Put; this.get = JSHashtable_Get; this.remove = JSHashtable_Remove; this.size = JSHashtable_Size; } //--------------------------------------------------------------- // Internal private methods //--------------------------------------------------------------- // Add object to JSCollection function JSCollection_Add (p_obj) { this.objList.push(p_obj); } // Remove object from JSCollection given index function JSCollection_Remove (p_index) { this.objList.splice(p_index,1); } // Get object from JSCollection given index function JSCollection_Get (p_index) { return this.objList[p_index]; } // Set object to JSCollection in given index function JSCollection_Set (p_index, p_obj) { this.objList[p_index] = p_obj; } // Get JSCollection size function JSCollection_Size () { return this.objList.length; } // Put object into JSHashtable function JSHashtable_Put (p_key, p_value) { this.remove(p_key); var t = new JSKeyValuePair(p_key, p_value); this.objList.push(t); } // Get object from JSHashtable by key function JSHashtable_Get (p_key) { var listLen = this.objList.length; for (var i=0;i"); this.hideHTML = tempHTML.substring(0, i); this.showHTML = tempHTML.substring(i+19, tempHTML.length); } var masterHideShowHashtable = new JSHashtable(); function hideDivObject (p_id) { var divObj = masterHideShowHashtable.get(p_id); if ( divObj == null ) { divObj = new JSHideShowDivObject(p_id); masterHideShowHashtable.put(p_id, divObj); } document.getElementById(p_id).innerHTML = divObj.hideHTML; } function showDivObject (p_id) { var divObj = masterHideShowHashtable.get(p_id); if ( divObj == null ) { divObj = new JSHideShowDivObject(p_id); masterHideShowHashtable.put(p_id, divObj); } document.getElementById(p_id).innerHTML = divObj.showHTML; }