var	n = (document.layers) ? 1:0;
var	ie = (document.all) ? 1:0;
var nLeft;

function setLanguage(language){
	document.languageForm.lang.value=language;
	document.languageForm.submit();
}

function showcouple(){
	if (ie) couple.style.visibility="visible";
	else if (n) document.couple.visibility="show";
}
function hidecouple(){
	if (ie) couple.style.visibility="hidden";
	else if (n) document.couple.visibility="hide";
}


function resetTable(tb_pos, tb_width){
	
	if (tb_width!='') {
		if (n) document.tb.width=tb_width;
		if (ie) tb.style.width=tb_width;
	}

	if (tb_width!='100%') {

		if (tb_pos == "Left") {
			if (n) document.tb.left=0;
			if (ie) tb.style.posLeft=0;
		}

		if (tb_pos == "Right") {				
			if (n) {
				nLeft = window.innerWidth-tb_width;
				if (nLeft > 0)
					document.tb.left=nLeft;
			}
			if (ie) {
				nLeft = document.body.clientWidth-tb_width;
				if (nLeft > 0)
					tb.style.posLeft=nLeft;
			}
		}

		if (tb_pos == "Center") {
			if (n) {
				nLeft = (window.innerWidth-tb_width)/2;
				if (nLeft > 0)
					document.tb.left = nLeft;
			}
			if (ie) {
				nLeft = (document.body.clientWidth-tb_width)/2;
				if (nLeft > 0)
					tb.style.posLeft = nLeft;
			}
		}
	}
	
}


function OpenWin(url,name,width,height,scrollbars,resizable){
	newWin = window.open(url, name, "width="+width+",height="+height+",scrollbars="+scrollbars+",resizable="+resizable);
	newWin.focus();
}

//no right click
function clickIE4(){ 
	if (event.button==2){ 
		alert(message); 
		return false; 
	} 
} 
function clickNS4(e){ 
	if (document.layers||document.getElementById&&!document.all){ 
		if (e.which==2||e.which==3){ 
			alert(message); 
			return false; 
		} 
	} 
} 

if (document.layers){ 
	document.captureEvents(Event.MOUSEDOWN); 
	document.onmousedown=clickNS4; 
} else if (document.all&&!document.getElementById){ 
	document.onmousedown=clickIE4; 
}



function getHTML() {
	var x = document.getElementById('WebWizRTE'); 
	document.theForm.html_content.value =  (x.contentDocument || x.contentWindow.document).body.innerHTML; 
}

var str_wait = '<img src="/images/img_wait.gif" align=absmiddle>';

_this = XHRequest.prototype;
function XHRequest(){}
_this.getObject = function() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else {
		alert("XML HTTP Request support cannot be found!");
		return null;
	}
}

function changeContent(url, lay){

	//if(lay) {
		lay.innerHTML = '<table width=100% height=200><tr><td align=center>'+str_wait+'</td></tr></table>';

		var request = new XHRequest().getObject();
			
		request.onreadystatechange = function() {
			if (request.readyState == 4) {      
				if (request.status == 200) { 
					var txt = request.responseText;
					//document.getElementById("new_message")
					lay.innerHTML = txt;
				}
			}
		}
		request.open("GET", url+"&r="+Math.random(), true);
		request.send(null);
	//}
}