e-sim IR

By Sahand.M Last update Dec 24, 2012 — Installed 4,001 times.

There are 35 previous versions of this script.

Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)

// ==UserScript==
// @name           e-sim IR
// @namespace      e-sim IR
// @include        http://*.e-sim.org*
// ==/UserScript==
//Persian translation by Sahand

menuLinkReplacements = {
	"work.html"				:["Work","کار"],
	"train.html"			:["Train","تمرين نظامي"],
	"companies.html"		:["Companies","کمپاني"],
	"newspaper.html"		:["Newspaper","روزنامه"],
	"myParty.html"			:["Party","حزب"],
	"contracts.html"		:["Contracts","قرارداد"],
	"inviteFriends.html"	:["Invite friends","دعوت دوستان"],
	"myMilitaryUnit.html"	:["Military unit","يگان نظامي"],
	"subscription.html"     :["Premium account","اشتراک"],
	
	"productMarket.html"	:["Product market","بازار محصولات"],
	"jobMarket.html"		:["Job market","بازار کار"],
	"monetaryMarket.html"	:["Monetary market","بازار ارز"],
	"companiesForSale.html"	:["Companies for sale","کمپاني براي فروش"],
	
	"countryStatistics.html"		:["Country statistics","آمار کشور"],
	"partyStatistics.html"			:["Party statistics","آمار حزب"],
	"newspaperStatistics.html"		:["Newspaper statistics","آمار روزنامه"],
	"citizenStatistics.html"		:["Citizen statistics","آمار شهروند"],
	"militaryUnitStatistics.html"	:["Military unit stats","آمار يگان نظامي"],
	"donations.html"                :["Donations","دوناتها"],
	
	"news.html\?newsType=TOP_ARTICLES"		:["Top articles","مقالات برتر"],
	"news.html\?newsType=LATEST_ARTICLES"	:["Latest articles","آخرين مقالات"],
	"news.html\?newsType=MILITARY_EVENTS"	:["Military events","اتفاقات نظامي"],
	"news.html\?newsType=POLITICAL_EVENTS"	:["Political events","اتفاقات سياسي"],
	
	"battles.html"							:["Battles","نبردها"],
	"countryPoliticalStatistics.html"		:["War and politics","جنگ و سياست"],
	"countryEconomyStatistics.html"			:["Economy","اقتصاد"],
	"countryLaws.html"						:["Laws","قوانين"],
	"partyElections.html"					:["Party elections","انتخابات احزاب"],
	"congressElections.html"				:["Congress elections","انتخابات مجلس"],
	"presidentalElections.html"				:["Presidential elections","انتخابات رياست جمهوري"],
	"pendingCitizenshipApplications.html"	:["Citizenship","مليت"],
	"googleMap.html"						:["Map","نقشه"],
};


menuTextReplacements = {
	"myPlacesButton":["My places","مکانهاي من"],
	"marketButton":["Market","بازار"],
	"statisticsButton":["Statistics","آمار"],
	"newsButton":["News","اخبار"],
	"electionsButton":["Country","کشور"]
};


sideLink1Replacements = {
	"crossIcon"	:["Logout","خروج"],
	"workIcon"	:["Work","کار"],
	"fightIcon"	:["Fight","جنگيدن"],
	"avatarIcon":["Upload avatar","آپلود عکس"],
	"voteIcon"	:["Vote","راي"],
};

sideLink2Replacements = {
	"travel.html"	:["Travel","سفر کردن"],
	"pendingCitizenshipApplications.html"	:["change","تغيير"],
	"http://wiki.e-sim.org/index.php/Health"	:["Health tutorial","آموزش سلامتي"],
};

sideLink3Replacements = {
	"eatLink"	:["Eat food","مصرف غذا"],
	"useGiftLink":["Use gifts","مصرف هديه"]
};

sideLink4Replacements = {
	"eatButton":["Eat Food","مصرف غذا"],
	"useGiftButton":["Use gift","مصرف هديه"] 
};


hpTitleReplacements = {
	"News":["News","اخبار"],
	"Shouts":["Shouts","Shouts"],
	"Battles":["Battles","نبردها"],
	"Events":["Events","اتفاقات"]
};


hpTabsReplacements = {
	"#topArticles":["Global","جهاني"],
	"#latestArticles":["Latest","آخرين"],
	"#localArticles":["Local","محلي"],
	
	"#countryShouts":["Country","کشور"],
	"#friendsShouts":["Military unit","يگان نظامي"],
	"#myShouts":["Friends","دوستان"],
	
	"#localBattles":["Country","کشور"],
	"#substidedBattles":["Subsidized","يارانه"],
	"#hotBattles":["Important","مهم"],

	"#localEvents":["Military","نظامي"],
	"#globalEvents":["Military","نظامي"],
	"#politicalEvents":["Political","سياسي"]
};

hpContentArticlesReplacements = {
	"topArticles":"",
	"latestArticles":"",
	"localArticles":""
};

hpContentShoutsReplacements = {
	"countryShouts":"",
	"friendsShouts":"",
	"myShouts":""
};

hpContentBattlesReplacements = {
	"localBattles":"",
	"substidedBattles":"",
	"hotBattles":""
};

hpContentEventsReplacements = {
	"localEvents":"",
	"globalEvents":"",
	"politicalEvents":""
};

MonetaryMarketRemplacement = {
	"http://wiki.e-sim.org/en/MonetaryMarket"	:["Monetary market tutorial","آموزش بازار ارز"],
};




//---------------------------------------------------
//FireFox
//---------------------------------------------------
var isFF = navigator.userAgent.toLowerCase().match("firefox") ? true : false;


function getElements(obj, k) {
	return document.evaluate(k, obj, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}

function replaceHerf(objs, replacements) {
	var obj;
	for (var i = 0; i < objs.snapshotLength; i++) {
		obj = objs.snapshotItem(i);
		for (k in replacements) {
			if (obj.href.match(k)) {
				obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
			}
		}
	}
}

function replaceInnerHTML(objs, replacements) {
	var obj;
	for (var i = 0; i < objs.snapshotLength; i++) {
		obj = objs.snapshotItem(i);
		for (k in replacements) {
			if (obj.innerHTML.match(k)) {
				obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
			}
		}
	}
}

function replaceInnerHTML2(replacements) {
	var obj;
	for (k in replacements) {
		obj = document.getElementById(k);
		obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
	}
}

function replaceCommon(objs, replacements, pre, aft) {
	for (k in replacements) {
		var results;
		results = getElements(objs, pre + k + aft);
		for (var i = 0; i < results.snapshotLength; i++) {
			var obj;
			obj = results.snapshotItem(i);
			obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
		}
	}
}

function replaceCommonSSS(objs, kk, replacements, pre, aft) {
	results = getElements(objs, pre + kk + aft);
//	alert(pre + kk + aft + "____" + results.snapshotLength);
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		for (k in replacements) {
			if (obj.innerHTML.match(k)) {
				obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
			}
		}
	}
}


function replaceSpanByClass(replacements) {
	replaceCommon(document, replacements, "//span[@class='", "']");
}


function replaceLinkByHref(replacements) {
	replaceCommon(document, replacements, "//a[@href='", "']");
}

function replaceLinkSSS(replacements) {
	replaceCommonSSS(document, "" ,replacements, "//a[@href", "]");
}

function replaceLinkByHrefSSS(kk, replacements) {
	replaceCommonSSS(document, kk, replacements, "//a[@href='", "']");
}

function replaceLinkByStyleSSS(kk, replacements) {
	replaceCommonSSS(document, kk, replacements, "//a[@style='", "']");
}


function replaceLinkByID(replacements) {
	replaceCommon(document, replacements, "//a[@id='", "']");
}


function replaceInputByID(replacements) {
	var obj;
	for (k in replacements) {
		obj = document.getElementById(k);
		obj.value = obj.value.replace(replacements[k][0], replacements[k][1]);
	}
}

function replaceInputByValue(replacements) {
	var objs, obj;
	for (k in replacements) {
		objs = getElements(document, "//input[@value='" + k + "']");
		for (var i = 0; i < objs.snapshotLength; i++) {
			obj = objs.snapshotItem(i);
			obj.value = obj.value.replace(replacements[k][0], replacements[k][1]);
		}
	}
}


function replaceInputByClassSSS(kk, replacements) {
	results = getElements(document, "//input[@class='" + kk + "']");
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		for (k in replacements) {
			if (obj.value.match(k)) {
				obj.value = obj.value.replace(replacements[k][0], replacements[k][1]);
			}
		}
	}
}

function replaceAlliesLinkComm(k) {
	var results;
	var obj;
	results = getElements(document, "//a[@class='" + k + "']");
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		obj.innerHTML = obj.innerHTML.replace(/(\d*)( allies)/,"$1 متحدان");
	}
}
function replaceAlliesLink() {
	replaceAlliesLinkComm("alliesLink");
}
function replaceAlliesLink2() {
	replaceAlliesLinkComm("alliesLink2");
}
function replaceNoAlliesComm(obj) {
	if (obj.innerHTML.match("no allies")) {
		obj=obj.childNodes[3];
		obj.nodeValue=obj.nodeValue.replace(/(no allies)/,"بدون متحد");
	}
}


function replaceAlliesLinksss() {
	results = getElements(document, "//div[@class='battleDiv']");
	for (var i = 0; i < results.snapshotLength; i++) {
		tmp=results.snapshotItem(i).children[0];
		replaceNoAlliesComm(tmp);
		tmp=results.snapshotItem(i).children[2];
		replaceNoAlliesComm(tmp);

		tmp=results.snapshotItem(i).children[3];
		tmp.innerHTML=tmp.innerHTML.replace(/(Resistance war)/,"انقلاب");
		tmp=results.snapshotItem(i).children[4];
		tmp.innerHTML=tmp.innerHTML.replace(/(Subsidies:)/,"يارانه ها:");
	}
}

function replaceBattleInfo(obj) {
	// no allies  
	obj.innerHTML=obj.innerHTML.replace(/(no allies)/g,"بدون متحد");
	//12 allies
	if (obj.innerHTML.match("1 ally")) {
	    obj.innerHTML=obj.innerHTML.replace(/(\d*)( allies)/g,"1 متحدان");
    } else {
        obj.innerHTML=obj.innerHTML.replace(/(\d*)( allies)/g,"$1  متحدان");
    }
	//Resistance war
	obj.innerHTML=obj.innerHTML.replace(/(Resistance war)/g,"انقلاب");
	//Subsidies:
	obj.innerHTML=obj.innerHTML.replace(/(Subsidies:)/g,"يارانه ها:");
}

