function getCookie(cookieName) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(cookieName + "=");
		if (c_start!=-1) {
			c_start=c_start + cookieName.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return false;
}

//script care face httpRequest
function makeRequest(url) {
	var httpRequest;
	if ( window.XMLHttpRequest ) {
		httpRequest = new XMLHttpRequest();
		if ( httpRequest.overrideMimeType ) {
			httpRequest.overrideMimeType('text/xml');
		}
	}
	else if ( window.ActiveXObject ) {
		try {
			httpRequest = new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch (err) {
			try {
				httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch (err) {}
		}

	}
	if (!httpRequest) {
		return false;
	}
	httpRequest.onreadystatechange = function() {};
	httpRequest.open('GET', url, true);
	httpRequest.send('');
}


var ajax;
var ajaxSupported = true;
var pestePaispeZile = new Date();
pestePaispeZile.setDate(pestePaispeZile.getDate() + 14);

try {
    ajax = new XMLHttpRequest();
} catch (e){
    try {
        ajax = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e){
        try {
            ajax = new ActiveXObject('Microsoft.XMLHTTP');
        } catch (e){
            ajaxSupported = false;
        }
    }
}

// trimite link-urile ajax catre calea normala
if(ajaxSupported == false) {
	document.cookie = 'iHaveAjax=false; expires=Thu, 01-Jan-1970 00:00:01 GMT;';
	//if(location.href.indexOf('/#') != -1) location.href = location.href.replace('/#', '/').replace(';', '?');
}
else
{
    if(!getCookie('iHaveAjax'))
    {
        document.cookie = 'iHaveAjax=true; expires=' + pestePaispeZile;
        location.reload();
    }
}
