﻿// JScript File

function processKeyEventBlog(keywordBox)
{	 
     if (window.event.keyCode == 13)  {				
	    var sKeyword = document.getElementById(keywordBox);
	    if (sKeyword ) {
	        sUrl = "http://blogs.finditt.com/BlogSearchResult.aspx?Keyword=" +  sKeyword.value ;	
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}
function SubmitSearchBlog(keywordBox)
{
    
    var sKeyword = document.getElementById(keywordBox);    
    if (sKeyword) {        
        sUrl = "http://blogs.finditt.com/BlogSearchResult.aspx?Keyword=" +  sKeyword.value ;	
        document.location.href = sUrl            
    }	    	    
    return false; 
}


function SubmitSearchAllEvent(keyName, keyDate, keyLocation, keyVenue)
{	 
        var sKeyName = document.getElementById(keyName);
	    var sKeyDate = document.getElementById(keyDate);
	    var sKeyLocation = document.getElementById(keyLocation);
	    var sKeyVenue = document.getElementById(keyVenue);
	    var sKeyword = "";
	    if (sKeyName ) { sKeyword =  sKeyName.value ; }	    	    
	    if (sKeyLocation ) { sKeyword += " " + sKeyLocation.value ; }	    	    
	    if (sKeyVenue ) { sKeyword += " " + sKeyVenue.value ; }	    	    	    
	    if (sKeyword && sKeyDate ) {
	        sUrl = "EventsSearchProc.aspx?Keyword=" +  sKeyword + "&KeyDate=" +  sKeyDate.value ;	                    
	        document.location.href = sUrl;
	    }	
	    else if (sKeyName ) {
	        sUrl = "EventsSearchProc.aspx?Keyword=" +  sKeyword ;	                    
	        document.location.href = sUrl;
	    }	
	    else if (sKeyDate ) {
	        sUrl = "EventsSearchProc.aspx?KeyDate=" +  sKeyDate.value ;	                    
	        document.location.href = sUrl;
	    }	
	    
	    
        return false; 
	 
}

function clearDefault(keywordBox)
{
    var sKeyword = document.getElementById(keywordBox);
    if (sKeyword){
         if (sKeyword.value == "Name, City, Team, etc.") {
            document.getElementById(keywordBox).value = "";
         }
    }
}

function processKeyEventForEvent(keywordBox)
{	 
     if (window.event.keyCode == 13)  {				
	    var sKeyword = document.getElementById(keywordBox);
	    if (sKeyword ) {
	        sUrl = "http://events.finditt.com/EventsSearchProc.aspx?Keyword=" +  sKeyword.value ;	        
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}

function SubmitSearchEvent(keywordBox)
{
    
    var sKeyword = document.getElementById(keywordBox);    
    if (sKeyword) {        
        sUrl = "http://events.finditt.com/EventsSearchProc.aspx?Keyword=" +  sKeyword.value ;
        document.location.href = sUrl            
    }	    	    
    return false; 
}


function GMDSubmitSearch( NewUrl, keywordBox)
{     
    
    var sKeyword = document.getElementById(keywordBox);
    
    if (sKeyword) {
        sUrl = NewUrl + sKeyword.value;
	    document.location.href = sUrl;
	    return false;
	}
	else {
	    sUrl = NewUrl;
	    document.location.href = sUrl;
	    return false;
	} 
}

function SubmitSearchGMD(keywordBox, searchKind )
{
    var sKeyword = document.getElementById(keywordBox);
    var sKind = document.getElementById(searchKind);
    if (sKeyword && sKind ) {
        if( sKind.value == "COMPANY" ) {	            
	        sUrl = "http://TheGMD.finditt.com/SearchResultCompany.aspx?Keyword=" +  sKeyword.value ;
        }
        else if( sKind.value == "BROKERAGEFIRM" ) {
            sUrl = "http://TheGMD.finditt.com/SearchResultBF.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "BROKER" ) {
            sUrl = "http://TheGMD.finditt.com/SearchResultBroker.aspx?Keyword=" + sKeyword.value ;
        }	
        else if( sKind.value == "INDIVIDUAL" ) {
            sUrl = "http://TheGMD.finditt.com/SearchResultIndividual.aspx?Keyword=" + sKeyword.value ;
        }	
        else {
	        sUrl = "http://TheGMD.finditt.com/SearchResultCompany.aspx?Keyword=" +  sKeyword.value ;
        }	
        document.location.href = sUrl            
    }	    	    
    return false; 
}

function processKeyEventForGMD(keywordBox, searchKind )
{	 
	 if (window.event.keyCode == 13)  {				
	    var sKeyword = document.getElementById(keywordBox);
	    var sKind = document.getElementById(searchKind);
	    if (sKeyword && sKind ) {
	        if( sKind.value == "COMPANY" ) {	            
		        sUrl = "http://TheGMD.finditt.com/SearchResultCompany.aspx?Keyword=" +  sKeyword.value ;
	        }
	        else if( sKind.value == "BROKERAGEFIRM" ) {
                sUrl = "http://TheGMD.finditt.com/SearchResultBF.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "BROKER" ) {
                sUrl = "http://TheGMD.finditt.com/SearchResultBroker.aspx?Keyword=" + sKeyword.value ;
            }	
            else if( sKind.value == "INDIVIDUAL" ) {
                sUrl = "http://TheGMD.finditt.com/SearchResultIndividual.aspx?Keyword=" + sKeyword.value ;
            }	
            else {
		        sUrl = "http://TheGMD.finditt.com/SearchResultCompany.aspx?Keyword=" +  sKeyword.value ;
	        }	
            document.location.href = sUrl            
	    }	    	    
	    
        return false; 
	 }
	 else
		return true;
}




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 = "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 SubmitSearchAll(keywordBox, searchKind )
{

    var sKeyword = document.getElementById(keywordBox);
    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 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 = "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 = "http://news.finditt.com/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 = "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 = "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 = "http://news.finditt.com/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 = "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(QuoteBox)
{         
    var searchQuote;
    searchQuote = (document.getElementById)? document.getElementById(QuoteBox): document.all[QuoteBox]; 

    if ( searchQuote) {
        sUrl = "http://TheGMD.finditt.com/Summary.aspx?sb=" + searchQuote.value;
	    document.location.href = sUrl;
	    return false;     
    }    
    else {
        sUrl = "http://TheGMD.finditt.com/Summary.aspx?sb=";
	    document.location.href = sUrl;
	    return false;     
	}
}


function processKeyEventForQuote(QuoteBox)
{    
    if (window.event.keyCode == 13)  {				
	    var searchQuote;
        searchQuote = (document.getElementById)? document.getElementById(QuoteBox): document.all[QuoteBox]; 
        if ( searchQuote) {
            sUrl = "http://TheGMD.finditt.com/Summary.aspx?sb=" + searchQuote.value;
	        document.location.href = sUrl;
	        return false;     
        }
        else {
            sUrl = "http://TheGMD.finditt.com/Summary.aspx?sb=";
	        document.location.href = sUrl;
	        return false;     
	    }   	    
	 }
	 else
		return true;
}


function getKeyPress()
{
    var obj = document.getElementById("<%=searchBox.ClientID%>");
    obj.style.color = "black";
    obj.style.fontStyle = "normal";
    obj.style.fontWeight = "normal";
}

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";
}