//Test, other ways possible
function replaceBattleTime(obj) {
    if (obj.innerHTML.match(/[\d\.]+/g)== 1) {
        if (obj.innerHTML.match("second ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) second ago/g,"ثانيه پيش");
        } 
        if (obj.innerHTML.match("minute ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) minute ago/g,"دقيقه  پيش");
        }  
        if (obj.innerHTML.match("hour ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) hour ago/g,"ساعت پيش");
        }  
        if (obj.innerHTML.match("day ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) day ago/g,"ديروز");
        }  
        if (obj.innerHTML.match("month ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) month ago/g,"ماه پيش");
        }
    } else { 
        if (obj.innerHTML.match("seconds ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) seconds ago/g,"$1 ثاينه پيش");
        }  
        if (obj.innerHTML.match("minutes ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) minutes ago/g,"$1 دقيقه پيش");
        }  
        if (obj.innerHTML.match("hours ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) hours ago/g,"$1 ساعت پيش");
        }  
        if (obj.innerHTML.match("days ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) days ago/g,"$1 روز پيش");
        }  
        if (obj.innerHTML.match("months ago")) {
            obj.innerHTML = obj.innerHTML.replace(/(\d*) months ago/g,"$1 ماه\u0119cy پيش");
        }
    }
}
//---------------------------------------------------
//Top, Latest, Local Art
//---------------------------------------------------
function replacNewspaperTimeWithAuthor(obj) {
    if (obj.innerHTML.match("second ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) second ago by/g,"ثاينه پيش");
    } 
    if (obj.innerHTML.match("minute ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) minute ago by/g,"دقيقه پيش");
    }  
    if (obj.innerHTML.match("hour ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) hour ago by/g,"ساعت پيش");
    }  
    if (obj.innerHTML.match("day ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) day ago by/g,"ديروز");
    }  
    if (obj.innerHTML.match("month ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) month ago by/g,"ماه پيش");
    }
 
    if (obj.innerHTML.match("seconds ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) seconds ago by/g,"$2 ثاينه پيش");
    }  
    if (obj.innerHTML.match("minutes ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) minutes ago by/g,"$2 دقيقه پيش");
    }  
    if (obj.innerHTML.match("hours ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) hours ago by/g,"$2 ساعت پيش");
    }  
    if (obj.innerHTML.match("days ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) days ago by/g,"$2 روز پيش");
    }  
    if (obj.innerHTML.match("months ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*) months ago by/g,"$2 ماه\u0119cy پيش");
    }   
}

//---------------------------------------------------
//Subs 
//---------------------------------------------------
function replacNewspaperTime(obj) {
    if (obj.innerHTML.match("second ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( second ago)/g,"ثاينه پيش");
    }  
    if (obj.innerHTML.match("minute ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( minute ago)/g,"دقيقه پيش");
    }  
    if (obj.innerHTML.match("hour ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( hour ago)/g,"ساعت پيش");
    } 
    if (obj.innerHTML.match("day ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( day ago)/g,"ديروز");
    }  
    if (obj.innerHTML.match("month ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( month ago)/g,"ماه پيش");
    } 
    if (obj.innerHTML.match("seconds ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( seconds ago)/g,"$2 ثانيه پيش");
    }  
    if (obj.innerHTML.match("minutes ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( minutes ago)/g,"$2 دقيقه پيش");
    }  
    if (obj.innerHTML.match("hours ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( hours ago)/g,"$2 ساعت پيش");
    }  
    if (obj.innerHTML.match("days ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( days ago)/g,"$2 روز پيش");
    } 
    if (obj.innerHTML.match("months ago")) {
        obj.innerHTML = obj.innerHTML.replace(/(Posted )(\d*)( months ago)/g,"$2 ماه پيش");
    }
    
}


//---------------------------------------------------
//  battle Statistics
//---------------------------------------------------
function replaceBattleStatistics(obj) {
	obj.innerHTML=obj.innerHTML.replace(/(Recent)/g,"اخير");
	obj.innerHTML=obj.innerHTML.replace(/(defenders:)/,"مدافع:");
	obj.innerHTML=obj.innerHTML.replace(/(attackers:)/,"مهاجم:");
	obj.innerHTML=obj.innerHTML.replace(/(Current round statistics)/,"آمار اين راند");
	obj.innerHTML=obj.innerHTML.replace(/(Defenders' total damage:)/,"تخريب کل مدافعين:");
	obj.innerHTML=obj.innerHTML.replace(/(Attackers' total damage:)/,"تخريب کل مهاجمين:");
	obj.innerHTML=obj.innerHTML.replace(/(Your damage:)/,"تخريب شما:");
	obj.innerHTML=obj.innerHTML.replace(/(Top defending countries:)/,"برترين کشورهاي مدافع:");
	obj.innerHTML=obj.innerHTML.replace(/(Top attacking countries:)/,"برترين کشورهاي مهاجم:");
	obj.innerHTML=obj.innerHTML.replace(/(Top defending military units:)/,"برترين يگانهاي نظامي مدافع:");
	obj.innerHTML=obj.innerHTML.replace(/(Top attacking military units:)/,"برترين يگانهاي نظامي مهاجم:");
}





//---------------------------------------------------
//  Shouts
//---------------------------------------------------

//OK
function doShoutsComm() {
	results = getElements(document, "//b[@style='color: #222']");
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		if (obj.innerHTML.match(/[\d\.]+/g)== 1) {		
		    if (obj.innerHTML.match("second")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( second[s]* ago)/g,"ثانيه پيش");
		    } else if (obj.innerHTML.match("minute")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( minute[s]* ago)/g,"دقيقه پيش");
		    } else if (obj.innerHTML.match("hour")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( hour[s]* ago)/g,"ساعت پيش");
		    } else if (obj.innerHTML.match("day")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( day[s]* ago)/g,"ديروز");
		    } else if (obj.innerHTML.match("month")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( month[s]* ago)/g,"ماه پيش");
		    } 
	    } else {
            if (obj.innerHTML.match("seconds")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( second[s]* ago)/g,"$2 ثانيه پيش");
            } else if (obj.innerHTML.match("minutes")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( minute[s]* ago)/g,"$2 دقيقه پيش");
	        } else if (obj.innerHTML.match("hours")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( hour[s]* ago)/g,"$2 ساعت پيش");
	        } else if (obj.innerHTML.match("days")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( day[s]* ago)/g,"$2 روز پيش ");
	        } else if (obj.innerHTML.match("months")) {
			    obj.innerHTML = obj.innerHTML.replace(/(posted )(\d*)( month[s]* ago)/g,"$2 ماه پيش");
                } 
        }
    }
}
	    
replaceLinkByHrefSSS("#", {
    "Report":["Report","گزارش"],
    "Delete":["Delete","پاک کردن"],
    "Edit":["Edit","ويرايش"],
    "More shouts":["More shouts","شاتهاي بيشتر"]
});
	
	
replaceInputByValue({
    "Report":["Report","گزارش"],
    "Delete":["Delete","پاک کردن"],
    "Edit":["Edit","ويرايش"]
});	
	




//============================================================================
//Menu
//============================================================================
function doMenu() {
	replaceLinkByHref(menuLinkReplacements);
	replaceInnerHTML2(menuTextReplacements);
	allElements = document.getElementById('headerRow').children[2].children[0].children[0].children[1].children[1].children[3]
    allElements.innerHTML=allElements.innerHTML.replace(/day/,"روز")
}

//============================================================================
//Side
//============================================================================
function doSide() {
	var allElements;
	var tmp;
	
	allElements = document.getElementById('userMenu').children[0];
	
	tmp = allElements.children[2];
	tmp.innerHTML=tmp.innerHTML.replace(/(Level: )/,"سطح: ");
	tmp = allElements.children[7];
	tmp.innerHTML=tmp.innerHTML.replace(/(Rank:)/,"رنک:");
	tmp = allElements.children[10];
	tmp.innerHTML=tmp.innerHTML.replace(/(Next rank:)/,"رنک بعدی:");
	tmp = allElements.childNodes[25];
	tmp.nodeValue=tmp.nodeValue.replace(/(Economy skill:)/,"مهارت اقتصادی:");
	tmp = allElements.childNodes[29];
	tmp.nodeValue=tmp.nodeValue.replace(/(Strength:)/,"قدرت نظامی");
	tmp = allElements.childNodes[33];
	tmp.nodeValue=tmp.nodeValue.replace(/(Location:)/,"موقعیت:");
	tmp = allElements.childNodes[41];
	tmp.nodeValue=tmp.nodeValue.replace(/(Citizenship:)/,"ملیت:");
	tmp = allElements.childNodes[47];
	tmp.nodeValue=tmp.nodeValue.replace(/(Food limit:)/,"محدودیت غذا:");
	tmp = allElements.childNodes[55];
	tmp.nodeValue=tmp.nodeValue.replace(/(Gift limit:)/,"محدودیت هدیه:");


	allElements = document.getElementById('userMenu').children[2];
	allElements.innerHTML=allElements.innerHTML.replace(/(Your money)/,"پول");
	allElements.innerHTML=allElements.innerHTML.replace(/(Your inventory)/,"انبار");
	allElements = document.getElementById('userMenu').children[4];
	allElements.innerHTML=allElements.innerHTML.replace(/(Your messages)/,"پیامها");
	allElements = document.getElementById('contentRow').children[0].children[2];
	allElements.innerHTML=allElements.innerHTML.replace(/(Your today's tasks:)/,"وظایف امروز");
	
	
	replaceLinkByHref(sideLink2Replacements);
	
	replaceLinkByID(sideLink3Replacements);
	
	replaceInputByID(sideLink4Replacements);
	
	replaceSpanByClass(sideLink1Replacements);
	

	results = getElements(document, "//option[@value]");
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		if (obj.innerHTML.match("Current")) {
			obj.innerHTML=obj.innerHTML.replace(/(Current round)/,"راند جاری");
		} else if (obj.innerHTML.match("Round ")) {
			obj.innerHTML=obj.innerHTML.replace(/(Round )(\d*)/,"راند $2 ");
		} else if (obj.innerHTML.match("Food ")) {
			obj.innerHTML=obj.innerHTML.replace(/(Food type)/,"نوع غذا");
		} else if (obj.innerHTML.match("Gift ")) {
			obj.innerHTML=obj.innerHTML.replace(/(Gift type)/,"نوع هدیه");
		} else if (obj.innerHTML.match("Unarmed ")) {
			obj.innerHTML=obj.innerHTML.replace(/(Unarmed \()/,"بدون سلاح (");
		} else if (obj.innerHTML.match("Any quality")) {
			obj.innerHTML=obj.innerHTML.replace(/(Any quality)/,"هر کیفیتی");
		}
	}
}

//============================================================================
//Homepage
//============================================================================
function doHP() {
	//hp title
	replaceInnerHTML(getElements(document, "//div[@class='rightTabGrey']"), hpTitleReplacements);
	
	//index tabs
	replaceLinkByHref(hpTabsReplacements);
	
	//Articles content
	for (kk in hpContentArticlesReplacements) {
		allElements = document.getElementById(kk);
		replacNewspaperTimeWithAuthor(allElements);
	}

	replaceAlliesLink();
	replaceAlliesLink2();
	replaceAlliesLinksss();
	
	replaceLinkSSS({
		"Show more battles":["Show more battles","نمایش نبردهای بیشتر"],
		"Subsidies informations":["Subsidies informations","اطلاعات یارانه"]
	});
	//Battles content
	for (kk in hpContentBattlesReplacements) {
		allElements = document.getElementById(kk);
		
		if (allElements.innerHTML.match("No subsidized battles")) {
			allElements.innerHTML=allElements.innerHTML.replace(/(No subsidized battles)/,"بدون جنگ یارانه ای");
        }	
    }
	
	
	allElements = document.getElementById('contentRow').children[2].children[0];
	if (allElements.innerHTML.match("Your military unit orders:")) {
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/(Your military unit orders:)/,"فرمان نظامی ارتش شما :");
		tmp = allElements.children[3];
		tmp.innerHTML=tmp.innerHTML.replace(/(Fight for:)/,"بجنگ برای:");
	}
	
	//Events content
	for (kk in hpContentEventsReplacements) {
		allElements = document.getElementById(kk);	
        if (allElements.innerHTML.match("1 minute ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( minute ago)/g,"دقیقه پیش");
        }  
        if (allElements.innerHTML.match("1 hour ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( hour ago)/g," ساعت پیش");
        }  
        if (allElements.innerHTML.match("1 day ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( day ago)/g,"دیروز");
        }  
        if (allElements.innerHTML.match("1 month ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( month ago)/g,"ماه قبل");
        } 
        
        if (allElements.innerHTML.match("[^1] minutes ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( minutes ago)/g,"$1 دقیقه پیش");
        } 
        if (allElements.innerHTML.match("[^1] hours ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( hours ago)/g,"$1 ساعت پیش");
        }  
        if (allElements.innerHTML.match("[^1] days ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( days ago)/g,"$1 روز پیش");
        }  
        if (allElements.innerHTML.match("[^1] months ago")) {
            allElements.innerHTML = allElements.innerHTML.replace(/(\d*)( months ago)/g,"$1 ماه پیش");
        }
		
		//Bulgaria secured Sumadija in the battle versus Serbia
		allElements.innerHTML=allElements.innerHTML.replace(/( secured )([a-zA-Z- ]*)( in the battle versus )/g,"حفظ کرد $2 در جنگ با ");
		//People of started a resistance in Belgrade
		allElements.innerHTML=allElements.innerHTML.replace(/(People of )(<[^>]+>)(  started a resistance in )([^<]*)(<[^>]+>)/g,"مردم $2 انقلاب کردند در w $4 $5 ");
		//was attacked by Indonesia
		allElements.innerHTML=allElements.innerHTML.replace(/(was attacked by )([^<]*)(<[^>]+>)/g,"مورد حمله قرار گرفت توسط $2$3");
		//President of Poland proposed to declare war to Lithuania
		allElements.innerHTML=allElements.innerHTML.replace(/(President of )([^<]*)(<[^>]+>)([ ]*proposed to declare war to )([^<]*)(<[^>]+>)/g,"رییس جمهور $2$3 به مجلس پیشنهاد کرد جنگ با $5$6 ");
		//Poland  has declared war to Lithuania
		allElements.innerHTML=allElements.innerHTML.replace(/(has declared war to )([^<]*)(<[^>]+>)/g," اعلان جنگ کرد به $2$3 ");
		//Australia conquered Queensland in the battle versus Argentina 
		allElements.innerHTML=allElements.innerHTML.replace(/( conquered )([^<]*)( in the battle versus )/g," فتح کرد $2, در نبرد با ");
		allElements.innerHTML=allElements.innerHTML.replace(/(has new president)/g," رییس جمهور جدیدی دارد");
		
		//replaceInnerHTML(getElements(allElements, "//a[@href]"), { "Show more events":["Show more events","??????"] });
		allElements.innerHTML=allElements.innerHTML.replace(/(Show more events)/g,"نمایش وقایع");
	}
	
	//shouts
	allElements = document.getElementById("command");
	//Write a new shout:
	allElements.innerHTML=allElements.innerHTML.replace(/(Write a new shout:)/,"شات جدید بده:");
	//
	allDivs = getElements(allElements, "//input[@value='Shout!']");
	allDivs.snapshotItem(0).value="شات"
	//Send to channels: 
	if (isFF) {
		allElements.innerHTML=allElements.innerHTML.replace(/(Send to channels:)/,"بفرست به کانالهای :");
	} else {
		allElements.innerHTML=allElements.innerHTML.replace(/(Send to channels:)/,"بفرست به کانالهای :");
	}
	// - Country  -  Military Unit - Friends 
	allElements.innerHTML=allElements.innerHTML.replace(/(\- Country)([^\-]*)(\-  Military Unit)([^\-]*)(\- Friends)/," کشور | $2  یگان نظامی | $4 دوستان");

	
	doShoutsComm();
	
	replaceLinkByStyleSSS("font-weight: bold", { "More shouts":["More shouts","شات بیشتر"] });
}

//============================================================================
//Job Market
//============================================================================
function doJobMarket() {
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Job Market)/,"بازار کار ");
	
	tmp = allElements.children[2];
	tmp.innerHTML=tmp.innerHTML.replace(/(Selection criteria:)/,"معیار انتخاب:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Country:)/,"کشور:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Economic skill:)/,"مهارت اقتصادی:");
	
	tmp = allElements.children[5];
	tmp.innerHTML=tmp.innerHTML.replace(/(Employer)/,"کارفرما");
	tmp.innerHTML=tmp.innerHTML.replace(/(Company)/,"کمپانی");
	tmp.innerHTML=tmp.innerHTML.replace(/(Product)/,"محصول");
	tmp.innerHTML=tmp.innerHTML.replace(/(Minimal skill)/,"حداقل مهارت");
	tmp.innerHTML=tmp.innerHTML.replace(/(Salary)/,"حقوق");
	tmp.innerHTML=tmp.innerHTML.replace(/(Apply)/,"قبول");
	
	replaceInputByValue({"Apply":["Apply","قبول"],"Show":["Show","نمایش"]});
}

//============================================================================
//Work
//============================================================================
function doWork() {
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Work)/,"کار");
	
	if (allElements.innerHTML.match(/You have no job^\./)) {
		xxx = document.getElementById('command').parentNode.children[0];
		xxx.innerHTML=xxx.innerHTML.replace(/(You have no job)/,"شما شغلی ندارید");
		replaceInputByValue({"Get a job now!":["Get a job now!","شغلی پیدا کن !"]});
	} else if (allElements.innerHTML.match("Your workplace")) {
		idxoffset = 0;
		if (allElements.innerHTML.match("stay in a country")) {
			tmp = allElements.children[1];
			tmp.innerHTML=tmp.innerHTML.replace(/You need to stay in a country where company is located to work/,"شما باید برای کار کردن در کشوری باشید که کمپانی در آن قرار گرقته");
			idxoffset = 2;
		}
		
		tmp = allElements.children[1+idxoffset];
		tmp.innerHTML=tmp.innerHTML.replace(/(Your workplace)/,"محل کار");
		tmp.innerHTML=tmp.innerHTML.replace(/(Employer)/,"کارفرما");
		tmp.innerHTML=tmp.innerHTML.replace(/(Salary:)/,"حقوق:");
		tmp.innerHTML=tmp.innerHTML.replace(/(Leave job)/,"ترک کردن شغل");
		
		if (allElements.innerHTML.match("You have not worked today")) {
			xxx = document.getElementById('command').parentNode.children[0];
			xxx.innerHTML=xxx.innerHTML.replace(/(You have not worked today)/,"امروز هنوز کار نکرده اید");
			replaceInputByValue({"Work now":["Work now","کار کن"]});
		} else {
			tmp = allElements.children[4];
			tmp.innerHTML=tmp.innerHTML.replace(/(Today work results)/,"نتایج کار امروز");
			tmp.innerHTML=tmp.innerHTML.replace(/(Your Gross salary)/,"حقوق ناخالص شما");
			tmp.innerHTML=tmp.innerHTML.replace(/(Your Net salary)/,"حقوق خالص شما");
			tmp.innerHTML=tmp.innerHTML.replace(/(Income tax paid)/,"مالیات بر درآمد");
			tmp.innerHTML=tmp.innerHTML.replace(/(Worked at)/,"محل کار");
			tmp.innerHTML=tmp.innerHTML.replace(/(XP gained )/,"XP دریافتی");
			tmp.innerHTML=tmp.innerHTML.replace(/(Economy skill gained)/,"مهارت اقتصادی دریافتی");
			tmp.innerHTML=tmp.innerHTML.replace(/(Working days in a row)/,"تعداد روزی که پشت هم کار کرده اید");
			tmp.innerHTML=tmp.innerHTML.replace(/(Your base productivity)/,"تولید پایه");
			tmp.innerHTML=tmp.innerHTML.replace(/(Productivity modifiers)/,"تقویت کننده تولید");
			tmp.innerHTML=tmp.innerHTML.replace(/(Total productivity)/,"تولید کل");
			tmp.innerHTML=tmp.innerHTML.replace(/(Units produced)/,"تعداد محصول تولید شده");
			tmp.innerHTML=tmp.innerHTML.replace(/(Raw company quality)/,"کیفیت مواد کمپانی");
		}
	}
}


//============================================================================
//Product Markets
//============================================================================
function doProductMarkets() {
	rr = {
		"1":["Any","ههم"],
		"2":["Iron","آهن"],
		"3":["Grain","گندم"],
		"4":["Oil","آهن"],
		"5":["Stone","سنگ"],
		"6":["Wood","چوب"],
		"7":["Diam.","الماس"],
		"8":["Weap.","اسلحه"],
		"9":["House","خانه"],
		"10":["Gift","هدیه"],
		"11":["Food","غذا"],
		"12":["Ticket","بلیط"],
		"13":["DS","سیستم دفاعی"],
		"14":["Hosp.","بیمارستان"]
	};
	
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Marketplace)/,"بازار محصولات");
	
	tmp = allElements.children[2];
	tmp.innerHTML=tmp.innerHTML.replace("Show Offers:","نمایش پیشنهادات:");
	tmp.innerHTML=tmp.innerHTML.replace("Country:","کشور:");
	tmp.innerHTML=tmp.innerHTML.replace("Quality:","کیفیت:");
	
	replaceInputByValue({"View offers":["View offers","مشاهده"],"Buy":["Buy","خرید"]});
	
	results = getElements(document, "//label[@for]");
	for (var i = 0; i < results.snapshotLength; i++) {
		obj = results.snapshotItem(i);
		
		if (obj.htmlFor.match("resource")) {
			idx = obj.htmlFor.substring(8,obj.htmlFor.length);
			obj.innerHTML = obj.innerHTML.replace(rr[idx][0], rr[idx][1]);
		}
	}
	replaceLinkByHrefSSS("citizenMarketOffers.html", {"Show my offers":["Show my offers/post new offer","نمایش پیشنهادات من / پیشنهاد جدید دادن"]})
	
	tmp = allElements.children[5];
	tmp.innerHTML=tmp.innerHTML.replace(/(Product)/,"محصول");
	tmp.innerHTML=tmp.innerHTML.replace(/(Seller)/,"فروشنده");
	tmp.innerHTML=tmp.innerHTML.replace(/(Stock)/,"موجودی");
	tmp.innerHTML=tmp.innerHTML.replace(/(Price)/,"قیمت");
	tmp.innerHTML=tmp.innerHTML.replace(/(Buy)/,"خرید");
	tmp.innerHTML=tmp.innerHTML.replace(/( items )/g," تعداد "); 
// check	
	replaceLinkByHref({
		"citizenMarketOffers.html":["Show my offers/post new offer","نمایش پیشنهادات من / پیشنهاد جدید دادن"],
		"http://wiki.e-sim.org/en/Category:Products":["Products info","اطلاعات محصولات"]
	});
}

//============================================================================
//Train
//============================================================================
function doTrain() {
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Military training)/,"تمرین نظامی");
	
	tmp = allElements.children[1];
	var rowoffset = 0;
	//not train
	if (tmp.innerHTML.match("Training complete. Please come back tomorrow")) {
		replaceInputByValue({"Train":["Train","تمرین"]});
		tmp.innerHTML=tmp.innerHTML.replace(/(Training complete. Please come back tomorrow)/,"تمرین تموم شد ! فردا برگرد");
		rowoffset = 2;
	//already trained
	} else if (tmp.innerHTML.match("You have already trained today^\.")) {
		tmp.innerHTML=tmp.innerHTML.replace(/(You have already trained today)/,"شما یکبار امروز تمرین کرده اید");
		rowoffset = 2;
	}
	
	tmp = allElements.children[1+rowoffset];
	tmp.innerHTML=tmp.innerHTML.replace(/(You have already trained today. Please come back tomorrow.)/,"امروز یه بار تمرین کردی. فردا برگرد");
	tmp.innerHTML=tmp.innerHTML.replace(/(Strength gained:)/,"قدرت نظامی دریافتی:");
	
	tmp = allElements.children[4+rowoffset];
	tmp.innerHTML=tmp.innerHTML.replace(/(Military details)/,"اطلاعات نظامی");
	tmp.innerHTML=tmp.innerHTML.replace(/(Total training sessions:)/,"تعداد کل تمرینات:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Strength:)/,"قدرت نظامی:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Military rank:)/,"رنک نظامی:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Total damage done:)/,"کل تخریب:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with no weapon:)/,"تخریب بدون سلاح:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with Q1 weapon:)/,"تخریب با Q1:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with Q2 weapon:)/,"تخریب با Q2:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with Q3 weapon:)/,"تخریب با Q3:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with Q4 weapon:)/,"تخریب با Q4:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Damage with Q5 weapon:)/,"تخریب با Q5:");
	
}

//===========================================================================
//Battles List 
//============================================================================
function doBattlesList() {
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Battles)/,"نبردها");
	
	tmp = allElements.children[1];
	tmp.innerHTML=tmp.innerHTML.replace(/(Country)/,"کشور");
	tmp.innerHTML=tmp.innerHTML.replace(/(Sorting:)/,"مرتب بر اساس:");
	tmp.innerHTML=tmp.innerHTML.replace(/(Only subsidized Battles:)/,"فقط نبردهای پولی:");
	
	replaceInputByValue({"Show battles":["Show battles","نمایش نبردها"]});
	
    tmp = allElements.children[4].children[0].children[0]
    var loopz = tmp.children.length
    for (i = 1; i < loopz; i++) {
        obj = tmp.children[i].children[3];
        replaceBattleTime(obj);
    }
	
	allElements = document.getElementById('battlesTable');
	tmp = allElements.children[0].children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Battle start)/,"Pocz\u0105tek");
	tmp.innerHTML=tmp.innerHTML.replace(/(Battle)/,"نبرد");
	tmp.innerHTML=tmp.innerHTML.replace(/(defender vs attacker)/,"مهاجم در مقابل با مدافع");
	tmp.innerHTML=tmp.innerHTML.replace(/(Score)/,"امتیاز");
	tmp.innerHTML=tmp.innerHTML.replace(/(Total damage done)/,"کل تخریب زده شده");
	
	

	replaceAlliesLink();
	replaceAlliesLink2();
	replaceAlliesLinksss();
	
}

//============================================================================
//Battle 
//============================================================================
function doBattle() {
	allElements = document.getElementById('battleBar').parentNode;
	tmp = allElements.children[2];
	tmp.innerHTML=tmp.innerHTML.replace(/(Resistance war)/,"انقلاب");
	tmp.innerHTML=tmp.innerHTML.replace(/(started by)/,"شروع شده توسط");
	
	tmp = allElements.children[4];
	replaceNoAlliesComm(allElements.children[4]);
	replaceNoAlliesComm(allElements.children[7]);
	replaceAlliesLink();
	
	tmp = allElements.children[6].children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Round )(\d*)/,"راند $2");
	
	tmp = allElements.children[11];
	tmp.innerHTML=tmp.innerHTML.replace(/(Rounds won by defender)/,"راندهای پیروز شدع توسط مدافع");
	tmp = allElements.children[12];
	tmp.innerHTML=tmp.innerHTML.replace(/(Rounds won by attacker)/,"راندهای پیروز شده توسط مهاجم");	

	//+++++++++++++++++++++++++++++++++++++++++++++++++++
	// Top3
	//+++++++++++++++++++++++++++++++++++++++++++++++++++
	tmp = document.getElementById('topDefender1').parentNode.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Top defenders)/,"Najlepsi obro\u0144cy");
	tmp = document.getElementById('topAttacker1').parentNode.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/(Top attackers)/,"Najlepsi napastnicy");
	allElements = document.getElementById('contentRow').children[1].children[3].children[0].children[0].children[1].children[0];

	if (allElements.innerHTML.match("occupant country to")) {
		allElements.innerHTML=allElements.innerHTML.replace(/(You can't fight in this battle from your current location.)/,"از موقعیت فعلی خود نمیتوانید در این جنگ بجنگید");
		allElements.innerHTML=allElements.innerHTML.replace(/(You must travel to the occupant country to participate in the battle.)/,"برای شرکت در جنگ باید به یکی از کشورهای درگیر جنگ سفر کنی");
	} else if (allElements.innerHTML.match("countries participating")) {
		allElements.innerHTML=allElements.innerHTML.replace(/(You can't fight in this battle from your current location.)/,"از موقعیت فعلی خود نمیتوانید در این جنگ بجنگید");
		allElements.innerHTML=allElements.innerHTML.replace(/(You must travel to one of the countries participating in the battle.)/,"برای شرکت در جنگ باید به یکی از کشورهای درگیر جنگ سفر کنی ");
	} else if (allElements.innerHTML.match("was won by")) {
		allElements.innerHTML=allElements.innerHTML.replace(/(This round was won by:)/g,"این راند گرفته شده توسط :");
	} else {
		tmp = allElements.children[1];
		tmp.innerHTML=tmp.innerHTML.replace(/(Select weapon:)/,"انتخاب اسلحه:");
		tmp = allElements.children[5];
		tmp.innerHTML=tmp.innerHTML.replace(/(Select your side:)/,"انتخاب سمت:");
		tmp.innerHTML=tmp.innerHTML.replace(/(Your fighting side:)/,"سمتی که میجنگی:");
	}
	
	
	if (isFF) {
		allElements.innerHTML=allElements.innerHTML.replace(/(Show round:)/,"Poka\u017C rund\u0119:");
	}
	replaceInputByValue({"Show round":["Show round","نمایش راند"]});
	tmp = document.getElementById('contentRow').children[1].children[4];
	replaceBattleStatistics(tmp);
	tmp.innerHTML=tmp.innerHTML.replace(/(Show overall battle stats)/,"نمایش آمار کلی جنگ");
	tmp.innerHTML=tmp.innerHTML.replace(/(Fighting tutorial on wiki)/,"آموزش جنگیدن");
	tmp.innerHTML=tmp.innerHTML.replace(/(Battle rules)/,"قوانین نبرد");
	
	}
	
//============================================================================
//Battle Statistics 
//============================================================================
function doBattleStatistics() {
	var allElements;
	allElements = document.getElementById('contentRow').children[1];
	
	var tmp;
	tmp = allElements.children[0];
	replaceBattleInfo(tmp);
	tmp.innerHTML=tmp.innerHTML.replace(/(started by)/,"شروع شده توسط");
	tmp.innerHTML=tmp.innerHTML.replace(/(Round )(\d*)/,"راند $2 ");
	tmp.innerHTML=tmp.innerHTML.replace(/(Rounds won by defender)/,"راند گرفته شده توسط مدافع");
	tmp.innerHTML=tmp.innerHTML.replace(/(Rounds won by attacker)/,"راند گرفته شده توسط مهاجم");
	tmp.innerHTML=tmp.innerHTML.replace(/(Back to battle)/,"برگشت به صفحه جنگ");
	
	tmp = allElements.children[3];
	replaceBattleStatistics(tmp);
	tmp.innerHTML=tmp.innerHTML.replace(/(Statistics are generated once per 30 minutes)/,"Sahand ترجمه شده توسط");
	tmp.innerHTML=tmp.innerHTML.replace(/Battle statistics/,"آمار جنگ");
}


//============================================================================
//Profile
//============================================================================
function doProfile() {
	allElements = document.getElementById('contentRow').children[1];
	
	//name
	tmp = allElements.children[0].children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Citizen /,"شهروند ");
	//on-off line
	tmp = allElements.children[0].children[1];
	if (tmp.innerHTML.match("Online")) {
		tmp.innerHTML=tmp.innerHTML.replace(/Online/,"آنلاین ");
	} else {
		tmp.innerHTML=tmp.innerHTML.replace(/Offline/,"آفلاین");
	}
	
	replaceLinkByHrefSSS("editCitizen.html", {
		"Edit profile":["Edit profile","ویرایش پروفایل"]
	});
	replaceLinkByHrefSSS("changeName.html", {
		"Change name":["Change name","تغییر نام"]
	});
	replaceLinkByHrefSSS("transactionLog.html", {
		"Transactions log":["Transactions log","انتقالات"]
	});
	replaceLinkByHrefSSS("#", {
		"Report multi":["Report multi","گزارش مولتی"]
	});
	replaceInputByValue({"Report multi":["Report multi","گزارش مولتی"]});

	
	allElements = allElements.children[2].children[0].children[0];
	tmp = allElements.children[0].children[0];
	rowoffset = 0;
	if (tmp.innerHTML.match("Permanently")) {
		rowoffset = 2;
		tmp.innerHTML=tmp.innerHTML.replace(/Permanently banned/,"بن دائمی");
		tmp.innerHTML=tmp.innerHTML.replace(/Reason:/,"علت:");
		tmp.innerHTML=tmp.innerHTML.replace(/Banned by:/,"بن شده توسط :");
	}
	

	tmp = allElements.children[0].children[2+rowoffset];
	tmp.innerHTML=tmp.innerHTML.replace(/Level:/,"سطح:");
	tmp.innerHTML=tmp.innerHTML.replace(/XP:/,"XP:");
	tmp.innerHTML=tmp.innerHTML.replace(/Damage:/,"تخریب:");
	tmp.innerHTML=tmp.innerHTML.replace(/Rank:/,"رنک:");
	tmp.innerHTML=tmp.innerHTML.replace(/Economy skill:/,"مهارت اقتصادی:");
	tmp.innerHTML=tmp.innerHTML.replace(/Strength:/,"قدرت نظامی:");
	tmp.innerHTML=tmp.innerHTML.replace(/Location:/,"موقعیت:");
	tmp.innerHTML=tmp.innerHTML.replace(/Citizenship:/,"ملیت:");
	tmp.innerHTML=tmp.innerHTML.replace(/Birthday:/,"روز تولد در بازی:");
	
	tmp.innerHTML=tmp.innerHTML.replace(/National rank by XP:/,"رنک ملی بر اساس XP:");
	tmp.innerHTML=tmp.innerHTML.replace(/National rank by damage:/,"رنک ملی براساس تخریب:");
	tmp.innerHTML=tmp.innerHTML.replace(/Global rank by XP:/,"رنک جهانی بر اساس XP:");
	tmp.innerHTML=tmp.innerHTML.replace(/Global rank by damage:/,"رنک جهانی براساس تخریب");
	
	tmp = allElements.children[0].children[5+rowoffset];
	tmp.innerHTML=tmp.innerHTML.replace(/Military unit:/,"یگان نظامی");
	tmp.innerHTML=tmp.innerHTML.replace(/Party:/,"حزب");
	tmp.innerHTML=tmp.innerHTML.replace(/Newspaper:/,"روزنامه");
	tmp.innerHTML=tmp.innerHTML.replace(/Working at:/,"محل کار");
	tmp.innerHTML=tmp.innerHTML.replace(/Owned companies/,"کمپانی ها");
	tmp.innerHTML=tmp.innerHTML.replace(/Political office:/,"مقام سیاسی");
	//no
	tmp.innerHTML=tmp.innerHTML.replace(/No military unit/,"بدون واحد نظامی");
	tmp.innerHTML=tmp.innerHTML.replace(/No party/,"بدون حزب");
	tmp.innerHTML=tmp.innerHTML.replace(/No newspaper/,"بدون روزنامه");
	tmp.innerHTML=tmp.innerHTML.replace(/No work/,"بیکار");
	tmp.innerHTML=tmp.innerHTML.replace(/No companies/,"بدون کمپانی");
	tmp.innerHTML=tmp.innerHTML.replace(/No office/,"بدون مقام");
	
	allElements = getElements(document, "//ul[@style]");
	
	rowoffset = 0;
	if (allElements.snapshotLength > 0) {
		tmp = allElements.snapshotItem(0).parentNode;
		if (tmp.innerHTML.match("Active debts")) {
			rowoffset = 2;
			tmp.innerHTML=tmp.innerHTML.replace(/Active debts/,"بدهی");
			tmp.innerHTML=tmp.innerHTML.replace(/(payback time )/g,"زمان پرداخت");
			tmp.innerHTML=tmp.innerHTML.replace(/(\d*)( game day)/g," $1");
		}
	}
	
	allElements = document.getElementById('medals');
	tmp = allElements.parentNode.nextElementSibling.nextElementSibling.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Friends/,"دوستان");
	tmp = allElements.parentNode.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling;
	tmp.innerHTML = tmp.innerHTML.replace(/Total achievements/,"همه دستاوردها")
	tmp = allElements.parentNode.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Top achievements/,"دستاوردهای برتر");
	replaceLinkByHref({"achievement.html?type=DONATOR":["donor achievement","osi\u0105gni\u0119cie 'Donor'"]});
	replaceLinkSSS({
		"See all achievements":["See all achievements","دیدن همه دستاوردها"]
	});
	
	doShoutsComm();
	
}


//============================================================================
//Edit Citizen
//============================================================================
function doEditCitizen() {
	allElements = document.getElementById('editCitizenForm');
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Mail:/,"Email:");
	tmp = allElements.children[4];
	tmp.innerHTML=tmp.innerHTML.replace(/New password:/,"پسورد جدید:");
	tmp = allElements.children[8];
	tmp.innerHTML=tmp.innerHTML.replace(/New password repeat:/,"تکرار پسورد جدید:");
	tmp = allElements.children[12];
	tmp.innerHTML=tmp.innerHTML.replace(/Old password:/,"پسورد قدیمی :");
	tmp = allElements.children[16];
	tmp.innerHTML=tmp.innerHTML.replace(/New avatar:/,"آواتار جدید:");
	tmp = allElements.childNodes[30];
	tmp.nodeValue=tmp.nodeValue.replace("max. size","max. سایز; :");
	
    allElements = document.getElementsByTagName('TD');
    tmp = allElements[19]
	tmp.innerHTML=tmp.innerHTML.replace(/Citizen/,"شهروند");
	replaceInputByValue({"Edit citizen":["Edit citizen","ویرایش شهروند"]});
}

//============================================================================
//Travel
//============================================================================
function doTravel() {
	allElements = document.getElementById('contentRow').children[1];
	
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Travel/,"سفر کردن");
	
	allElements = document.getElementById('citizenTravelForm');
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Country/,"کشور");
	tmp = allElements.children[4];
	tmp.innerHTML=tmp.innerHTML.replace(/Region:/,"منطقه:");
	tmp = allElements.children[8];
	tmp.innerHTML=tmp.innerHTML.replace(/Ticket Quality:/,"کیفیت بلیط:");
	
	replaceInputByValue({"Travel":["Travel","سفر"]});
	
	replaceLinkByHref({
		"http://wiki.e-sim.org/en/Traveling":["Traveling tutorial on wiki","آموزش سفر کردن"]
	});
}


//============================================================================
//Inbox Messages
//============================================================================
function doMessagesComm() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[1];
	tmp.innerHTML=tmp.innerHTML.replace(/Messages from/,"پیام از طرف: ");
	tmp.innerHTML=tmp.innerHTML.replace(/Sent messages/," پیامهای فرستاده شده : ");
	allElements = document.getElementById('inboxTable').children[0];
	
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Author/,"نویسنده");
	tmp.innerHTML=tmp.innerHTML.replace(/Message/,"پیام");
	tmp.innerHTML=tmp.innerHTML.replace(/Date/,"تاریخ");
	tmp.innerHTML=tmp.innerHTML.replace(/Remove/,"حذف");
	tmp.innerHTML=tmp.innerHTML.replace(/To/,"به");
	
	tmp = allElements;
	for (i = 1; i < tmp.children.length - 1; i++) {
		replaceBattleTime(tmp.children[i].children[2]);
	}
}

function doInboxMessages() {
	doMessagesComm();

	replaceLinkByHref({
		"sentMessages.html":["Sent messages","پیام فرستاده شده"],
		"composeMessage.html":["Compose message","نوشتن پیام"]
	});
	replaceInputByValue({
		"Delete":["Delete","پاک کردن"],
		"Quick reply":["Quick reply","پاسخ سریع"],
		"Report":["Report","گزارش"]
	});
	replaceLinkByHrefSSS("#", {
		"Report":["Report","گزارش"],
		"Quick reply":["Quick reply","پاسخ سریع"]
	});
	replaceHerf(getElements(document, "//a[@href]"), {
		"composeMessage.html":["Reply","پاسخ"],
		"conversation.html":["Previous messages","پیامهای قبلی"]
	});
	
}

//============================================================================
//Sent Messages
//============================================================================
function doSentMessages() {
	doMessagesComm();
	replaceLinkByHref({
		"inboxMessages.html":["Inbox messages","پیامها"],
		"composeMessage.html":["Compose Message","نوشتن پیام"]
	});
}

//============================================================================
//Compose Message
//============================================================================
function doComposeMessage() {
	allElements = document.getElementById('contentRow').children[1];
	
	tmp = allElements.children[1];
	tmp.innerHTML=tmp.innerHTML.replace(/New message/,"پیام جدید");

	replaceLinkByHref({
		"inboxMessages.html":["Inbox messages","اینباکس"],
		"sentMessages.html":["Sent messages","پیامهای فرستاده شده"]
	});
	
	allElements = document.getElementById('sendMessageForm');
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Receiver:/,"دریافت کننده:");
	tmp = allElements.children[2];
	tmp.innerHTML=tmp.innerHTML.replace(/Title:/,"عنوان:");
	tmp = allElements.children[6];
	tmp.innerHTML=tmp.innerHTML.replace(/Message:/,"پیام:");
	
	replaceInputByValue({
		"Send":["Send","فرستادن"],
		"Preview":["Preview","مشاهده"]
	});
}


//============================================================================
//Subscriptions
//============================================================================
function doSubs() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Subscriptions/,"اشتراکها");
	
	results = getElements(document, "//table[@class='dataTable']");
	if (results.snapshotLength > 0) {
		obj = results.snapshotItem(0);
		
		obj.innerHTML=obj.innerHTML.replace(/Subscriptions/,"اشتراکها");
		
		replacNewspaperTime(obj);
	}

	replaceLinkByHref({
		"subscribedNewspapers.html":["List of subscribed newspapers","لیست روزنامه های مشترک شده"]
	});
}

//============================================================================
//Subscribed Newspapers
//============================================================================
function doSubscribedNewspapers() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Subscribed newspapers/,"روزنامه های مشترک شده");
	
	results = getElements(document, "//table[@class='dataTable']");
	if (results.snapshotLength > 0) {
		allElements = results.snapshotItem(0).children[0];
		
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Total subs/,"مجموع اشتراک");
		tmp.innerHTML=tmp.innerHTML.replace(/Newspaper/,"روزنامه");
		tmp.innerHTML=tmp.innerHTML.replace(/Sub\. time/,"زمان اشتراک");
		
		tmp = allElements;
		for (i = 1; i < tmp.children.length; i++) {
			replaceBattleTime(tmp.children[i].children[2]);
		}
	}
	
	replaceLinkByHref({
		"http://wiki.e-sim.org/en/Newspaper":["Newspaper tutorial on wiki","آموزش روزنامه"]
	});
}

