javascript: var doc=document; if(window.frames.length>0)doc=window.main.document; url=doc.URL; var start; if (url.indexOf("t=") >= 0) start=url.indexOf("t="); else start=url.indexOf("village"); var end=url.indexOf('%26',start); var id; if(end>0) id=url.substring(start,end); else id=url.substring(start); if(url.indexOf('screen=market')==-1||url.indexOf('mode=own_offer')==-1) location.search='?screen=market&mode=own_offer&'+id; else {var wood=new Number(doc.getElementById('wood').innerHTML); var clay=new Number(doc.getElementById('stone').innerHTML); var iron=new Number(doc.getElementById('iron').innerHTML); var forms=doc.getElementsByTagName('form'); var table=""; for(i=0; i<forms.length&&table==""; i++) { if(forms[i].action.indexOf('action=modify_offers')!=-1) { table=forms[i].getElementsByTagName('table')[0]; } } for(i=1; table!=""&&i<table.rows.length-1; i++) { child=table.rows[i].cells[1].childNodes; res=child[0].title; num=""; for(j=0; j<child.length; j++) { value = child[j].nodeValue; if (value != null) num+=value; } num=num.substring(0,num.length-1); num*=new Number(table.rows[i].cells[2].innerHTML); if(res=='Wood')wood+=num; if(res=='Clay')clay+=num; if(res=='Iron')iron+=num; } doc.getElementById('res_sell_wood').checked=wood>clay&&wood>iron; doc.getElementById('res_sell_stone').checked=clay>wood&&clay>iron; doc.getElementById('res_sell_iron').checked=iron>clay&&iron>wood; doc.getElementById('res_buy_wood').checked=wood<clay&&wood<iron; doc.getElementById('res_buy_stone').checked=clay<wood&&clay<iron; doc.getElementById('res_buy_iron').checked=iron<clay&&iron<wood; wood=Math.round(wood/1000); clay=Math.round(clay/1000); iron=Math.round(iron/1000); offers=Math.max(Math.max(wood,clay),iron)-Math.min(Math.min(wood,clay),iron); offers=Math.round(offers/2); var handelsman = ''; var tbls = doc.getElementsByTagName('table'); for (i=0; i < tbls.length; i++) if (tbls[i].innerHTML.match(/Handelsmän: \d+\/\d+/) != null) handelsman = tbls[i].innerHTML.match(/Handelsmän: \d+\/\d+/); if (handelsman != ''){ handelsman = String(handelsman).match(/\d+/); if (offers > Number(String(handelsman))) offers = Number(String(handelsman)); } inputs=doc.getElementsByTagName('input'); for(i=0; i<inputs.length; i++) { if (inputs[i].value=='Skapa') inputs[i].focus(); } doc.getElementsByName('multi')[0].value=offers; doc.getElementsByName('max_time')[0].value=10; doc.getElementsByName('sell')[0].value=1000; doc.getElementsByName('buy')[0].value=1000; } end();