﻿    // Initialize the temporary Panel to display while waiting for external content to load
    var yahooWindow;

    function LoadJobs(strURL) {
        document.getElementById('hdnMultipleJobsId').value = '';
        document.getElementById('hdnWorkAuthorization').value = '';	                
        ShowLoading("Refreshing Jobs...");
        xmlHttp = GetXmlHttpObject(jobsLoadedHandler); 
        //Send the xmlHttp get to the specified url 
        xmlHttp_Get(xmlHttp, strURL); 
    }

    function jobsLoadedHandler() 
    {
        //readyState of 4 or 'complete' represents that data has been returned 
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete'){ 
            //Gather the results from the callback 
            yahooWindow.hide();
            var str = xmlHttp.responseText;
            document.getElementById('JobResults').innerHTML = str;
            loadHighlighter();                             
        } 
    } 

    function JobsRadioHandler(strType, strValue)
    {
        var now = new Date();
	    now = now.getSeconds();
        var strURL = '/JS/AJS_job_list.aspx?f=' + uEsc(strType) + '&v=' + uEsc(strValue) + "&uid=" + now;
        LoadJobs(strURL);
    }

    function JobsCheckBoxHandler(strType, strValue, blnChecked)
    {
        var strURL = '/JS/AJS_job_list.aspx?f=' + uEsc(strType) + '&v=' + uEsc(strValue) + '&a=';
        if(blnChecked)
        {
           strURL += 'a';
        }
        else
        {
           strURL += 'r';
        }
        var now = new Date();
	    now = now.getSeconds();
	    strURL += "&uid=" + now;
        LoadJobs(strURL);
    }

    function ShowLoading(strMsg)
    {
        if(yahooWindow == null)
        {
            yahooWindow = 
	            new YAHOO.widget.Panel("wait",  
		            { width:"150px", 		              
		              fixedcenter:true, 
		              close:false, 
		              draggable:false, 
		              zindex:100,
		              modal:true,
		              visible:false
		            } 
	            );
        }
        yahooWindow.setHeader("<center>" + strMsg + "</center>");
        var flashcon = '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"  width="150" height="100" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
        flashcon+='<param name="_cx" value="20638">';
        flashcon+='<param name="_cy" value="3043">';
        flashcon += '<param name="FlashVars" value="20638">';
        flashcon+='<param name="Movie" value="../images/QFETCHENGINE.swf">';
        flashcon+='<param name="Src" value="../images/QFETCHENGINE.swf">';
        flashcon+='<param name="WMode" value="Window">';
        flashcon+='<param name="Play" value="-1">';
        flashcon+='<param name="Loop" value="-1">';
        flashcon+='<param name="Quality" value="High">';
        flashcon+='<param name="SAlign" value="">';
        flashcon+='<param name="Menu" value="-1">';
        flashcon+='<param name="Base" value="">';
        flashcon+='<param name="AllowScriptAccess" value="always">';
        flashcon+='<param name="Scale" value="ShowAll">';
        flashcon+='<param name="DeviceFont" value="0">';
        flashcon+='<param name="EmbedMovie" value="0">';
        flashcon+='<param name="BGColor" value="">';
        flashcon+='<param name="SWRemote" value="">';
        flashcon+='<embed src="../images/QFETCHENGINE.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"';
        flashcon+='type="application/x-shockwave-flash" width="100" height="100"> </embed>';
        flashcon+='</object>';
        yahooWindow.setBody('<div align="center" style="margin:0;padding:0;">'+flashcon+'</div>');
        yahooWindow.render(document.body);

        // Show the Panel
        yahooWindow.show();
    }
    var uEsc = function(strText) {
	if(encodeURIComponent)
		return encodeURIComponent(strText);	
	else	
		return escape(strText);	
    };