//============================================================================
//Newspaper
//============================================================================
function doNewspaper() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Newspaper/,"روزنامه");
	
	results = getElements(document, "//table[@class='dataTable']");
	if (results.snapshotLength > 0) {
		allElements = results.snapshotItem(0).children[0];
		
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Recent articles/,"مقالات اخیر");
		replacNewspaperTime(allElements);
	}
	
	replaceLinkByHref({
		"editNewspaper.html":["Edit newspaper","ویرایش روزنامه"],
		"http://wiki.e-sim.org/en/Newspaper":["Newspaper tutorial on wiki","آموزش روزنامه"]
	});
	replaceInputByValue({
		"Publish":["Publish","انتشار"],
		"Preview":["Preview","مشاهده"]
	});
	
	//my newspaper
	allElements = document.getElementById('writeArticleForm');
	if (allElements) {
		tmp = allElements.parentNode.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Write new article/,"نوشتن مقاله جدید");
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Publish in country/,"چاپ کردن در کشور");
		tmp = allElements.children[4];
		tmp.innerHTML=tmp.innerHTML.replace(/Article title:/,"عنوان مقاله :");
		tmp = allElements.children[10];
		tmp.innerHTML=tmp.innerHTML.replace(/Message:/,"پیام :");
		tmp = allElements.children[allElements.children.length-1];
		tmp.innerHTML=tmp.innerHTML.replace(/Please save a copy of your article on a hard disc before submitting it/,"برای حمایت از کار ترجمه مشترک این روزنامه بشید : http://e-sim.org/newspaper.html?id=489");
	}
}

