var hrefIndexEnglish 		= "index.html";
var nameHrefIndexEnglish 	= "english";
var hrefIndexGerman 		= "indexger.html";
var nameHrefIndexGerman 	= "deutsch";
var hrefIndexRussian 		= "indexrus.html";
var nameHrefIndexRussian 	= "русский";

var mapCa 		= "Map/ca.gif"; 
var mapKz 		= "Map/kz.gif";
var mapUz 		= "Map/uz.gif";
var mapKg 		= "Map/kg.gif"; 
var mapTurkm 		= "Map/turkm.gif"; 
var mapTdjk 		= "Map/tdjk.gif";

var countryKzEnglish = "Country/kz.htm";
var countryUzEnglish = "Country/uz.htm";
var countryKgEnglish = "Country/kg.htm";
var countryTkEnglish = "Country/tk.htm";
var countryTjEnglish = "Country/tj.htm";

var countryKzGerman = "Country/kzger.htm";
var countryUzGerman = "Country/uzger.htm";
var countryKgGerman = "Country/kgger.htm";
var countryTkGerman = "Country/tkger.htm";
var countryTjGerman = "Country/tjger.htm";

var countryKzRussian = "Country/kzrus.htm";
var countryUzRussian = "Country/uzrus.htm";
var countryKgRussian = "Country/kgrus.htm";
var countryTkRussian = "Country/tkrus.htm";
var countryTjRussian = "Country/tjrus.htm";
	
var styleBackgroundTopIndex 			= "Images/Style/backgroundTopIndex.gif";
var styleBackgroundButtom 				= "Images/Style/backgroundButtom.gif";
var styleBackgroundTop 					= "Images/Style/backgroundTop.gif";
var styleBackgroundMenuLeft 			= "Images/Style/backgroundMenuLeft.gif";
var styleBackground 					= "Images/Style/background.gif";
var styleHome 							= "Images/Style/home.gif";
var styleLogo 							= "Images/Style/logo.gif";
var styleSpacer 						= "Images/Style/spacer.gif";
var styleTop 							= "Images/Style/top.gif";
var styleBackgroundTitleIndexEnglish 	= "Images/Style/backgroundTitleIndexEnglish.gif";
var styleBackgroundTitleIndexGerman 	= "Images/Style/backgroundTitleIndexGerman.gif";
var styleBackgroundTitleIndexRussian 	= "Images/Style/backgroundTitleIndexRussian.gif";
var styleBackgroundTitleEnglish			= "Images/Style/backgroundTitleEnglish.gif";
var styleBackgroundTitleGerman			= "Images/Style/backgroundTitleGerman.gif";
var styleBackgroundTitleRussian			= "Images/Style/backgroundTitleRussian.gif";

//images index sites (right position) --> width 150 px, height variable (*_index.*)
//images other sites (top position)	  --> width 150 px, height 80 px	
var imageLeftDefault	= "Images/Country/default_left.jpg";
var imageCenterDefault	= "Images/Country/default_center.jpg";
var imageRightDefault	= "Images/Country/default_right.jpg";

var imageIndexKg		= "Images/Country/kg_index.jpg";
var imageLeftKg			= "Images/Country/kg_left.jpg";
var imageCenterKg		= "Images/Country/kg_center.jpg";
var imageRightKg		= "Images/Country/kg_right.jpg";

var imageIndexKz		= "Images/Country/kz_index.jpg";
var imageLeftKz			= "Images/Country/kz_left.jpg";
var imageCenterKz		= "Images/Country/kz_center.jpg";
var imageRightKz		= "Images/Country/kz_right.jpg";

var imageIndexTj		= "Images/Country/tj_index.jpg";
var imageLeftTj			= "Images/Country/tj_left.jpg";
var imageCenterTj		= "Images/Country/tj_center.jpg";
var imageRightTj		= "Images/Country/tj_right.jpg";

