﻿// JScript File

function processKeyEventAll(keywordBox, searchKind )
{	 
    
	 if (window.event.keyCode == 13)  {				
	 
	    var sKeyword = document.getElementById(keywordBox);
	    var sKind = document.getElementById(searchKind);
	    
	    if (sKeyword && sKind ) {
	        if( sKind.value == "NEWS" ) {	            
		        sUrl = "http://news.finditt.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }
	        else if( sKind.value == "PROFILE" ) {
                sUrl = "http://news.finditt.com/ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "BLOGS" ) {
                sUrl = "/BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "CLASSIFIEDS" ) {
                sUrl = "http://news.finditt.com/ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
            }	
            else {
		        sUrl = "http://news.finditt.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }	
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}

function processKeyEventAllTWN(keywordBox, searchKind )
{	 
    
	 if (window.event.keyCode == 13)  {				
	 
	    var sKeyword = document.getElementById(keywordBox);
	    var sKind = document.getElementById(searchKind);
	    
	    if (sKeyword && sKind ) {
	        if( sKind.value == "NEWS" ) {	            
		        sUrl = "http://www.transworldnews.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }
	        else if( sKind.value == "PROFILE" ) {
                sUrl = "http://www.transworldnews.com/ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "BLOGS" ) {
                sUrl = "/BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "CLASSIFIEDS" ) {
                sUrl = "http://www.transworldnews.com/ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
            }	            
            else {
		        sUrl = "http://www.transworldnews.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
	        }	
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}

function SubmitSearchAll(keywordBox, searchKind )
{

     
    var sKeyword = document.getElementById(keywordBox);
    var sKind = document.getElementById(searchKind);
    if (sKeyword && sKind ) {
        if( sKind.value == "NEWS" ) {
            sUrl = "http://news.finditt.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        else if( sKind.value == "PROFILE" ) {
            sUrl = "http://news.finditt.com/ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "BLOGS" ) {
            sUrl = "/BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "CLASSIFIEDS" ) {
            sUrl = "http://news.finditt.com/ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
        }	
        else {
            sUrl = "http://news.finditt.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        document.location.href = sUrl            
    }	    	    
    return false; 
}

function SubmitSearchAllTWN(keywordBox, searchKind )
{

     
    var sKeyword = document.getElementById(keywordBox);
    var sKind = document.getElementById(searchKind);
    if (sKeyword && sKind ) {
        if( sKind.value == "NEWS" ) {
            sUrl = "http://www.transworldnews.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        else if( sKind.value == "PROFILE" ) {
            sUrl = "http://www.transworldnews.com/ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "BLOGS" ) {
            sUrl = "/BlogSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "CLASSIFIEDS" ) {
            sUrl = "http://www.transworldnews.com/ClassifiedsSearchResult.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "WEB" ) {
                sUrl = "http://www.finditt.com/search/extremesearch.php?search=" + sKeyword.value ;
        }	
        else {
            sUrl = "http://www.transworldnews.com/SearchResult.aspx?Keyword=" +  sKeyword.value ;
        }
        document.location.href = sUrl            
    }	    	    
    return false; 
}


function processKeyEvent(KeywordTextboxID)
{	 
	 if (window.event.keyCode == 13)  {				
	    var sKeyword = document.getElementById(KeywordTextboxID);
	    
	    var sUrl = "ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
        document.location.href = sUrl            
	    
        return false; 
	 }
	 else
		return true;
}

function fSubmitSearchProfile(KeywordTextboxID) 
{

    var sKeyword = document.getElementById(KeywordTextboxID);
    var sUrl = "ProfileSearchResult.aspx?Keyword=" + sKeyword.value ;
    document.location.href = sUrl           
        
    return false; 
}



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;
}

function googleSearchPress()
{
    var searchTerm = document.getElementById('googSearchBx').value;
    if(searchTerm.replace(/^\s+|\s+$/g, '') == '')
    {
        var obj = document.getElementById('googSearchBx');
        obj.style.color = "red";
        obj.style.fontStyle = "italic";
        //obj.style.fontWeight = "bold";
        document.getElementById('googSearchBx').value = "Search..."        
        return false;
    }
    return true; 
}

function normalTextStyle()
{
    var obj = document.getElementById('googSearchBx');
    obj.style.color = "black";
    obj.style.fontStyle = "normal";
}