//============================================================================
//Edit Newspaper
//============================================================================
function doNewspaperEdit() {
	allElements = document.getElementById('editNewspaperForm');
	
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Newspaper name:/,"نام روزنامه:");
	tmp = allElements.children[4];
	tmp.innerHTML=tmp.innerHTML.replace(/New avatar:/,"آواتر جدید:");
	tmp = allElements.childNodes[9];
	tmp.nodeValue=tmp.nodeValue.replace("max. size","max. سایز; :");
	
	replaceLinkByHref({
		"editNewspaper.html":["Edit newspaper","ویرایش روزنامه"]
	});
	replaceInputByValue({
		"Delete":["Edit newspaper","ویرایش روزنامه"]
	});
}

//============================================================================
//Article
//============================================================================
function doArticle() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Article/,"مقاله");
	
	replaceHerf(getElements(document, "//a[@href]"), {
		"editArticle.html":["Edit article","ویرایش مقاله"]
	});
	replaceLinkByHref({
		"editNewspaper.html":["Edit newspaper","ویرایش روزنامه"]
	});
	replaceLinkByHrefSSS("#", {
		"Report":["Report","گزارش"],
		"Edit":["Edit","ویرایش"],
		"Delete":["Delete","حذف"]
	});
	replaceInputByValue({
		"Publish":["Publish","انتشار"],
		"Report":["Report","گزارش"],
		"Edit":["Edit","ویرایش"],
		"Delete":["Delete","حذف"]
	});
	
	allElements = document.getElementById('command');
	tmp = allElements.parentNode.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/New comment/,"نظر جدید");
	
	tmp = allElements.children[1];
	tmp.innerHTML=tmp.innerHTML.replace(/Message:/,"پیام:");
}

