﻿// JScript File NN

// func to clear search text
    function doClear(txtbox)
    {
        var theText=document.getElementById(txtbox)
    
        if(theText.value == theText.defaultValue)
        {
            theText.value = ""
        }
    }

    // func to bring back search text
    function doBlur(txtbox, defaultTxt)
    {
        var theText=document.getElementById(txtbox)
        if(theText.value == '')
        {
            theText.value = defaultTxt
        }
    }
    
    
    function doClick(buttonName,e)
    {//the purpose of this function is to allow the enter key to point to the correct button to click.
        var key;

         if(window.event)
              key = window.event.keyCode;     //IE
         else
              key = e.which;     //firefox
    
        if (key == 13)
        {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null)
            { //If we find the button click it
                btn.click();
                event.keyCode = 0
            }
        }

    }
    
    
    /**/
    
    // move element to specific position  
    function moveIt(obj, mvTop, mvLeft) 
    {
	    obj.style.position = "absolute";
	    obj.style.top = mvTop;
	    obj.style.left = mvLeft;
    }
    
    // toggle hidden layer
    function toggleLayer( whichLayer)
    {
      var elem, vis;
      var target_elem;
      //var posX, posY;
      //var clickX, clickY;
  
      if( document.getElementById ) // this is the way the standards work
      {
        elem = document.getElementById( whichLayer );
        //target_elem=document.getElementById( whichHref );
      }
      else if( document.all ) // this is the way old msie versions work
      {
        elem = document.all[whichLayer];
        //target_elem=document.all( whichHref );
      }
      else if( document.layers ) // this is the way nn4 works
      {
        elem = document.layers[whichLayer];
        //target_elem=document.layers( whichHref );
      }
      vis = elem.style;
      
      //posX = target_elem.offsetLeft;
      //posY = target_elem.offsetTop;
      //clickX = window.event.x;
      //clickY = window.event.y; 
      
      //clickX = clickX - 80;
      //posY = posY + 300;
      
      // if the style.display value is blank we try to figure it out here
      if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
      {
        vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
        //moveIt(elem,posY,clickX);
      }
      vis.display = (vis.display==''||vis.display=='block')?'none':'block';
      
        
      //window.status = "posX: " + posX + ", posY: " + posY + ", clickX: " + clickX + ", clickY: " + clickY;
    }

    // auto refreash latest items
    function CallMe()
    {
        CallingServer();
        window.setTimeout('CallMe();', 5000);
    }
    function displayTimeFromServer(txt,context)
    {
        x = document.getElementById("Divauto");
		x.innerHTML = txt;

        y = document.getElementById("DivLatestHolder");
	if(y.style.backgroundColor == "#ffffff")
		y.style.backgroundColor = "#ffffcc";
	else
		y.style.backgroundColor = "#ffffff";
    }
    
    function sessoincookie()
    {
    var data=document.frames["scfrm"].document.getElementById('msg').innerHTML;
    if(data!="")
        document.getElementById('scfrm').style.display="block";
    }
    