function confirmChangeLang(txt, lang) {
	// constants to define the title of the confirm and button text.
	var CONFIRM_TITLE;
	var CONFIRM_BUTTON_TEXT1;
	var CONFIRM_BUTTON_TEXT2;

	if (document.getElementById("hdLanguageF").value == 1)
	{
		CONFIRM_TITLE = "Հաստատել";
		CONFIRM_BUTTON_TEXT1 = "Այո";
		CONFIRM_BUTTON_TEXT2 = "Ոչ";
	}
	else if (document.getElementById("hdLanguageF").value == 2)
	{
		CONFIRM_TITLE = "Confirm";
		CONFIRM_BUTTON_TEXT1 = "Yes";
		CONFIRM_BUTTON_TEXT2 = "No";
	}
	
	// shortcut reference to the document object
	d = document;

	// if the modalContainer object already exists in the DOM, bail out.
	if (d.getElementById("modalContainer")) return;

	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	mObj.style.height = document.documentElement.scrollHeight + "px";

	// create the DIV that will be the confirm 
	confirmObj = mObj.appendChild(d.createElement("div"));
	confirmObj.id = "confirmBox";
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the confirm
	if (d.all && !window.opera) confirmObj.style.top = document.documentElement.scrollTop + "px";
	// center the confirm box
	confirmObj.style.left = (d.documentElement.scrollWidth - confirmObj.offsetWidth)/2 + "px";
	
	// create an H1 element as the title bar
	h1 = confirmObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(CONFIRM_TITLE));

	// create a paragraph element to contain the txt argument
	msg = confirmObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt));

	oCenter = d.createElement("CENTER");
	oTable = d.createElement("TABLE");
	oTBody = d.createElement("TBODY");
	oTable.appendChild(oTBody);
	oTable.border = 0;
	oRow = d.createElement("TR");
	oRow.align = "center";
	oTBody.appendChild(oRow);

	oCell = d.createElement("TD");
	// create an anchor element to use as the confirmation button.
	btnYes = oCell.appendChild(d.createElement("a"));
	btnYes.id = "yesBtn";
	btnYes.appendChild(d.createTextNode(CONFIRM_BUTTON_TEXT1));
	btnYes.href = "#";
	btnYes.onclick = function() { proceedChangeLang(lang); return true; }
	oRow.appendChild(oCell);

	oCell = d.createElement("TD");
	btnNo = oCell.appendChild(d.createElement("a"));
	btnNo.id = "noBtn";
	btnNo.appendChild(d.createTextNode(CONFIRM_BUTTON_TEXT2));
	btnNo.href = "#";
	// set up the onclick event to remove the confirm when the anchor is clicked
	btnNo.onclick = function() { removeConfirm(); return false; }
	oRow.appendChild(oCell);

	oCenter.appendChild(oTable);
	confirmObj.appendChild(oCenter);
}

function proceedChangeLang(lang)
{
	self.location.href = 'search.php?QueryString=general&Language=' + lang;
}

// removes the custom confirm from the DOM
function removeConfirm() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}