//============================================================================
//Edit Article
//============================================================================
function doArticleEdit() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Newspaper/,"روزنامه");
	
	allElements = document.getElementById('command');
	tmp = allElements.parentNode.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Edit article/,"ویرایش روزنامه");
	tmp = allElements.children[1];
	tmp.innerHTML=tmp.innerHTML.replace(/Article title:/,"عنوان مقاله:");
	tmp = allElements.children[6];
	tmp.innerHTML=tmp.innerHTML.replace(/Message:/,"پیام:");
	
	replaceLinkByHref({
		"editNewspaper.html":["Edit newspaper","ویرایش روزنامه"],
		"http://wiki.e-sim.org/en/Newspaper":["Newspaper tutorial on wiki","آموزش روزنامه"]
	});
	replaceInputByValue({
		"Edit article":["Edit article","ویرایش مقاله"]
	});
}

//============================================================================
//Contracts List
//============================================================================
function doContractsList() {
	allElements = document.getElementById('contentRow').children[1];
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Contracts/,"قرارداد");
	
	tmp = allElements.children[2].children[4];
	tmp.innerHTML=tmp.innerHTML.replace(/Templates/,"مدل");
	tmp = allElements.children[4];
	tmp.innerHTML=tmp.innerHTML.replace("Proposed contracts (latest 20)","بیست قرارداد آخر");
	tmp.innerHTML=tmp.innerHTML.replace(/offered to/g,"پیشنهاد شده به ");
	tmp.innerHTML=tmp.innerHTML.replace(/No contracts/,"بدون قراداد");
	tmp = allElements.children[6];
	tmp.innerHTML=tmp.innerHTML.replace("Accepted contracts (latest 20)","قراردادهای قبول شده");
	tmp.innerHTML=tmp.innerHTML.replace(/offered to/g,"پیشنهاد شده به");
	tmp.innerHTML=tmp.innerHTML.replace(/No contracts/,"بدون قرارداد");
	tmp = allElements.children[8];
	tmp.innerHTML=tmp.innerHTML.replace("Rejected contracts","قراردادهای رد شده");
	tmp.innerHTML=tmp.innerHTML.replace(/Rejected by( <img.*<a.*a>)/g,"رد شده توسط $1");
	tmp.innerHTML=tmp.innerHTML.replace(/No contracts/,"بدون قرارداد");
	tmp = allElements.children[10];
	tmp.innerHTML=tmp.innerHTML.replace("Failed contracts","قراردادهای ناموفق");
	tmp.innerHTML=tmp.innerHTML.replace(/No contracts/,"بدون قرارداد");
	tmp = allElements.children[12];
	tmp.innerHTML=tmp.innerHTML.replace("Your active loans","وامهای شما");
	tmp.innerHTML=tmp.innerHTML.replace("Borrower","قرض کننده");
	tmp.innerHTML=tmp.innerHTML.replace("Payback time","زمان پرداخت");
	tmp.innerHTML=tmp.innerHTML.replace("Sum","مجموع");
	tmp.innerHTML=tmp.innerHTML.replace("Cancel debt","کنسل کردن بدهی");
	tmp.innerHTML=tmp.innerHTML.replace("No loans","بدون وام");
	tmp = allElements.children[14];
	tmp.innerHTML=tmp.innerHTML.replace("Your active debts","بدهیهای فعال شما ");
	tmp.innerHTML=tmp.innerHTML.replace("Lender","وام دهنده");
	tmp.innerHTML=tmp.innerHTML.replace("Payback time","زمان پرداخت");
	tmp.innerHTML=tmp.innerHTML.replace("Sum","مجموع");
	tmp.innerHTML=tmp.innerHTML.replace("Pay debt","پرداخت");
	tmp.innerHTML=tmp.innerHTML.replace("No debt","بدون بدهی");
	
	
	allElements = document.getElementById('command');
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace("Template name:","نام مدل:");
	

	
	replaceLinkByHref({
		"http://wiki.e-sim.org/en/Contracts":["Contract tutorial","آموزش قرارداد"],
		"#":["Create new template","ساخت مدل جدید"]
	});
	replaceInputByValue({
		"Delete":["Delete","حذف"],
		"Create template":["Create template","ساخت مدل"]
	});
	
}