var imageIndexTk		= "Images/Country/tk_index.jpg";
var imageLeftTk			= "Images/Country/tk_left.jpg";
var imageCenterTk		= "Images/Country/tk_center.jpg";
var imageRightTk		= "Images/Country/tk_right.jpg";

var imageIndexUz		= "Images/Country/uz_index.jpg";
var imageLeftUz			= "Images/Country/uz_left.jpg";
var imageCenterUz		= "Images/Country/uz_center.jpg";
var imageRightUz		= "Images/Country/uz_right.jpg";


function getTopicalDateEnglish () {

	var days = new Array(7)
	days[1] = "Sunday"; 
	days[2] = "Monday"; 
	days[3] = "Tuesday"; 
	days[4] = "Wednesday"; 
	days[5] = "Thursday"; 
	days[6] = "Friday"; 
	days[7] = "Saturday";
	
	return getTopicalDate (days);
}

function getTopicalDateGerman () {

	var days = new Array(7)
	days[1] = "Sonntag"; 
	days[2] = "Montag"; 
	days[3] = "Dienstag"; 
	days[4] = "Mittwoch"; 
	days[5] = "Donnerstag"; 
	days[6] = "Freitag"; 
	days[7] = "Samstag";

	return getTopicalDate (days);
}

function getTopicalDateRussian () {

	var days = new Array(7)
	days[1] = "Воскресенье"; 
	days[2] = "Понедельник"; 
	days[3] = "Вторник"; 
	days[4] = "Среда"; 
	days[5] = "Четверг"; 
	days[6] = "Пятница"; 
	days[7] = "Суббота";

	return getTopicalDate (days);
}

function getTopicalDate (days) {
	var today = new Date(); 
	var day = days[today.getDay() + 1]; 
	var month = today.getMonth() + 1; 
	var date = today.getDate(); 
	var year = today.getFullYear(); 
	var topicalDate = "";
	
	if (date<10) datestr = "0"; if (month<10) monthstr = "0";
		topicalDate = "&nbsp;&nbsp;" +day+", "+date+"."+month+"."+year;	
	
	return topicalDate;
}

function getUpdate () {
	
	var help = new Date();	 
	var today = new Date(help.getFullYear(),help.getMonth() - 1,help.getDate() - 5);
	var month = today.getMonth() + 1; 
	var date = today.getDate(); 
	var year = today.getFullYear(); 
	var datestr =""; 
	var monthstr = "";
	
	var upDate = "";
	
	if (date<10) datestr = "0"; 
	
	if (month<10) monthstr = "0";
	 	upDate = "Last Update: " +datestr+date+"."+monthstr+month+"."+year;
	
	return upDate;
}

