function getAutoRegion(cID,url){	
if(cID){
$.post(url + "modules/thakkertech/autosuggest/getRequest.php",{task:"region",cID:""+cID+""},function(data){
if(data.length>0){				
$('#regionName').html('<option value="all">tous</option>');	
document.getElementById("regionName").disabled = '';
$('#regionName').append(data);	
}
else{$('#regionName').html('<option value="all">tous</option>');document.getElementById("regionName").disabled='disabled';}});}
}
function getAutoDepartment(rID,url){	
if(rID){
$.post(url+"modules/thakkertech/autosuggest/getRequest.php",{task:"department",rID:""+rID+""},function(data){
if(data.length>0){				
$('#deptName').html('<option value="all">tous</option>');
document.getElementById("deptName").disabled='';
$('#deptName').append(data);				
}
else{$('#deptName').html('<option value="all">tous</option>');document.getElementById("deptName").disabled='disabled';}});}
}
function scrollalert(){
var scrolltop=parseInt($('#suggestions').attr('scrollTop'));
var scrollheight=parseInt($('#suggestions').attr('scrollHeight'));
var windowheight=parseInt($('#suggestions').attr('clientHeight'));
var scrolloffset=20;	
if(scrolltop>=(scrollheight-(windowheight+scrolloffset))){	 
var url=document.getElementById('url').value;
var fieldID=document.getElementById('fieldID').value;		
var fieldVal=document.getElementById(fieldID).value;	
var totalItems=0;
var totalItems=$('#autoSuggestionsList li').length;;		 
var tLimit=parseInt(totalItems)+10;
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchString:""+fieldVal+"",fID:""+fieldID+"",tLimit:""+tLimit+"" ,totalItems:""+totalItems+""},function(data){if(data.length>0){$('#autoSuggestionsList').append(data);}});}
setTimeout('',1500);
}
function lookup(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchString:""+inputString+"",fID:""+fID+""},function(data){
if(data.length>0){$('#suggestions').show();$('#autoSuggestionsList').html(data);}});}
}
function lookupaddName(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchStringAddName:""+inputString+"",fID:""+fID+""},function(data){if(data.length >0){$('#suggestions').show();$('#autoSuggestionsList').html(data);}});}
}
function lookupZip(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchStringZip:""+inputString+"",fID:""+fID+""},function(data){
if(data.length>0){$('#suggestionsZip').show();$('#autoSuggestionsListZip').html(data);}});}
}
function lookupDept(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchStringDept:""+inputString+"",fID:""+fID+""},function(data){
if(data.length>0){$('#suggestionsDept').show();$('#autoSuggestionsListDept').html(data);}});}
}
function lookupRegion(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchStringRegion:""+inputString+"",fID:""+fID+""},function(data){
if(data.length>0){$('#suggestionsRegion').show();$('#autoSuggestionsListRegion').html(data);}});}
}
function lookupCountry(inputString,fID,url){
if(inputString.length==0){$('#City[0]').hide();}
else{
$.post(url+"modules/thakkertech/autosuggest/string_search.php",{mysearchStringCountry:""+inputString+"",fID:""+fID+""},function(data){if(data.length>0){$('#suggestionsCountry').show();$('#autoSuggestionsListCountry').html(data);}});}
}
function fill(thisValue,fID,url){}
function launchCityWindow(sBaseUrl,mysearchString ,fID){
var win='width=480,height=420,left=200,top=300,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no';
return !window.open(sBaseUrl + 'modules/thakkertech/autosuggest/string_search.php?task=addCity&cityName='+mysearchString+'&fID='+fID,'addCity',win);
}
function fillCity(thisValue,fID,url,zipID,zipVal,dept){
fill(thisValue,fID,url)
if(zipID !=''){document.getElementById(''+zipID+'').value=zipVal;} 
document.getElementById(fID).value=thisValue;
if(document.getElementById('Department'))
document.getElementById('Department').value=dept;
$('#suggestions').hide();
}
function fillCityZip(thisValue,fID,url,zipID,zipVal){
fill(thisValue,fID ,url)
document.getElementById(fID).value=thisValue; 
$('#suggestionsZip').hide();
}
function fillCityDept(thisValue,fID,url,zipID,zipVal){
fill(thisValue,fID,url)
document.getElementById(fID).value=thisValue; 
$('#suggestionsDept').hide();
}
function fillCityRegion(thisValue,fID,url,zipID,zipVal){
fill(thisValue,fID,url)
document.getElementById(fID).value=thisValue; 
$('#suggestionsRegion').hide();
}
function fillCityCountry(thisValue,fID,url,zipID,zipVal){
fill(thisValue,fID,url)
document.getElementById(fID).value=thisValue; 
$('#suggestionsCountry').hide();
}