//============================================================================
//Contract detail
//============================================================================
function replaceContractComm(obj, kbn) {
	if (kbn==1) {
		obj.innerHTML=obj.innerHTML.replace(/([\w ]*)obligations/,"تعهدات $1");
	} else {
		if (kbn==2) {
			obj.innerHTML=obj.innerHTML.replace(/Dummy citizen obligations/,"تعهدات شهروند ساختگی")
			obj.innerHTML=obj.innerHTML.replace(/Dummy citizen/,"شهروند ساختگی");
		} else {
			obj.innerHTML=obj.innerHTML.replace(/([\w ]*)obligations/,"تعهدات $1")
		}
	}
	
	obj.innerHTML=obj.innerHTML.replace(/ will instantly donate the following products/," این محصولات را فورا اهدا خواهد کرد");
	obj.innerHTML=obj.innerHTML.replace(/ will instantly donate the following sum of money/," این مقدار پول رو فورا اهدا خواهد کرد");
	obj.innerHTML=obj.innerHTML.replace(/ will be charged with following debt/," will be charged with following debt");
	obj.innerHTML=obj.innerHTML.replace(
		/must be paid([\d\D\n\r]*?)by([\D\n\r]*?)(\d*)([ \t\n\r]*?)game day([\D\n\r]*?)\(within (\d*) days since signing the contract \) to/g,
		"within  $1$3$5 day ($6 days since signing the contract) "
	);
}

function replaceOptionTxt(objs, replacements) {
	for (i = 0; i < objs.children.length; i++) {
		obj = objs.children[i];
		for (k in replacements) {
			if (obj.innerHTML.match(k)) {
				obj.innerHTML = obj.innerHTML.replace(replacements[k][0], replacements[k][1]);
			}
		}
	}
}
//======================================================================
// Contract Single
//======================================================================
function doContract() {
	allElements = document.getElementById('contentRow').children[1];
	//head
	tmp = allElements.children[0];
	tmp.innerHTML=tmp.innerHTML.replace(/Contracts/,"قرارداد");
	allElements = allElements.children[1];
	tmp = allElements.children[4];
	tmp.innerHTML=tmp.innerHTML.replace(/Contract/,"قرارداد");
	tmp = allElements.children[6];
	tmp.innerHTML=tmp.innerHTML.replace(/Contract status: /,"وضعیت قرارداد: ");
	tmp.innerHTML=tmp.innerHTML.replace(/Accepted/,"قبول شده");
	tmp.innerHTML=tmp.innerHTML.replace(/Rejected by (.*)/,"رد شده توسط $1 ");
	tmp.innerHTML=tmp.innerHTML.replace(/Failed/,"ناموفق");
	tmp.innerHTML=tmp.innerHTML.replace(/Template/,"مدل");
	
	//list
	allElements = allElements.children[8].children[0].children[0];
	tmp = allElements;
	replaceContractComm(tmp.children[0],1);
	allElements.innerHTML.match("Dummy citizen") ? isDummy=true : isDummy=false;
	replaceContractComm(tmp.children[2],isDummy?2:3);
	
	if (isDummy) {
		//add
		allElements = document.getElementById('contentRow').children[1].children[3];
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Add new element to the contract/,"اضافه کردن عنصر جدید به قرارداد");
		
		allElements = document.getElementById('contractsForm');
		tmp = allElements.children[3];
		tmp.innerHTML=tmp.innerHTML.replace(/Side/,"صفحه");
		tmp = allElements.children[7];
		tmp.innerHTML=tmp.innerHTML.replace(/Item type/,"آیتم");
		
		allElements = document.getElementById('offererSide');
		tmp = allElements.children[1];
		tmp.innerHTML=tmp.innerHTML.replace(/Dummy citizen/,"شهروند ساختگی");
		
		//money
		allElements = document.getElementById('itemTypeList');
		replaceOptionTxt(allElements, {
			"Money":["Money","پول"],
			"Product":["Product","محصول"],
			"Debt":["Debt","قرض"]
		});
		
		allElements = document.getElementById('MONEYParameters');
		tmp = allElements.children[0].childNodes[0];
		tmp.nodeValue=tmp.nodeValue.replace(/Money \(in /,"پول بدهی  ( ");
		
		//Product
		allElements = document.getElementById('PRODUCTParameters');
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Product quantity:/,"کیفیت محصول:");
		tmp = allElements.children[2];
		tmp.innerHTML=tmp.innerHTML.replace(/Product type:/,"نوع محصول:");
		tmp = allElements.children[5];
		tmp.innerHTML=tmp.innerHTML.replace(/Product quality:/,"کیفیت محصول:");
		
		allElements = document.getElementById('resource');
		replaceOptionTxt(allElements, {
			"Iron":["Iron","آهن"],
			"Grain":["Grain","گندم"],
			"Oil":["Oil","نفت"],
			"Stone":["Stone","سنگ"],
			"Wood":["Wood","چوب"],
			"Diamonds":["Diamonds","الماس"],
			"Weapon":["Weapon","اسلحه"],
			"House":["House","خانه"],
			"Gift":["Gift","هدیه"],
			"Food":["Food","غذا"],
			"Ticket":["Ticket","بلیط"],
			"Defense System":["Defense System","سیستم دفایی"],
			"Hospital":["Hospital","بیمارستان"]
		});
		
		//Debt
		allElements = document.getElementById('DEBTParameters');
		tmp = allElements.children[1];
		tmp.innerHTML=tmp.innerHTML.replace(/Debt/,"بدهی");
		tmp = allElements.children[3].childNodes[0];
		tmp.nodeValue=tmp.nodeValue.replace(/Money \(in /,"پول\u0105dze در ( ");
		tmp = allElements.children[5];
		tmp.innerHTML=tmp.innerHTML.replace(/Payback time:/,"زمان پرداخت:");
		tmp = allElements.children[5];
		tmp.innerHTML=tmp.innerHTML.replace(/Product quality:/,"کیفیت محصول:");
		
		//propose
		allElements = document.getElementById('contentRow').children[1].children[5];
		tmp = allElements.children[0];
		tmp.innerHTML=tmp.innerHTML.replace(/Propose contract/,"پیشنهاد قرارداد");
		tmp = allElements.children[2].children[3];
		tmp.innerHTML=tmp.innerHTML.replace(/Propose to/,"پیشنهاد شود به");
		tmp = allElements.children[5];
		tmp.innerHTML=tmp.innerHTML.replace(/Note:/,"نکته :");
		tmp = allElements.childNodes[12];
		tmp.nodeValue=tmp.nodeValue.replace(/you can only propose contract to your friend/,"شما فقط میتونید به دوستان خود پیشنهاد قرارداد بدهید");
	}
	
	replaceLinkByHref({
		"profile.html?id=0":["Dummy citizen","شهروند ساختگی"],
		"contracts.html":["Go back to contract list","برگشت به لیست قرارداد"]
	});
	replaceInputByValue({
		"Delete":["Delete","حذف"],
		"Propose":["Propose","پیشنهاد"],
		"Add item":["Add item","اضافه کردن آیتم"]
	});
	//cancel contract
	check = getElements(document, "//b[@class='biggerFont']");
    check = check.snapshotItem(1)
	if (check.innerHTML.match("Cancel proposal")) {
	    check.innerHTML = check.innerHTML.replace(/Cancel proposal/,"کنسل کردن پیشنهاد")
	    replaceInputByValue({"Cancel proposition":["Cancel proposition","کنسل کردن پیشنهاد"]});
	    }   
}
//================================================================================
// Monetary market
//================================================================================
function doMonetaryMarket() {
    var results
    var allElements
    results = getElements(document, "//TD[@width='410']");
    allElements = results.snapshotItem(0).children[0]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Monetary Market/,"بازار ارز")
    
    allElements = results.snapshotItem(0).children[2]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Current offers/,"پیشنهادات جاری")
    
    allElements = results.snapshotItem(0).children[4]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Show Offers/,"نمایش پیشنهادات")
	
	allElements = results.snapshotItem(0).children[4]
    replaceInputByValue({"Swap currencies":["Swap currencies","تعویض ارز"]})
    
    //allElements = results.snapshotItem(0).children[4]
    //tmp = allElements.children[2]
    //tmp.innerHTML = tmp.innerHTML.replace(/Swap currencies/,"تعویض ارز")
	
    tmp = allElements.children[3]
    tmp.innerHTML = tmp.innerHTML.replace(/Buy currency/,"خرید ارز")
    tmp.innerHTML = tmp.innerHTML.replace(/Sell currency/,"فروش ارز")
    tmp.innerHTML = tmp.innerHTML.replace(/View offers/,"مشاهده پیشنهادات")
    
    allElements = results.snapshotItem(0).children[7]
    tmp = allElements.children[1]
    tmp.innerHTML = tmp.innerHTML.replace(/Monetary market tutorial/,"آموزش بازار ارز")
    
    results = getElements(document, "//table[@class='dataTable']");
    allElements = results.snapshotItem(0).children[0]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Seller/,"فروشنده");
    tmp.innerHTML = tmp.innerHTML.replace(/Amount/,"مقدار");
    tmp.innerHTML = tmp.innerHTML.replace(/Ratio/,"نسبت");
    tmp.innerHTML = tmp.innerHTML.replace(/Buy/,"خرید");
    
    allElements = results.snapshotItem(1).children[0]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Amount/,"مقدار");
    tmp.innerHTML = tmp.innerHTML.replace(/Ratio/,"نسبت"); 
    tmp.innerHTML = tmp.innerHTML.replace(/Delete/,"پاک کردن");
    
    allElements = results.snapshotItem(1).children[0]
    tmp = allElements.children[1]
    tmp.innerHTML = tmp.innerHTML.replace(/No offers/,"بدون پیشنهاد");  
    
    results = getElements(document, "//TD[@style='border-left: 2px dashed #aaa']");
    
    allElements = results.snapshotItem(0).children[2]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Your offers/,"پیشنهادات شما") 
    
    allElements = results.snapshotItem(0).children[5]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Post your Offer/,"پیشنهاد بده")
    
    //tmp = allElements.children[2]
    //tmp.innerHTML = tmp.innerHTML.replace(/Swap currencies/,"تعویض ارز")
	replaceInputByValue({"Swap currencies":["Swap currencies","تعویض ارز"]})
    
    tmp = allElements.children[3]
    tmp.innerHTML = tmp.innerHTML.replace(/Offered currency/,"ارز پیشنهاد شده")
    tmp.innerHTML = tmp.innerHTML.replace(/Buy currency/,"خرید ارز")
    tmp.innerHTML = tmp.innerHTML.replace(/Exchange rate/,"نرخ تبادل ارز")
    tmp.innerHTML = tmp.innerHTML.replace(/Post new offer/,"پیشنهاد جدید بده")
    tmp.innerHTML = tmp.innerHTML.replace(/Offer/,"پیشنهاد")
    tmp.innerHTML = tmp.innerHTML.replace(/at rate/,"در نرخ")
    
}
//=============================================================================
// Citizen market offers
//=============================================================================
function doCitizenMarketOffers() {
    var results
    var allElements
    var tmp
    results = getElements(document, "//TD[@colspan='2']");
    allElements = results.snapshotItem(0).children[2]
    tmp = allElements.children[0]
    
    tmp.innerHTML = tmp.innerHTML.replace(/Marketplace/,"بازار محصول")
    tmp.innerHTML = tmp.innerHTML.replace(/Post new offers/,"پیشنهاد جدید بده")
    tmp.innerHTML = tmp.innerHTML.replace(/Country/,"کشور")
    tmp.innerHTML = tmp.innerHTML.replace(/Product/,"محصول")
    tmp.innerHTML = tmp.innerHTML.replace(/Quantity/,"کیفیت")
    tmp.innerHTML = tmp.innerHTML.replace(/Price/,"قیمت")
    tmp.innerHTML = tmp.innerHTML.replace(/Post new offer/,"پیشنهاد جدید بده")
    tmp.innerHTML = tmp.innerHTML.replace(/Show market offers/,"نمایش پیشنهادات بازار");
    tmp.innerHTML = tmp.innerHTML.replace(/Your storage/,"نمایش انبار");
    
    results = getElements(document, "//h3[@style='text-align: center']");
    allElements = results.snapshotItem(0)
    tmp = allElements
    tmp.innerHTML = tmp.innerHTML.replace(/Your offers on market/,"پیشنهادات شما در بازار")
    
    results = getElements(document, "//table[@style='width: 680px; margin-left: auto; margin-right: auto;']");
    allElements = results.snapshotItem(0).children[0]
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Product/,"محصول")
    tmp.innerHTML = tmp.innerHTML.replace(/Seller/,"فروشنده");
    tmp.innerHTML = tmp.innerHTML.replace(/Stock/,"انبار");
    tmp.innerHTML = tmp.innerHTML.replace(/Price/,"قیمت");
    tmp.innerHTML = tmp.innerHTML.replace(/Gross/,"کل");
    tmp.innerHTML = tmp.innerHTML.replace(/Price/,"قیمت");
    tmp.innerHTML = tmp.innerHTML.replace(/Net/,"خالص");
    tmp.innerHTML = tmp.innerHTML.replace(/Import tax/,"مالیات واردات");
    tmp.innerHTML = tmp.innerHTML.replace(/Delete/,"حذف");
    
}
// NEW
function doCompany() {
    allElements = document.getElementById('contentRow').children[1];
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Companies/,"کمپانیها");
    tmp = allElements.children[1]
    tmp.innerHTML = tmp.innerHTML.replace(/Company/,"کمپانی")
    tmp.innerHTML = tmp.innerHTML.replace(/Product/,"محصول")
    tmp.innerHTML = tmp.innerHTML.replace(/Location/,"موقعیت")
    tmp.innerHTML = tmp.innerHTML.replace(/Employees/,"کارکنان")
    tmp = allElements.children[3]
    tmp.innerHTML = tmp.innerHTML.replace(/Create new company/,"ایجاد کمپانی جدید")
    tmp.innerHTML = tmp.innerHTML.replace(/Company name/,"نام کمپانی")
    tmp.innerHTML = tmp.innerHTML.replace(/Product type/,"محصول")
    tmp.innerHTML = tmp.innerHTML.replace(/Company avatar/,"آواتر کمپانی")
    tmp.innerHTML = tmp.innerHTML.replace(/Create company/,"ایجاد کمپانی")
    tmp.innerHTML = tmp.innerHTML.replace(/Creating company costs/,"قیمت ایجاد کردن کمپانی")
    tmp.innerHTML = tmp.innerHTML.replace(/The company will be created in your current location - region /,"کمپانی در موقعیتی که الان شما حضور دارید ایجاد خواهد شد")
    tmp.innerHTML = tmp.innerHTML.replace(/To browse regions with resources/,"لیست مناطق و منابع آنها")
    tmp = allElements.children[4]
    tmp.innerHTML = tmp.innerHTML.replace(/Company tutorial on wiki/,"آموزش کمپانی")
}
    
    
function doPoliticalStats() {
    allElements = document.getElementById('contentRow').children[1];
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Country Politics/,"سیاست ملی");
    tmp = allElements.children[1]
    tmp.innerHTML = tmp.innerHTML.replace(/Select country/,"انتخاب کشور");
    tmp = allElements.children[2]
    tmp.innerHTML = tmp.innerHTML.replace(/President/,"رییس جمهور");
    tmp = allElements.children[6]
    tmp.innerHTML = tmp.innerHTML.replace(/view elections/,"مشاهده انتخابات");
    replaceLinkByHref({"http://wiki.e-sim.org/en/President":["President","رییس جمهور"]})
    tmp = allElements.children[9]
    tmp.innerHTML = tmp.innerHTML.replace(/Congress/,"مجلس");
    replaceLinkByHref({"http://wiki.e-sim.org/en/Congress":["Congress","مجلس"]})
    tmp = allElements.children[17]
    tmp.innerHTML = tmp.innerHTML.replace(/Wars/,"جنگها");
    tmp = allElements.children[21]
    tmp.innerHTML = tmp.innerHTML.replace(/War/,"جنگ");
    tmp.innerHTML = tmp.innerHTML.replace(/Details/,"جزئیات");
    tmp.innerHTML = tmp.innerHTML.replace(/No wars/,"بدون جنگ");
    tmp = allElements.children[22]
    tmp.innerHTML = tmp.innerHTML.replace(/War rules/,"قوانین جنگ");
    tmp = allElements.children[23]
    tmp.innerHTML = tmp.innerHTML.replace(/Alliances/,"متحدین");
    tmp = allElements.children[27]
    tmp.innerHTML = tmp.innerHTML.replace(/Country/,"کشور");
    tmp.innerHTML = tmp.innerHTML.replace(/Expires/,"تاریخ انقضا"); 
    tmp = allElements.children[27].children[0]
    var loopz = tmp.children.length   
    for (var k = 1; k < loopz; k = k+1) {
        tmp = allElements.children[27].children[0].children[k].children[1]
    
        if (tmp.innerHTML.match(/[\d\.]+/g)== 1) {		
            if (tmp.innerHTML.match("second")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( second)/g,"ثانیه ");
	        } else if (tmp.innerHTML.match("minute")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( minute)/g,"یک دقیقه ");
            } else if (tmp.innerHTML.match("hour")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( hour)/g,"یک ساعت ");
	        } else if (tmp.innerHTML.match("day")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( day)/g,"روز ");
            } else if (tmp.innerHTML.match("month")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( month)/g,"ماه ");
            } 
        } else {
            if (tmp.innerHTML.match("seconds")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( seconds)/g,"$1 ثانیه ");
            } else if (tmp.innerHTML.match("minutes")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( minutes)/g,"$1 دقیقه");
	        } else if (tmp.innerHTML.match("hours")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( hours)/g,"$1  ساعت");
	        } else if (tmp.innerHTML.match("days")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( days)/g,"$1 روز ");
	        } else if (tmp.innerHTML.match("months")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( months)/g,"$1 ماه ");
            } 
        }
    }
    
    replaceLinkByHref({"http://wiki.e-sim.org/en/Alliances":["Alliances","متحدین"]})
    
} 

