﻿// JScript File


function processKeyEventForTWN()
{	 
	 if (window.event.keyCode == 13)  {				
	    var sKeyword = document.getElementById("txtKeyword");
	    var sKind = document.getElementById("SearchKind");
	    if (sKeyword && sKind ) {
	        if( sKind.value == "NEWS" ) {	            
		        sUrl = "SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }
	        else if( sKind.value == "PROFILE" ) {
                sUrl = "ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "BLOGS" ) {
                sUrl = "BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "CLASSIFIEDS" ) {
                sUrl = "ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
            }	
            else {
		        sUrl = "SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }	
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}

function fSubmitSearchTWN() 
{

    var sKeyword = document.getElementById("txtKeyword");
    var sKind = document.getElementById("SearchKind");
    if (sKeyword && sKind ) {
        if( sKind.value == "NEWS" ) {
            sUrl = "SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        else if( sKind.value == "PROFILE" ) {
            sUrl = "ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "BLOGS" ) {
            sUrl = "BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "CLASSIFIEDS" ) {
            sUrl = "ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
            }	            
        else {
            sUrl = "SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        document.location.href = sUrl            
    }	    	    
    return false; 
}


function fSubmitSearch( NewUrl )
{     
    var search ;
    search = (document.getElementById)? document.getElementById('searchkeyword'): document.all['searchkeyword' ];     
    
    if (search) {
        sUrl = NewUrl + search.value;
	    document.location.href = sUrl;
	    return false;
	}
	else {
	    sUrl = NewUrl;
	    document.location.href = sUrl;
	    return false;
	} 
}

//function fSubmitQuote()
//{         

//    var searchQuote;
//    searchQuote = (document.getElementById)? document.getElementById('searchQuote'): document.all['searchQuote' ]; 
//        
//    if ( searchQuote) {
//        if ( searchQuote.value != "" ) 
//        {
//            sUrl = "http://finance.finditt.com/Summary.aspx?sb=" + searchQuote.value;
//	        document.location.href = sUrl;
//	        return false;     
//	    }
//	    else return false;
//    }    
//    else {
//        return false;     
//	}
//}



function fSubmitQuote()
{         

    var searchQuote;
    searchQuote = (document.getElementById)? document.getElementById('searchQuote'): document.all['searchQuote' ]; 
    
    if ( searchQuote) {
        sUrl = "Summary.aspx?sb=" + searchQuote.value;
	    document.location.href = sUrl;
	    return false;     
    }    
    else {
        sUrl = "Summary.aspx?sb=";
	    document.location.href = sUrl;
	    return false;     
	}
}


function processKeyEventForQuote()
{    
    if (window.event.keyCode == 13)  {				
	    var searchQuote;
        searchQuote = (document.getElementById)? document.getElementById('searchQuote'): document.all['searchQuote' ]; 
        if ( searchQuote) {
            sUrl = "Summary.aspx?sb=" + searchQuote.value;
	        document.location.href = sUrl;
	        return false;     
        }
        else {
            sUrl = "Summary.aspx?sb=";
	        document.location.href = sUrl;
	        return false;     
	    }
    
	    
	 }
	 else
		return true;
}
