function loginPopup(mylink, windowname) {

		x = (640 - 530)/2, y = (480 - 300)/2;

		if (screen) {
			y = (screen.availHeight - 300)/2;
			x = (screen.availWidth - 530)/2;
		}
		x=x-250;
		y=y-100;
    
		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
			href=mylink;
		else
			href=mylink.href;
//		window.open(href, windowname, 'width=530,height=300,scrollbars=no,status=no,location=no,screenX='+x+',screenY='+y+',top='+y+',left='+x);
		window.open(href, windowname, 'width=720,height=410,scrollbars=no,status=no,location=no,screenX='+x+',screenY='+y+',top='+y+',left='+x);
		return false;

}

function loginPopupVoucherDeposit(mylink, windowname, fieldId) {

		x = (640 - 530)/2, y = (480 - 300)/2;

		if (screen) {
			y = (screen.availHeight - 300)/2;
			x = (screen.availWidth - 530)/2;
		}
		x=x-250;
		y=y-100;
    
		if (! window.focus)return true;
		var href;

		href=mylink.href+'?vouchercode='+document.getElementById(fieldId).value;
		window.open(href, windowname, 'width=720,height=410,scrollbars=no,status=no,location=no,screenX='+x+',screenY='+y+',top='+y+',left='+x);
		return false;

}

function buyPopup(mylink, windowname) {

		x = (640 - 530)/2, y = (480 - 300)/2;

		if (screen) {
			y = (screen.availHeight - 300)/2;
			x = (screen.availWidth - 530)/2;
		}
		x=x-250;
		y=y-100;
    
		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
			href=mylink;
		else
			href=mylink.href;
		window.open(href, windowname, 'width=720,height=410,scrollbars=no,status=no,location=no,screenX='+x+',screenY='+y+',top='+y+',left='+x);
		return false;

}


/*
function loginPopup(mylink, windowname, servlet) {
	var randomnumber=Math.floor(Math.random()*11);
	// servlet parameter's value is overwritten with window.location.hostname!! the parameter's value comes from config, thats not good
	//sprawdza czy jest sie zalogowanym
	servlet = "http://" + 'localhost:8080/cmp-era-www/main111/main.action';
	AJAX = getHTTPObject();
	
	if (AJAX) {
		AJAX.open("GET", servlet, false);                             
		AJAX.send(null);                             
	}

	if(!AJAX || AJAX.responseText != 'true')
	{
		x = (640 - 530)/2, y = (480 - 300)/2;

		if (screen) {
			y = (screen.availHeight - 300)/2;
			x = (screen.availWidth - 530)/2;
		}
    
		if (! window.focus)return true;
		var href;
		if (typeof(mylink) == 'string')
			href=mylink;
		else
			href=mylink.href;
		window.open(href, windowname, 'width=530,height=300,scrollbars=no,screenX='+x+',screenY='+y+',top='+y+',left='+x);
		return false;
	}
	else {
		return true;
	}
}

function loginNoPopup(mylink, windowname, servlet, orderLink) {
	var randomnumber=Math.floor(Math.random()*11);
	// servlet = "http://" + servlet + "?r=" + randomnumber;// follow the change in loginPopup
	servlet = "http://" + window.location.hostname + "/content/isloggedin?r=" + randomnumber;
	AJAX = getHTTPObject();
	
	if (AJAX) {
		AJAX.open("GET", servlet, false);                             
		AJAX.send(null);                             
	}

	if(!AJAX || AJAX.responseText != 'true')
	{
		x = (640 - 530)/2, y = (480 - 300)/2;

		if (screen) {
			y = (screen.availHeight - 300)/2;
			x = (screen.availWidth - 530)/2;
		}
    
		if (! window.focus)return true;
		window.resizeTo(530, 350);
		window.location=orderLink;
		return false;
	}
	else {
		opener.location=orderLink;
		window.close();
		return true;
	}
}

function getHTTPObject() { 
	if (typeof XMLHttpRequest != 'undefined') { 
		return new XMLHttpRequest(); 
	} 
	try { 
		return new ActiveXObject("Msxml2.XMLHTTP"); 
	} catch (e) { 
		try { 
			return new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (e) {} 
	} 
	return false; 
}

*/
