var b_Timer;

window.onresize = setElements;

//window.onunload = winOnUnload;
var myWindow;

function SessionTimer()
{
    var d = new Date();
    var b=document.getElementById('ctl00_hfSessionStart').value;
    if (b==null || b=='')
    {
        document.getElementById('ctl00_hfSessionStart').value = d.getTime();
    }
}

function winOnUnload()
{
     if (window.event.clientX < 0 && window.event.clientY < 0)
     {
       alert("Window is closed.");
     }
}

function winClose()
{
    if (event.clientY < 0) 
    {
        var width = 480;
        var height = 660;
        var left = parseInt((screen.availWidth/2) - (width/2));
        var top = parseInt((screen.availHeight/2) - (height/2));
        
        var dEnd = new Date();
        var tStart = document.getElementById('ctl00_hfSessionStart').value;
        var tEnd=dEnd.getTime();
        var dt=(tEnd-tStart)/1000;
        
        var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
        myWindow = window.open('MiniSurvey.htm?tt='+dt, "subWind", windowFeatures);
    }
}

function evOnFocusTB(tb)
{ 
    if (tb.value=="enter search text here...") { tb.value=""; }
}

function setElements()
{
    GetWindowSize();
    var h = screen.height;
    var w = screen.width;
    var s = 14;
    var hp = 1;
    var div;
    
    if (h<700 || w<900)
    {
        s=10;
        hp=0.4;
    }
    else if ((h>=700 && h<1000) || (w>=900 && w<1200)) 
    {
        s=12;
        hp=.66;
    }
    else
    {
        s=14;
        hp=1;
    }
    
    //document.getElementById("bdy").style.fontSize = s+'px';
    document.getElementById('img3').style.height = 150*hp+'px';
    document.getElementById('img4').style.height = 150*hp+'px';
    document.getElementById('img5').style.height = 150*hp+'px';
}

function GetWindowSize() {  
    
    var mySize = new Array();
    mySize[0]=0;
    mySize[1]=0;        
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
    mySize[0]=myWidth;
    mySize[1]=myHeight;
    document.getElementById('ctl00_hfWidth').value =myWidth;
    document.getElementById('ctl00_hfHeight').value =myHeight;
    //return mySize;
}

//function OpenDialog(pn)
//{
//    window.showModalDialog(pn+'','','center:yes;resizable:no;status:no;menubar=no;toolbar=no;directories=no;dialogWidth:424px;dialogHeight:440px;');//
//    window.location.reload();
//}

function evKeyDownTB(tb,e)
{        
    var keynum;
    var keychar;
    var numcheck;
    if(window.event) // IE
      {
      keynum = e.keyCode;
      }
    else if(e.which) // Netscape/Firefox/Opera
      {
      keynum = e.which;
      }
    
    if(keynum==13)
    {
        if (tb.id=="ctl00_tbSearchText")
        {
            var theForm = document.forms['aspnetForm'];
            if (!theForm) {
                theForm = document.aspnetForm;
            }
            theForm.__EVENTTARGET.value = 'tbSearchText';
 	        theForm.__EVENTARGUMENT.value = 'tbSearchText_13';
 	        theForm.submit();
 	    }
    }
}
function evOnFocusTB(tb)
{ 
    if (tb.value=="enter search text here...") { tb.value=""; }
}