function doInviteFriends() {
    allElements = document.getElementById('contentRow').children[1];
    tmp = allElements.children[0]
    tmp.innerHTML = tmp.innerHTML.replace(/Invite friends/,"دعوت دوستان");
    tmp = allElements.children[1]
    tmp.innerHTML = tmp.innerHTML.replace(/Your referrers link/,"لینک دعوت ");
    tmp.innerHTML = tmp.innerHTML.replace(/Send this link to other people to get additional/,"این لینک رو برای دوستان خود بفرستید");
    tmp.innerHTML = tmp.innerHTML.replace(/You earn/,"شما دریافت میکنی");
    tmp.innerHTML = tmp.innerHTML.replace(/Gold for each citizen, who registers/,"گلد برای هر شهروندی که ثبت نام کرده");
    tmp.innerHTML = tmp.innerHTML.replace(/and reaches level 7/,"و به سطح 7 رسیده است");
    tmp.innerHTML = tmp.innerHTML.replace(/after clicking this link/,"بعد از کلیک کردن روی این لینک");
    tmp.innerHTML = tmp.innerHTML.replace(/and another/,"و مقداری اضافه");
    
    tmp.innerHTML = tmp.innerHTML.replace(/Gold when he\/she gets his\/her/,"گلد زمانی که او بگیره");
    tmp.innerHTML = tmp.innerHTML.replace(/first medal/,"اولین مدال خودش رو");
    tmp.innerHTML = tmp.innerHTML.replace(/Additionally you get/,"به اضافه اینا شما خواهی گرفت");
    tmp.innerHTML = tmp.innerHTML.replace(/10% of gold received by player from medals and level ups/,"ده درصد از گلدایی که فرد از طریق گرفتن مدال یا بالا رفتن سطح بدست می آورد");
    tmp.innerHTML = tmp.innerHTML.replace(/Note, that your friends will also receive an additional/,"توجه کنید که دوست شما هم مقداری اضافی");
    tmp.innerHTML = tmp.innerHTML.replace(/Gold for registering through your game invitation link when they reach level 7/,"گلد دریافت خواهد کرد زمانی که با لینک شما آمده باشد و به سطح 7 برسد");
    tmp = allElements.children[4]
    tmp.innerHTML = tmp.innerHTML.replace(/Citizens you invited/,"شهروندانی که شما دعوت کردید");
    tmp = allElements.children[5]
    tmp.innerHTML = tmp.innerHTML.replace(/Sorting type/,"مرتب بر اساس");
    tmp.innerHTML = tmp.innerHTML.replace(/Show/,"نمایش");
    tmp = allElements.children[6]
    tmp.innerHTML = tmp.innerHTML.replace(/Citizen/,"شهروند");
    tmp.innerHTML = tmp.innerHTML.replace(/Level/,"سطح");
    tmp.innerHTML = tmp.innerHTML.replace(/Gold received/,"گلد دریافتی");
    tmp.innerHTML = tmp.innerHTML.replace(/Register time/,"زمان ثبت نام");
    
    TimeBasic(allElements,6,0,4)
    
    tmp = allElements.children[11]
    tmp.innerHTML = tmp.innerHTML.replace(/Statistics/,"آمار");
    tmp.innerHTML = tmp.innerHTML.replace(/Total clicks on referral link/,"تعداد کل کلیک روی لینک شما");
    tmp.innerHTML = tmp.innerHTML.replace(/Unique clicks on referral link/,"تعداد کلیک منحصر به فرد");
    tmp.innerHTML = tmp.innerHTML.replace(/Total citizens registered/,"تعداد شهروند ثبت نام کرده");
    tmp.innerHTML = tmp.innerHTML.replace(/Citizens who reached level 7/,"تعداد شهروندی که به سطح 7 رسیدند");
    tmp = allElements.children[14]
    tmp.innerHTML = tmp.innerHTML.replace(/Latest clicks on referrer link/,"آخرین کلیک ها روی لینک شما");
    tmp = allElements.children[15]
    tmp.innerHTML = tmp.innerHTML.replace(/Time/,"زمان");
    tmp.innerHTML = tmp.innerHTML.replace(/Referrer/,"ارجاع دهنده");
    tmp.innerHTML = tmp.innerHTML.replace(/Citizen/,"شهروندان");
    
    TimeBasic(allElements,15,0,0)
    
    tmp = allElements.children[15].children[0]
    var loopz = tmp.children.length
    for (var k = 1; k < loopz; k = k+1) {
        tmp = allElements.children[15].children[0].children[k].children[3]
        if (tmp.innerHTML.match(/Not registered/)) {		
            tmp.innerHTML = tmp.innerHTML.replace(/Not registered/,"ثبت نام نشده");
            }        
    }
    tmp = allElements.children[17]
    tmp.innerHTML = tmp.innerHTML.replace(/Show more clicks/,"نمایش کلیکهای بیشتر");
    
    
}
//Ulepszyc
function TimeBasic(allElements,i,j,l) {
    tmp = allElements.children[i].children[j]
    var loopz = tmp.children.length
    for (var k = 1; k < loopz; k = k+1) {
        tmp = allElements.children[i].children[j].children[k].children[l]
        if (tmp.innerHTML.match(/[\d\.]+/g)== 1) {		
            if (tmp.innerHTML.match("second")) {
                tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( second ago)/,"ثانیه پیش");
            } else if (tmp.innerHTML.match("minute")) {
                tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( minute ago)/,"یک دقیقه پیش");
            } else if (tmp.innerHTML.match("hour")) {
                tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( hour ago)/,"یک ساعت پیش");
            } else if (tmp.innerHTML.match("day")) {
                tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( day ago)/,"دیروز");
            } else if (tmp.innerHTML.match("month")) {
                tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( month ago)/,"ماه پیش");
            } 
        } else {
            if (tmp.innerHTML.match("seconds")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( seconds ago)/,"$1 ثانیه پیش");
            } else if (tmp.innerHTML.match("minutes")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( minutes ago)/,"$1 دقیقه پیش");
	        } else if (tmp.innerHTML.match("hours")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( hours ago)/,"$1 ساعت");
	        } else if (tmp.innerHTML.match("days")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( days ago)/,"$1 روز پیش");
	        } else if (tmp.innerHTML.match("months")) {
	            tmp.innerHTML = tmp.innerHTML.replace(/(\d*)( months ago)/,"$1 ماه پیش");
            } 
        }
    }
}

