/* * @filename get_suggestion.js * @programmer Sothea Nim (snim@alcor.concordia.ca) * @date June 2009 * @description This file is used for member called from inside of portico */ var thisHost=window.location.host; var thisHostArr=thisHost.split('.'); var thisDomainAlias=thisHostArr[0]; thisDomainAlias=thisDomainAlias.match('concordia')?'www':thisDomainAlias; function getResult(str_in, des_id) { var php_servant = ''; var q_str = ''; if( !(str_in === "Saisir la recherche" || str_in === "Enter your query here" ) && str_in.length > 0 && !(str_in == ' ' || str_in == '\t') ) { if( search_for === 'li_staff' ) { php_servant = ((typeof relative_path!=='undefined') ? relative_path : '/') + "globalmk/plugins/php_curl/geturl.php"; q_str = "url=http://globalmk-dev.concordia.ca/plugins/search.suggest/get_person.php?q="+str_in; } else if( search_for === 'li_entire' ) { php_servant = ((typeof relative_path!=='undefined') ? relative_path : '/') + "globalmk/plugins/php_curl/geturl.php"; q_str = "url=http://globalmk-dev.concordia.ca/plugins/search.suggest/concordiasitelist.php?q="+str_in+"utm_source="+thisDomainAlias; } else if( search_for === 'li_thissite' ) { q_str = "sitename="+str_in; php_servant = ((typeof relative_path!=='undefined') ? relative_path : '/') + "custom/localsitelist.php"; } if( php_servant.length > 0 ) { ajax(php_servant, q_str, "#"+des_id); } } else { $('#'+des_id).hide(); } php_servant = ''; } function ajax(f, q, selector) { $.ajax({ url: f, data: q, dataType: "text", cache: true, type: "GET", error: function(request, error) { $(selector).empty(); $(selector).html("Sorry, but our system is temporarily down.
You can simply press ENTER to get your result.
"); $(selector).append('
[X]
'); }, success: function(d) { $(selector).empty(); if(d) { $(selector).html(d); } else { $(selector).html("Sorry, but we can't find what you are looking for!
You can simply press ENTER to get your result.
"); } $(selector).append('
[X]
'); } }); $(selector).show(); } function closeSuggestResults() { $('#suggest_hint').hide(); return false; } function livesearch_init() { // Turn off autocomplete if (document.getElementById("search_toplevel_query")) { $("#search_toplevel_query").attr('autocomplete','off'); } } function autocomplete_off() { // Turn off autocomplete if (document.getElementById("search_toplevel_query")) { $("#search_toplevel_query").attr('autocomplete','off'); } }