function getTop (language, indexTrue, countryCode) {
	
	var topicalDate 	= "";
	
	var imageLeft 		= "";
	var imageCenter 	= "";
	var imageRight 		= "";
	
	var hrefFirst 		= "";
	var nameHrefFirst 	= "";
	var hrefSecond 		= "";
	var nameHrefSecond 	= "";
	
	if (language == 1) {
		
		topicalDate = getTopicalDateEnglish ();
		
		if (indexTrue == 1) {
			getHtmlTopIndex (topicalDate, hrefIndexGerman, nameHrefIndexGerman, hrefIndexRussian, nameHrefIndexRussian, 
				countryKzEnglish, countryUzEnglish, countryKgEnglish, countryTkEnglish, countryTjEnglish, 
				styleBackgroundTitleIndexEnglish);
			return;
		}
		hrefFirst 				= "../" +hrefIndexGerman;
		nameHrefFirst 			= nameHrefIndexGerman;
		hrefSecond 				= "../" +hrefIndexRussian;
		nameHrefSecond 			= nameHrefIndexRussian;
		styleBackgroundTitle	= styleBackgroundTitleEnglish;
	}
	
	if (language == 2) {
		
		var topicalDate = getTopicalDateGerman ();
		
		if (indexTrue == 1) {
			getHtmlTopIndex (topicalDate, hrefIndexEnglish, nameHrefIndexEnglish, hrefIndexRussian, nameHrefIndexRussian, 
				countryKzGerman, countryUzGerman, countryKgGerman, countryTkGerman, countryTjGerman, styleBackgroundTitleIndexGerman);		
			return;
		}
		hrefFirst 				= "../" +hrefIndexEnglish;
		nameHrefFirst 			= nameHrefIndexEnglish;
		hrefSecond 				= "../" +hrefIndexRussian;
		nameHrefSecond 			= nameHrefIndexRussian;
		styleBackgroundTitle	= styleBackgroundTitleGerman;
	}
	
	if (language == 3) {
		
		var topicalDate = getTopicalDateRussian();
		
		if (indexTrue == 1) {
			getHtmlTopIndex (topicalDate, hrefIndexEnglish, nameHrefIndexEnglish, hrefIndexGerman, nameHrefIndexGerman, 
				countryKzRussian, countryUzRussian, countryKgRussian, countryTkRussian, countryTjRussian, 
				styleBackgroundTitleIndexRussian);			
			return;
		}
		hrefFirst 				= "../" +hrefIndexEnglish;
		nameHrefFirst 			= nameHrefIndexEnglish;
		hrefSecond 				= "../" +hrefIndexGerman;
		nameHrefSecond 			= nameHrefIndexGerman;
		styleBackgroundTitle 	= styleBackgroundTitleRussian;
	}
	
	if (countryCode == 1) {
		imageLeft 	= "../" +imageLeftDefault;
		imageCenter = "../" +imageCenterDefault;
		imageRight 	= "../" +imageRightDefault;
	}
	
	if (countryCode == 2) {
		imageLeft 	= "../" +imageLeftKz;
		imageCenter = "../" +imageCenterKz;
		imageRight 	= "../" +imageRightKz;
	}
	
	if (countryCode == 3) {
		imageLeft 	= "../" +imageLeftKg;
		imageCenter = "../" +imageCenterKg;
		imageRight 	= "../" +imageRightKg;
	}
	
	if (countryCode == 4) {
		imageLeft 	= "../" +imageLeftUz;
		imageCenter = "../" +imageCenterUz;
		imageRight 	= "../" +imageRightUz;
	}
	
	if (countryCode == 5) {
		imageLeft 	= "../" +imageLeftTj;
		imageCenter = "../" +imageCenterTj;
		imageRight 	= "../" +imageRightTj;
	}
	
	if (countryCode == 6) {
		imageLeft 	= "../" +imageLeftTk;
		imageCenter = "../" +imageCenterTk;
		imageRight 	= "../" +imageRightTk;
	}
	
	getHtmlTop (topicalDate, hrefFirst, nameHrefFirst, hrefSecond, nameHrefSecond, imageLeft, imageCenter, imageRight, 	styleBackgroundTitle);
}

