function swapClass(obj, cls) { 	obj.className = cls}

function OpenView(theURL,winName,features, myWidth, myHeight, isCenter) 
{
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function OtworzChat()
{
	var nazwa = 'View';
	var link = 'index.php?ident=chat';
	var opcje = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
	
	OpenView(link, nazwa, opcje ,'550' ,'400' ,'true');
}

function ChatZOperatorem()
{
	OpenView('/chat.html','chat','','549','387');
}

function SzukajDomene()
{
	if ( document.rejestracjaDomenSzukaj.action.value=='results' && document.rejestracjaDomenSzukaj.domainName.value.length == 0 )
	{
		alert('Nie podano nazwy domeny.\n\nWprowadź nazwę domeny i spróbuj ponownie.'); 
		return false;
	}

	return true;
}

function LogowanieSSL()
{
	var action = document.Logowanie.action;
    
	var urlhttps = 'https://www.etap.pl';
	var urlhttp = 'http://www.etap.pl';
	var urlhttps2 = 'https://etap.pl';
	var urlhttp2 = 'http://etap.pl';
    
	if (action.length < 10)	{ action = '/cgi-bin/isp.cgi'; }

	if ( action.indexOf(urlhttp,0) != -1 ) { action = action.substr( urlhttp.length,action.length );	}
	if ( action.indexOf(urlhttps,0) != -1 ) { action = action.substr( urlhttps.length,action.length );	}
	if ( action.indexOf(urlhttp2,0) != -1 ) { action = action.substr( urlhttp2.length,action.length );	}
	if ( action.indexOf(urlhttps2,0) != -1 ) { action = action.substr( urlhttps2.length,action.length );	}

	if (document.forms.Logowanie.ssl.checked ) 
	{
		action = 'https://www.etap.pl' + action;
		document.Logowanie.action = action;
	}
	else
	{
		action = 'http://www.etap.pl' + action;
		document.Logowanie.action = action;
	}
	
	
	return true;
}

function LogowanieSSLTest()
{
	var action = document.Logowanie.action;
	var urlhttps = 'https://www.etap.pl';
	var urlhttp = 'http://www.etap.pl';
    
	if (action.length < 10)	{ action = '/cgi-bin/isp.cgi'; }

	if ( action.indexOf(urlhttp,0) != -1 ) { action = action.substr( urlhttp.length,action.length );	}
	if ( action.indexOf(urlhttps,0) != -1 ) { action = action.substr( urlhttps.length,action.length );	}

	if (document.forms.Logowanie.ssl.checked ) {
		action = 'https://www.etap.pl' + action;
		document.Logowanie.action = action;
	} else {
		action = 'http://www.etap.pl' + action;
		document.Logowanie.action = action;
	}
	
	return true;
}
