﻿// JScript File -  // requires prototype.js
/**Created Feb 9th 2009 by Sandeep Goyal*/

//this fn toggles the hidden div (passed with the div id, the spanid where the title of the div is displayed. and the text for the title)
function togglehiddendiv(divid, spanid, titletext)
        {            
            if ($(divid).style.display=="")
            {
                $(divid).style.display="none";
                //$(spanid).innerText="(Show)";        
                $(spanid).innerHTML = "Show " + titletext;
            }
            else
            {
                $(divid).style.display="";
                //$(spanid).innerText="(Hide)"            
                $(spanid).innerHTML ="Hide " + titletext;
            }            
        } //end function
        
// set of functions shows & hides popup help -  requires helpframe iframe, help div and included contents on the calling doc
function showHelp(element, helptitle){  
          $('spnHelpTitle').innerHTML = helptitle;        
          $('spnHelpTitle').innerText = helptitle;
          var helpblock = $('help');
          var helpframe = $('helpframe');
          Element.extend(element);
          helpblock.currentItem = element.id;
          var pos = Position.cumulativeOffset(element);
          var basepos = Position.cumulativeOffset(helpblock.up());
          var max_x = basepos[0] + helpblock.up().getWidth() -
		        helpblock.getWidth() - 25;
          var x = Math.min(max_x,pos[0] - basepos[0] + 20);
          var y = Math.max(0,pos[1] - basepos[1] - 20);
          helpblock.down('DIV').update(element.helptext);
          helpblock.setStyle({top:y+"px",left:x+"px"});
          helpblock.show()
          helpframe.setStyle({top:y+"px",left:x+"px",height:helpblock.getHeight()});
          helpframe.show();
          }
function hideHelp() { $('help').hide();$('helpframe').hide();}
function toggleHelp(element, helptitle) { if($('help').visible() && ($('help').currentItem == element.id)){ hideHelp()} else { showHelp(element, helptitle)}}                
//End help popup functions

//generic Confirm Function
function cfm()
       {
           var retval = confirm("Are you sure?");
           return retval
        }        
//end generic Confirm Function
        
     