function getHtmlTopIndex (topicalDate, linkLanguageFirst, linkNameFirst, linkLanguageSecond, linkNameSecond, 
	countryKz, countryUz, countryKg, countryTk, countryTj, styleBackgroundTitleIndex) {
	
	this.topicalDate 				= topicalDate;
	this.linkLanguageFirst 			= linkLanguageFirst;
	this.linkNameFirst 				= linkNameFirst;
	this.linkLanguageSecond 		= linkLanguageSecond;
	this.linkNameSecond 			= linkNameSecond;
	
	document.write("<body background=\"" +styleBackground +"\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onLoad=\"MM_preloadImages\">");
	document.write("<table width=\"750\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
	document.write("<tr>");
	document.write("<td width=\"135\" valign=\"top\" background=\"" +styleBackgroundMenuLeft +"\"><center>");
	document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#3953A4\">");
	document.write("<tr>");
	document.write("<td><center><img src=\"" +styleLogo +"\" width=\"111\" height=\"154\"></center></td></tr></table>");
	document.write("<p class=\"city\">&nbsp;</p></center></td>");
	document.write("<td width=\"1\" valign=\"top\" bgcolor=\"#3953A4\"><img src=\"" +styleSpacer +"\" width=\"1\" height=\"1\"></td>");
	document.write("<td width=\"614\" valign=\"top\"><div align=\"right\">");
	document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"" +styleBackgroundTopIndex +"\">");
	document.write("<tr valign=\"bottom\">");
	document.write("<td width=\"50%\"><span style =\"font: 10px Arial; color: #FFFFFF; font-weight: bold\"><br>&nbsp;" +topicalDate +"</span></td>");
	document.write("<td width=\"50%\"><div align=\"right\">");
	document.write("<a href=\"" +linkLanguageFirst +"\" class=\"linktop\">" +linkNameFirst +"&nbsp;&nbsp;</a></div></td>");
	document.write("<td width=\"50%\"><div align=\"right\">");
	document.write("<a href=\"" +linkLanguageSecond +"\" class=\"linktop\">" +linkNameSecond +"&nbsp;&nbsp;</a></div></td></tr></table>");
	document.write("<img src=\"" +styleBackgroundTitleIndex +"\" width=\"614\" height=\"130\" hspace=\"0\" vspace=\"0\" border=\"0\"><center><br>");
	document.write("<img src=\"" +mapCa +"\" name=\"Image1\" width=\"400\" height=\"254\" hspace=\"0\" vspace=\"0\" border=\"0\" usemap=\"#Map\" id=\"Image1\">");
	document.write("<map name=\"Map\">");
	document.write("<area shape=\"poly\" coords=\"400,80,384,80,363,63,333,60,294,20,272,34,259,24,242,15,225,10,181,21,144,29,134,53,151,65,113,65,53,55,23,67,7,75,4,96,17,116,24,122,56,113,81,131,55,127,33,144,62,164,77,159,89,173,97,169,97,130,133,124,157,148,186,145,199,160,204,171,223,171,240,160,241,153,268,155,273,150,299,153,336,156,333,137,355,128,364,110,380,112,394,93\" href=\"" +countryKz +"\" alt=\"Kazakhstan\" onMouseOver=\"item_on('kz')\" onMouseOut=\"item_off('kz')\">");
	document.write("<area shape=\"poly\" coords=\"94,163,94,125,118,119,134,121,144,130,152,139,168,139,186,139,197,151,204,159,223,150,220,158,229,161,242,152,237,162,248,163,251,161,261,168,247,176,240,172,238,165,224,170,223,176,218,175,213,181,201,182,212,196,203,205,197,194,162,177,152,161,136,159,137,154,120,146,105,154,106,163\" href=\"" +countryUz +"\" alt=\"Uzbekistan\" onMouseOver=\"item_on('uz')\" onMouseOut=\"item_off('uz')\">");
	document.write("<area shape=\"poly\" coords=\"318,167,336,150,324,146,290,144,275,141,269,142,265,151,257,147,242,145,242,150,239,161,245,164,247,159,259,165,262,172,251,172,240,177,227,176,225,180,239,182,254,183,269,183,286,172,296,177,305,167\" href=\"" +countryKg +"\" alt=\"Kyrgyzstan\" onMouseOver=\"item_on('kg')\" onMouseOut=\"item_off('kg')\">");
	document.write("<area shape=\"poly\" coords=\"62,181,61,159,73,152,83,156,94,165,105,155,120,146,132,151,136,159,151,163,175,185,200,197,193,207,180,221,169,231,160,228,150,222,140,213,127,208,110,202,95,202,79,212,72,192\" href=\"" +countryTk +"\" alt=\"Turkmenistan\" onMouseOver=\"item_on('turk')\" onMouseOut=\"item_off('turk')\">");
	document.write("<area shape=\"poly\" coords=\"206,188,200,181,211,181,222,174,225,167,238,165,238,173,228,174,220,180,242,181,265,183,277,178,292,192,297,206,280,204,251,212,248,194,236,199,225,207,203,206,209,194\" href=\"" +countryTj +"\" alt=\"Tadjikistan\" onMouseOver=\"item_on('tg')\" onMouseOut=\"item_off('tg')\"></map></center>");
	document.write("<center><table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>");
}

