var httpReq = false;
var httpReqG = false;
try {
	httpReq = new ActiveXObject(Msxml2.XMLHTTP);
	httpReqG = new ActiveXObject(Msxml2.XMLHTTP);
} catch(e) {
	try {
		httpReq = new ActiveXObject("Microsoft.XMLHTTP"); //IE
		httpReqG = new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} catch(E) {
		try {
			httpReq = new XMLHttpRequest();
			httpReqG = new XMLHttpRequest();
		} catch(E) {
			httpReq = false;
			httpReqG = false;
		}
	}
}


var isRequest = false;
var isRequestGallery = false;


function showImg( id )
{

	//zabezp przed double-clik
	if ( isRequestGallery ) {
		return false;
	}

	isRequestGallery = true;

	httpReqG.open("GET", "/blog_gallery_get_image.php?id="+id, true);
	httpReqG.onreadystatechange=function() {
		if(httpReqG.readyState == 4) {			
			document.getElementById( 'img-big' ).innerHTML = httpReqG.responseText;
			document.getElementById( 'show-link' ).style.display = 'none';
			isRequestGallery = false;

		}
	}
	
	httpReqG.send("");
}

function checkEmail()
{

	//zabezp przed double-clik
	if ( isRequest ) {
		return false;
	}
	isRequest = true;

	email = encodeURIComponent( document.getElementById( 'signup-input-text' ).value );

	httpReq.open("GET", "/blog_ajax_check_email.php?email="+email, true);
	httpReq.onreadystatechange=function() {
		if(httpReq.readyState == 4) {
		
			var responseText = httpReq.responseText;
			document.getElementById( 'signup_errorbox' ).style.visibility = 'visible';			
			document.getElementById( 'error-msg' ).innerHTML = responseText;
			
			//poprawne dopisanie do listy
			if ( responseText.charAt(0) == 'D' ) {
				pageTracker._trackPageview("/signup_ok");
			}
			
			
			isRequest = false;
			return false;
		}
	}
	
	httpReq.send("");
	return false;
}

function changeColor()
{
	//odblokowania zabezp przed double-click
	isRequest = false;

	if ( document.getElementById( 'signup-input-text' ).value == ' - twój email -' ) {
		document.getElementById( 'signup-input-text' ).value = '';
	}
	document.getElementById( 'signup-input-text' ).style.color = '#000000';
}
function closeErrorBox()
{
	document.getElementById( 'signup_errorbox' ).style.visibility = 'hidden';
}
