
var OP3 = (navigator.userAgent.indexOf("Opera/3") != -1) && (navigator.userAgent.indexOf("Mozilla/3") != -1);
var NN2 = (navigator.appName == "Netscape") && (navigator.userAgent.indexOf("Mozilla/2") != -1);
function popPlayerUp(URL) {
if (OP3) { alert('NOT COMPATIBLE WITH OPERA 3!'); } else {
indexvenster = window.open(URL, "player", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=305,height=410,left = 262,top = 134");
if (NN2) { indexvenster.opener = self; }}}

function popBigUp(URL) {
if (OP3) { alert('NOT COMPATIBLE WITH OPERA 3!'); } else {
indexvenster = window.open(URL, "background", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=525,height=525,left = 262,top = 134");
if (NN2) { indexvenster.opener = self; }}}

function popCombatArea(URL, BATID) {
if (OP3) { alert('NOT COMPATIBLE WITH OPERA 3!'); } else {
indexvenster = window.open(URL, BATID, "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=530,left = 262,top = 134");
if (NN2) { indexvenster.opener = self; }}}

function popCombatChat(URL) {
if (OP3) { alert('NOT COMPATIBLE WITH OPERA 3!'); } else {
indexvenster = window.open(URL, "clanbattleChat", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=200,height=100,left = 262,top = 134");
if (NN2) { indexvenster.opener = self; }}}

function VensterFocus() {
self.focus();
}

function linkBack(URL) { window.opener.location.href = URL; window.close(); }

function calcsell(orgaC,blooC,metaC,uranC,heatC,ratio) {
var orga=parseInt(document.Market.sellOrganics.value);
var bloo=parseInt(document.Market.sellBlood.value);
var meta=parseInt(document.Market.sellMetal.value);
var uran=parseInt(document.Market.sellUranium.value);
var heat=parseInt(document.Market.sellHeat.value);
o = orga-(orga / 100 * orgaC);
b = bloo-(bloo / 100 * blooC);
m = meta-(meta / 100 * metaC);
u = uran-(uran / 100 * uranC);
h = heat-(heat / 100 * heatC);
total = o+b+m+u+h;
total = Math.floor(total / ratio);
document.Market.sellGold.value=total; }

function calcbuy(orgaC,blooC,metaC,uranC,heatC,ratio) {
var orga=parseInt(document.Market.buyOrganics.value);
var bloo=parseInt(document.Market.buyBlood.value);
var meta=parseInt(document.Market.buyMetal.value);
var uran=parseInt(document.Market.buyUranium.value);
var heat=parseInt(document.Market.buyHeat.value);
o = orga+(orga / 100 * orgaC);
b = bloo+(bloo / 100 * blooC);
m = meta+(meta / 100 * metaC);
u = uran+(uran / 100 * uranC);
h = heat+(heat / 100 * heatC);
total = o+b+m+u+h;
total = Math.ceil(total / ratio)+1;
document.Market.buyGold.value=total; }

/***********************************************
* Textarea Maxlength script-  Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

function autoSelectDefenders (tform, crits)
{
	pint = 0;
	for (var i=0;i<crits;i++)
	{
		if (eval("document.f"+tform+".c"+i+".length") > (i+1))
		{
			eval("document.f"+tform+".c"+i+".selectedIndex="+(i+1));
			eval("document.f"+tform+".c"+i+".focus()");
		}
	}
}

function msgBox (textstring) {
alert (textstring) 
}
	
IE4 = document.all;

function newConfirm (title,mess,icon,defbut,mods,href) {
if (IE4) {
icon = (icon==0) ? 0 : 2;
defbut = (defbut==0) ? 0 : 1;
retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
retVal = (retVal==6);
}
else {
retVal = confirm(mess);
}

if (retVal == true) {

	document.location = href;

}

}