function getHtmlTop (topicalDate, linkLanguageFirst, linkNameFirst, linkLanguageSecond, linkNameSecond, 
	imageLeft, imageCenter, imageRight, styleBackgroundTitle) {
	
	var index = "../" +hrefIndexEnglish;

	this.styleBackgroundMenuLeft 	= "../" +styleBackgroundMenuLeft;
	this.styleBackgroundTop 		= "../" +styleBackgroundTop;
	this.styleLogo 					= "../" +styleLogo;
	this.styleBackground 			= "../" +styleBackground;
	this.styleSpacer 				= "../" +styleSpacer;
	styleBackgroundTitle 			= "../" +styleBackgroundTitle;
	
	this.imageLeft 				= imageLeft;
	this.imageCenter 			= imageCenter;
	this.imageRight 			= imageRight;
	this.topicalDate 			= topicalDate;
	this.linkLanguageFirst 		= linkLanguageFirst;
	this.linkNameFirst 			= linkNameFirst;
	this.linkLanguageSecond 	= linkLanguageSecond;
	this.linkNameSecond 		= linkNameSecond;
	
	document.write("<body background=\"" +styleBackground +"\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">");
	document.write("<a name=\"top\"></a>");
	document.write("<table width=\"750\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
	document.write("<tr>");
	document.write("<td width=\"135\" valign=\"top\" background=\"" +styleBackgroundMenuLeft +"\"><center>");
	document.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	document.write("<tr>");
	document.write("<td bgcolor=\"#3953A4\">");
	document.write("<center><a href=\"" +index +"\"><img src=\"" +styleLogo +"\" width=\"111\" height=\"154\" border=\"0\"></a>");
	document.write("</center></td></tr></table><br>");	
	document.write("<img src=\"" +styleSpacer +"\" width=\"135\" height=\"1\"></center></td>");
	document.write("<td width=\"1\" valign=\"top\" bgcolor=\"#3953A4\"><img src=\"" +styleSpacer +"\" width=\"1\" height=\"1\"></td>");
	document.write("<td width=\"100%\" valign=\"top\" bgcolor=\"#FFFFFF\"><div align=\"right\">");
	document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"" +styleBackgroundTop +"\">");
	document.write("<tr valign=\"bottom\">");
	document.write("<td width=\"50%\"><span style =\"font: 10px Arial; color: #FFFFFF; font-weight: bold\">&nbsp;<br>" +topicalDate +"</span></td>");
	document.write("<td width=\"50%\"><div align=\"right\">");
	document.write("<a href=\"" +linkLanguageFirst +"\" class=\"linktop\">" +linkNameFirst +"&nbsp;&nbsp;</a></div></td>");
	document.write("<td width=\"50%\"><div align=\"right\">");
	document.write("<a href=\"" +linkLanguageSecond +"\" class=\"linktop\">" +linkNameSecond +"&nbsp;&nbsp;</a></div></td></tr></table>");
	document.write("<img src=\"" +styleBackgroundTitle +"\" width=\"614\" height=\"10\" hspace=\"0\" vspace=\"0\" border=\"0\"><br>");
	document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"" +styleBackgroundTop +"\">");
	document.write("<tr>");
	document.write("<td align=\"center\" valign=\"top\">&nbsp;</td>");
	document.write("<td width=\"450\" align=\"\" valign=\"top\">");
	document.write("<img src=\"" +imageLeft +"\" vspace=\"15\">");
	document.write("<img src=\"" +imageCenter +"\" vspace=\"15\">");
	document.write("<img src=\"" +imageRight +"\" vspace=\"15\"></td>");
	document.write("<td align=\"center\" valign=\"top\">&nbsp;</td></tr></table>");
}

