function vir_wpSubmit()
{
        var which;
        var candidate, state, party;
        var query;

        // Get the keywords value

        query = document.searchform.elements['keywords'].value;

        // Get the candidate value

        which = document.searchform.candidate.selectedIndex;
        candidate = document.searchform.candidate.value;
        if ( candidate != "-- any candidate --" )
        {
                query += " ClipCandidate:" + candidate;
        }

        // Get the state value

//        which = document.searchform.state.selectedIndex;
//        state = document.searchform.state[which].text;
//        if ( state != "-- any state --" )
//        {
//                query += " ClipState:" + state;
//        }


//        // Get the party value

//                if (document.searchform.party){
//        which = document.searchform.party.selectedIndex;
//        party = document.searchform.party[which].text;
//        if ( party != "-- any party --" )
//        {
//                query += " ClipParty:" + party;
//        }
//                }
        // Stuff the constructed query value into the query field

        document.searchform.elements['query'].value = query;
}

function vir_cspanLoad()
{
        var query = document.searchform.elements['query'].value;
        var regexp, value, i;
        var keywords;

        // Set candidate value

        regexp = /ClipCandidate:(.+)/;
        value = regexp.exec( query );
        for( i = 0; value && i < document.searchform.candidate.length; i++ )
        {
                regexp = new RegExp(document.searchform.candidate[i].text, "");
                if ( regexp.exec( value[1] ) )
                {
                        document.searchform.candidate.selectedIndex = i;

                }
        }

        // Set state value

        regexp = /ClipState:(.+)/;
        value= regexp.exec( query );
        for( i = 0; value && i < document.searchform.state.length; i++ )

        {
                regexp = new RegExp( document.searchform.state[i].text,"");
                if ( regexp.exec( value[1] ) )
                {
                        document.searchform.state.selectedIndex = i;
                }
        }

        // Set party value

        regexp = /ClipParty:(.+)/;
        value= regexp.exec( query );
        for( i = 0; value && i < document.searchform.party.length; i++ )

        {
                regexp = new RegExp( document.searchform.party[i].text,"");
                if ( regexp.exec( value[1] ) )
                {
                        document.searchform.party.selectedIndex = i;
                }
        }

        // Set keywords value

        regexp = /Clip.*/;
        keywords = query.replace( regexp, "" );
        if ( !keywords )
        {
                keywords = query;
        }
        document.searchform.elements['keyword'].value = keywords;
}

function TipsWindow()
{
  popupWin = window.open('http://washingtonpost.virage.com/washingtonpost/template/search_tips.html','SearchTips','status,height=515,width=420,scrolling=no,resizable=yes,toolbar=0');
}