browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
function addFav() {
	if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {
                url_site="http://www.mustvideos.es/";
                titre_site = "MustVideos.es [sexe gratuit]";
		window.external.AddFavorite(url_site, titre_site);
        } else {
                alert('Teclea CTRL+ D para tener MUSTVIDEOS en FAVORITOS');
        }
}
function showCalc() {
	if(document.getElementById) {
		element = document.getElementById('divcalc');
	} else if(document.all) {
		element = document.all['divcalc'];
	} else {
		return;
	}
	if(element.style) {
		if(element.style.display == 'block' ) {
			element.style.display = 'none';
		} else {
			element.style.display = 'block';
		}
	}
}
function control(value) {
	var valid_char ="0123456789[]()-+*%/.";
	for (var i = 0; i < value.length; i++)
		if (valid_char.indexOf(value.charAt(i))<0 ) return false;
	return true;
}

function calcul() {
	var x = 0;
	if (control(window.document.calc_machine.show.value))
		x = eval(window.document.calc_machine.show.value);
	window.document.calc_machine.show.value = x;
}

function get_sign(sign) {
	window.document.calc_machine.show.value = window.document.calc_machine.show.value + sign;
}

//var http = ajaxObject();

function ajaxObject() {
        var req;
        if(window.XMLHttpRequest) {
                // Firefox, Safari, Opera...
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                // Internet Explorer 5+
                req = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
                alert('Probleme a la creation de l\'objet XMLHttpRequest.');
        }
        return req;
}

function displayContent(page,id) {
        var ran_no=(Math.round((Math.random()*9999)));
        http.open('get', '/'+page+'?ran='+ran_no);
        http.onreadystatechange = function() {
                if(http.readyState == 4 && http.status == 200) {
                        var response = http.responseText;
                        if(response) {
                                document.getElementById(id).innerHTML = http.responseText;
                               // document.getElementById(id).style.display='block';
                        }
                }
        }
        http.send(null);
}