function getButtom (language, indexTrue) {
	
	if ((language == 1) && (indexTrue == 1)) {
		getHtmlButtomIndex (countryKzEnglish, countryUzEnglish, countryKgEnglish, countryTkEnglish, countryTjEnglish);
		return;
	}
		
	if ((language == 2) && (indexTrue == 1)) {
		getHtmlButtomIndex (countryKzGerman, countryUzGerman, countryKgGerman, countryTkGerman, countryTjGerman);
		return;
	}
	
	if ((language == 3) && (indexTrue == 1)) {
		getHtmlButtomIndex (countryKzRussian, countryUzRussian, countryKgRussian, countryTkRussian, countryTjRussian);
		return;
	}
	
	getHtmlButtom ();
}

function getHtmlButtomIndex (countryKz, countryUz, countryKg, countryTk, countryTj) {
	
	var lastUpdate = getUpdate ();
	
	document.write("<td valign=\"top\" id=\"kz\" onMouseOver=\"item_on('kz')\" onMouseOut=\"item_off('kz')\"><div align=\"right\">");
	document.write("<a href=\"" +countryKz +"\" class=\"city\" id=\"kzl\">");
	document.write("<td valign=\"top\" id=\"kg\" onMouseOver=\"item_on('kg')\" onMouseOut=\"item_off('kg')\"><div align=\"right\">");
	document.write("<a href=\"" +countryKg +"\" class=\"city\" id=\"kgl\">");
	document.write("<td valign=\"top\" id=\"tg\" onMouseOver=\"item_on('tg')\" onMouseOut=\"item_off('tg')\"><div align=\"right\">");
	document.write("<a href=\"" +countryTj +"\" class=\"city\" id=\"tgl\">");
	document.write("<td valign=\"top\" id=\"turk\" onMouseOver=\"item_on('turk')\" onMouseOut=\"item_off('turk')\"><div align=\"right\">");
	document.write("<a href=\"" +countryTk +"\" class=\"city\" id=\"turkl\">");
	document.write("<td valign=\"top\" id=\"uz\" onMouseOver=\"item_on('uz')\" onMouseOut=\"item_off('uz')\"><div align=\"right\">");
	document.write("<a href=\"" +countryUz +"\" class=\"city\" id=\"uzl\">");
} 

function getHtmlButtom () {
	
	var lastUpdate = getUpdate ();
	
	this.styleHome 				= "../" +styleHome;
	this.styleBackgroundButtom 	= "../" +styleBackgroundButtom;
	this.styleTop 				= "../" +styleTop;
	this.styleSpacer 			= "../" +styleSpacer;
	this.index 					= "../" +hrefIndexEnglish;
	
	document.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">");
	document.write("<tr>");
	document.write("<td><a href=\"" +index +"\"><img src=\"" +styleHome +"\" width=\"36\" height=\"35\" border=\"0\"></a></td>");
	document.write("<td><div align=\"right\"><a href=\"#top\"><img src=\"" +styleTop +"\" width=\"36\" height=\"34\" border=\"0\"></a></div></td>");
	document.write("</tr></table>");
	document.write("</div></td>");
	document.write("<td width=\"1\" valign=\"top\" bgcolor=\"#3953A4\"><img src=\"" +styleSpacer +"\" width=\"1\" height=\"1\"></td></tr></table>");
	document.write("<table width=\"750\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"" +styleBackgroundButtom +"\">");
	document.write("<tr valign=\"middle\">");
	document.write("<td width=\"180\"><span style =\"font: 10px Arial; color: #FFFFFF; font-weight: bold\">&nbsp;" +lastUpdate +"<br>&copy;&nbsp;FES</span></td>");
	document.write("<td>&nbsp;</td><td width=\"180\">&nbsp;</td></tr></table></body>");
}