function doPremium() {
    allElements = document.getElementById('contentRow').children[1]
    tmp = allElements.children[7];
	tmp.innerHTML="<h2 style='text-align: center'>Premium account</h2>"
		+ "<i>E-sim</i> jest gr\u0105 darmow\u0105 i wszyscy mog\u0105 w ni\u0105 gra\u0107 bez wydawania pieni\u0119dzy. Je\u015Bli jeste\u015B jednak fanem <i>E-sim</i>, mo\u017Cesz zam\u00F3wi\u0107 abonament na konto premium.<br/><br/>"
		+ "<u>Konto premium</u> da ci dost\u0119p do kilku ciekawych informacji i u\u017Cytecznych dodatk\u00F3w takich jak monitor bitew lub wysy\u0142anie wiadomo\u015Bci do wszystkich cz\u0142onk\u00F3w jednostki wojskowej<br>"
		+ "Dodatkowo inni gracze b\u0119d\u0105 widzie\u0107 <i>presti\u017Cowa gwiazd\u0119</i> na twoim profilu.<br/>"
		+ "Kupuj\u0105c <u>konto premium</u> r\u00F3wniez pomagasz nam w rozwoju <i>E-sim</i>!."
		+ "<br><br>";
	tmp = allElements.children[9]
	tmp.innerHTML = tmp.innerHTML.replace(/Your account status/,"Your account status")
	if (tmp.innerHTML.match(/Free account/)) {
        tmp.innerHTML = tmp.innerHTML.replace(/Free account/,"Free account")
    } else {
        tmp.innerHTML = tmp.innerHTML.replace(/Premium account/,"Premium account")
    }
    tmp = allElements.children[11]
    tmp.innerHTML = tmp.innerHTML.replace(/Jump to/,"Jump to")
    replaceLinkByHref({
		"#features":["Features","Features"],
		"#payments":["Payments","Payments"],
		"#faq":["FAQ","FAQ"]
	});
	tmp = allElements.children[13]
	tmp.innerHTML = tmp.innerHTML.replace(/Features/,"Features")
	tmp.innerHTML = tmp.innerHTML.replace(/Battle monitor/,"Battle monitor")
        tmp.innerHTML = tmp.innerHTML.replace(/Companies production reports/,"Companies production reports")
	tmp.innerHTML = tmp.innerHTML.replace(/Tax income statistics/,"Tax income statistics")
	tmp.innerHTML = tmp.innerHTML.replace(/Historical Monetary Market transactions/,"Historical Monetary Market transactions")
	tmp.innerHTML = tmp.innerHTML.replace(/Broadcast messages to military unit members/,"Broadcast messages to military unit members")
	tmp.innerHTML = tmp.innerHTML.replace(/Broadcast messages to party members/,"Broadcast messages to party members")
	tmp.innerHTML = tmp.innerHTML.replace(/Removed ads/,"Removed ads")
	tmp.innerHTML = tmp.innerHTML.replace(/Prestigious star icon on your profile view /,"Prestigious star icon on your profile view")	
	tmp = allElements.children[13].children[4]
	tmp.innerHTML="Wy\u015Bwietlanie obywatelstw graczy obserwuj\u0105cych dan\u0105 bitw\u0119 i bior\u0105cych w niej udzia\u0142"
	
        tmp = allElements.children[13].children[7]
	tmp.innerHTML="Dodatkowe narz\u0119dzia do obliczenia produktywno\u015Bci swoich firm"
	
	tmp = allElements.children[13].children[11]
	tmp.innerHTML="Tylko dla prezydenta i kongresmen\u00F3w: dostajesz dost\u0119p do informacji na temat przychod\u00F3w z podatk\u00F3w"

        tmp = allElements.children[13].children[14];
	tmp.innerHTML = tmp.innerHTML.replace(/Money supply statistics/,"Statystyki ze skarbca pa\u0144stwa")	
	
	tmp = allElements.children[13].children[15]
	tmp.innerHTML="Tylko dla prezydenta i kongresmen\u00F3w: dostajesz dost\u0119p do informacji na temat skarbca pa\u0144stwa i waluty w obiegu"
	
	tmp = allElements.children[13].children[18]
	tmp.innerHTML="Dost\u0119p do historii transkacji na rynku walutowym dla wszystkich walut. Przydatne dla spekulant\u00F3w"
	tmp = allElements.children[13].children[21]
	tmp.innerHTML="Natychmiastowa wiadomo\u015B\u0107 do czlonkow jednostki wojskowej. Musisz mie\u0107 przywileje <u>commander</u>-a w twojej jednostce wojskowej \u017Ceby z tego skorzysta\u0107"
	
	tmp = allElements.children[13].children[23]
	tmp.innerHTML="Je\u015Bli jeste\u015B szefem partii, mo\u017Cesz wys\u0142ac wiadomo\u015B\u0107 do cz\u0142onk\u00F3w twojej partii"
	
	tmp = allElements.children[15].children[0]
	tmp.innerHTML = tmp.innerHTML.replace(/Payments/,"Payments")
	tmp = allElements.children[15].children[1]
	tmp.innerHTML = tmp.innerHTML.replace(/Duration/,"Duration")
	tmp.innerHTML = tmp.innerHTML.replace(/Price/,"Price")
	tmp.innerHTML = tmp.innerHTML.replace(/One Month (30 days)/,"One Month (30 days)")
	tmp = allElements.children[15].children[3]
	tmp.innerHTML="<b>S\u0105 2 sposoby \u017Ceby zap\u0142aci\u0107 :</b><br>"
			+"<ul>"
			+"<li>Jednorazowa op\u0142ata za 30 dni konta premium</li>"
			+"<li> Zam\u00F3w abonament (op\u0142aty zostan\u0105 od dzisiaj zrobione automatycznie co 30 dni dop\u00F3ki nie anulujesz abonamentu)</li>"
			+"</ul>"
	
	tmp = allElements.children[17].children[0]
	tmp.innerHTML = tmp.innerHTML.replace(/FAQ/,"Cz\u0119sto zadawane pytania")
	tmp = allElements.children[17].children[1]
	tmp.innerHTML="<img valign=\"middle\" src=\"http://e-sim.home.pl/eworld/img/question.png\">Czy mo\u017Cna zap\u0142aci\u0107 kart\u0105 kredytow\u0105?"
	tmp = allElements.children[17].children[2]
	tmp.innerHTML="Tak - musisz stworzy\u0107 konto paypal, polaczy\u0107 je z twoja kart\u0105 kredytow\u0105 i zaplaci\u0107 za konto premium z konta paypal"
	tmp = allElements.children[17].children[3]
	tmp.innerHTML="<img valign=\"middle\" src=\"http://e-sim.home.pl/eworld/img/question.png\">Czy mog\u0119 kupi\u0107 konto premium dla przyjaciela?"
	tmp = allElements.children[17].children[4]
	tmp.innerHTML="Tak, mo\u017Cesz kupi\u0107 konto premium dla kogo\u015B innego. Musisz tylko podda\u0107 nick jego obywatela przy zam\u00F3wieniu"
	tmp = allElements.children[17].children[5]
	tmp.innerHTML="<img valign=\"middle\" src=\"http://e-sim.home.pl/eworld/img/question.png\">Czy strac\u0119 konto premium je\u015Bli anuluj\u0119 abonament?"
	tmp = allElements.children[17].children[6]
	tmp.innerHTML="Nie natychmiastowo. Anulowanie abonamentu oznacza, \u017Ce pieni\u0105dze nie b\u0119d\u0105 pobierane z twojego konta paypal co 30 dni. Je\u015Bli anulowale\u015B abonament, b\u0119dziesz mia\u0142 konto premium a\u017C do wyga\u015Bni\u0119cia aktualnej umowy"
	tmp = allElements.children[17].children[7]
	tmp.innerHTML="<img valign=\"middle\" src=\"http://e-sim.home.pl/eworld/img/question.png\">Mam inne pytania..."
	tmp = allElements.children[17].children[8]
	tmp.innerHTML="Mo\u017Cesz spyta\u0107 wysy\u0142aj\u0105c  <a href=\"composeMessage.html?id=1\">wiadomo\u015B\u0107</a> albo spyta\u0107 innych graczy na <a target=\"_blank\" href=\"http://forum.e-sim.org/viewforum.php?f=43\">forum</a>"
	
	
}

function doDonations() {
    allElements = document.getElementById('contentRow').children[1]
    tmp = allElements.children[2];
    replaceInputByValue({"Show":["Show","Poka\u017C"]});
	tmp = allElements.children[2];
    tmp.innerHTML = tmp.innerHTML.replace(/If you enjoy playing <i>e-sim<\/i> and would like to support development of the game with donation, please use the donate button./,"and would like to support development of the game with donation, please use the donate button.")
	tmp.innerHTML = tmp.innerHTML.replace(/Your donation will be visible to everyone on this page/,"Your donation will be visible to everyone on this page")
	tmp.innerHTML = tmp.innerHTML.replace(/Donors, who make 2 EUR donations will receive bonus/,"Donors, who make 2 EUR donations will receive bonus")
	replaceLinkByHref({"achievement.html?type=DONATOR":["donor achievement","donor achievement"]});
} 
  
//============================================================================
//Main
//============================================================================
function isTargetHtml(targetHtml) {
	if (window.location.pathname.substring(0,targetHtml.length)==targetHtml) {
		return true;
	} else {
		return false;
	}
}




doMenu();
doSide();
if (window.location.pathname=="/" || isTargetHtml("/index.html")) {
	doHP();
} else if (isTargetHtml("/jobMarket.html")) {
	doJobMarket();
} else if (isTargetHtml("/work.html")) {
	doWork();
} else if (isTargetHtml("/productMarket.html")) {
	doProductMarkets();
} else if (isTargetHtml("/train.html")) {
	doTrain();
} else if (isTargetHtml("/battles.html")) {
	doBattlesList();
} else if (isTargetHtml("/battle.html")) {
	doBattle();
} else if (isTargetHtml("/battleStatistics.html")) {
	doBattleStatistics();
} else if (isTargetHtml("/profile.html")) {
	doProfile();
} else if (isTargetHtml("/editCitizen.html")) {
	doEditCitizen();
} else if (isTargetHtml("/travel.html")) {
	doTravel();
} else if (isTargetHtml("/inboxMessages.html")) {
	doInboxMessages();
} else if (isTargetHtml("/sentMessages.html")) {
	doSentMessages();
} else if (isTargetHtml("/composeMessage.html")) {
	doComposeMessage();
//} else if (isTargetHtml("/notifications.html")) {
//	doNotifications(); TODO
} else if (isTargetHtml("/subs.html")) {
	doSubs();
} else if (isTargetHtml("/subscribedNewspapers.html")) {
	doSubscribedNewspapers();
} else if (isTargetHtml("/newspaper.html")) {
	doNewspaper();
} else if (isTargetHtml("/editNewspaper.html")) {
	doNewspaperEdit();
} else if (isTargetHtml("/article.html")) {
	doArticle();
} else if (isTargetHtml("/editArticle.html")) {
	doArticleEdit();
} else if (isTargetHtml("/contracts.html")) {
	doContractsList();
} else if (isTargetHtml("/contract.html")) {
	doContract();
} else if (isTargetHtml("/monetaryMarket.html")) {
	doMonetaryMarket();
} else if (isTargetHtml("/citizenMarketOffers.html")) {
	doCitizenMarketOffers();
} else if (isTargetHtml("/companies.html")) {
	doCompany();
} else if (isTargetHtml("/countryPoliticalStatistics.html")) {
	doPoliticalStats();
} else if (isTargetHtml("/inviteFriends.html")) {
	doInviteFriends();
} else if (isTargetHtml("/subscription.html")) {
	doPremium();
} else if (isTargetHtml("/donations.html")) {
	doDonations();
}