// JavaScript Document
//<![CDATA[
    isIE = document.all? true: false;

    function expandMainPage(divid){
      $$(cid).style.display=($$(cid).style.display!="inline")? "inline" : "none";
	    }

    function expandcontent(divid){
      $$(cid).style.display=($$(cid).style.display!="none")? "none" : ""
      }
    
    function $$(id){
	    return document.getElementById(id); 
	    }
	
    function f_clientWidth() {
        return f_filterResults (
            window.innerWidth ? window.innerWidth : 0,
            document.body ? document.body.clientWidth : 0
            );
        }
        
    function f_clientHeight() {
        return f_filterResults (
            window.innerHeight ? window.innerHeight : 0,
            document.documentElement ? document.documentElement.clientHeight : 0,
            document.body ? document.body.clientHeight : 0
            );
        }

    function f_scrollLeft() {
        return f_filterResults (
            window.pageXOffset ? window.pageXOffset : 0,
            document.documentElement ? document.documentElement.scrollLeft : 0,
            document.body ? document.body.scrollLeft : 0
            );
        }

    function f_scrollTop() {
        return f_filterResults (
            window.pageYOffset ? window.pageYOffset : 0,
            document.documentElement ? document.documentElement.scrollTop : 0,
            document.body ? document.body.scrollTop : 0
            );
        }

    function f_filterResults(n_win, n_docel, n_body) {
        var n_result = n_win ? n_win : 0;
        if (n_docel && (!n_result || (n_result > n_docel)))
            n_result = n_docel;
            return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
            }	
	
	/*not using this because there could be multiple req made. */
	//var req = createXMLHttpRequest(); 
    function createXMLHttpRequest() {
        var xhr = false;  //XMLHttpRequest object
        try{
            xhr = new XMLHttpRequest();
            if (xhr.overrideMimeType){
                // set type accordingly to anticipated content type
                //xhr.overrideMimeType('text/xml');
                xhr.overrideMimeType('text/html');
                }
            }
        catch(e){
            try {xhr = new ActiveXObject("MSXML2.XMLHTTP");}
            catch(e2){
                try{xhr = new ActiveXObject("Microsoft.XMLHTTP");}
                catch(e3){
                    xhr = false; 
                    } 
                } 
            } 
        return xhr;
        }	
	
	 function getYahooStockQoutes(marqueeID) {
		var req = createXMLHttpRequest();
		var rnd982g = Math.random();
		var strURL = 'YahooStockResult.txt';
  	    var strURL = encodeURI(strURL + '?rnd982g='+rnd982g);
  	    
	    if(req){
	        req.open("GET", strURL, true);
	        req.onreadystatechange = function(){
	            if(req.readyState==4 && req.status ==200)
                    {
                    elem = $$(marqueeID); 
                    retVal = req.responseText;
                    elem.innerHTML= retVal;
                    }
	            }
	            req.send(null);
	        }			
	    }
	    
	function checkQuotesInterval(){
	    var secondsToWait = 45000;
	    setInterval("getYahooStockQoutes('stockMarquee');",secondsToWait);
	    }
	    
	function startTick(){
		alert("!");
		}
	function stopTick(){
		document.getElementById("stockMarquee").stop();
		}
	    
	    
	function getCalByMonth(monthVal,yearVal){
	    var req = createXMLHttpRequest();
		var rnd982g = Math.random();
		var strURL = 'calendar_widget.cfm';
  	    var strURL = encodeURI(strURL + '?rnd982g='+rnd982g);
  	    var poststr = "";
  	    poststr += "dtMonthVal=" + encodeURIComponent(monthVal);
  	    poststr += "&dtYearVal=" + encodeURIComponent(yearVal);
  	    req.onreadystatechange = function(){
  	    if (req.readyState == 4){
			if(req.status == 200){
				var response = req.responseText;
				$$('calendarWidget').innerHTML = response;
			    }
		    }
  	    }
  	    
  	    if(req) {
  	        req.open('POST', strURL, true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
    	    req.setRequestHeader("Content-length", poststr.length);
  		    req.setRequestHeader("Connection", "close");
  		    req.send(poststr);
  	        }
	    }    
	    
	    
     function bodr_color(obj, color, width) {
           obj.style.borderColor=color;
           obj.style.borderWidth=width;
           }
    
    function getEventByDay(objVal,targID, objID){
        var req = createXMLHttpRequest();
		var rnd982g = Math.random();
		var strURL = 'DailyCalEvents.cfm';
  	    var strURL = encodeURI(strURL + '?rnd982g='+rnd982g);
  	    var poststr = "";
  	    poststr += "dtCalDate=" + encodeURIComponent(objVal);
  	    req.onreadystatechange = function(){
  	    if (req.readyState == 4){
			if(req.status == 200){
				var response = req.responseText;
				$$(targID).innerHTML = response;
			    }
		    }
  	    }
  	    
  		//$$(targID).style.height = $$(objID).offsetHeight + 3 + 'px';
  		//$$(targID).style.width = $$(objID).offsetWidth + 'px';
  		//$$(targID).style.left = $$(objID).offsetLeft + 3 + 'px';
  		//$$(targID).style.top = $$(objID).offsetTop + 'px';
  	    
  	    if(req) {
  	        req.open('POST', strURL, true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
    	    req.setRequestHeader("Content-length", poststr.length);
  		    req.setRequestHeader("Connection", "close");
  		    req.send(poststr);
  	        }
	    }
		
		function startMarquee(){
			document.getElementById("stockMarquee").start();
			}

		
		function DetectStockKeyPress(thebtn){ //e is event object passed from function invocation
			var characterCode; //literal character code will be stored in this variable
			e = thebtn.event;
			if(e && e.which){ //if which property of event object is supported (NN4)
				e = e;
				characterCode = e.which; //character code is contained in NN4's which property
			}
			else{
				e = event;
				characterCode = e.keyCode; //character code is contained in IE's keyCode property
			}
			
			if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
				//document.forms[0].submit() //submit the form
				StockSymbolLB(document.getElementById("StocksubBtn"));
				return false; 
			}
				else{
				return true; 
			}
		
		}
		
		function StockSymbolLB(obj){
			obj.href='http://finance.yahoo.com/q?s=' + document.getElementById("StockSym").value;
			obj.title = '';
			obj.title = document.getElementById("StockSym").value.toUpperCase() + ' ' + 'Stock Quote';
			myLightbox.start(obj);
			return false;
		}

		
		function HighlightAll(obj){
			obj.focus();
			obj.select();
		}
		
    //]]>