//Global
var xhr_object = null;
function create_xhr_var(){
xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non supporté par le navigateur
alert('Votre navigateur ne supporte pas cette fonctionalité. Installez la dernière version d\'Internet explorer ou de Firefox; Faute de quoi de nombreuses fonctionalités du site ne pourront être activées.');
return;
}
}
var map = null;
var geocoder = null;
function initialize()
{
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
}
}
function showAddress(address)
{
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
//marker.openInfoWindowHtml(address);
}
}
);
}
}
//wp/view...php
function retrieveAddress(url,url_short,type,id)
{
create_xhr_var();
xhr_object.open("POST", url+"/wp/widget_retrieve_address.php", true);
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr_object.onreadystatechange = function()
{
if(xhr_object.readyState == 4)
{
var docXML = xhr_object.responseXML;
var title = '';
var street = '';
var npa = '';
var city = '';
var country = '';
var phone = '';
var mobile = '';
var website = '';
var email = '';
var address = '';
//alert(xhr_object.responseText);
var XML_addresses = docXML.getElementsByTagName("address")
for (i=0;i ';
if(title != '')
address = address+''+title+' ';
if(type == "COMPANY")
address = address+'
';
address = address+'
';
if(street != '')
address = address+street+'
';
if(npa != 0)
address = address+npa+' ';
address = address+city+'
'+country+'
';
if(phone != '')
address = address+'
'+phone+'
';
if(mobile != '')
address = address+'
'+mobile+'
';
if(email != '')
address = address+'
'+email+'';
address = address+"
Lorsque vous contactez cet annonceur, mentionnez que vous avez trouvé cette annonce sur '+url_short+'
'; document.getElementById("div_address").innerHTML = address; if(type == "COMPANY") { initialize(); showAddress(street+", "+npa+" "+city+", "+country); } } } var data = "type="+type+"&id="+id; xhr_object.send(data); } //wp/view...php function setVisitor(url,src,id,IP) { create_xhr_var(); xhr_object.open("POST", url+"/wp/widget_set_visitor.php", true); xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr_object.onreadystatechange = function() { if(xhr_object.readyState == 4) { } } var data = "src="+src+"&id="+id+"&IP="+IP; xhr_object.send(data); }