/*
function open_chat(site, lang)
{
	var confirmWin = null;
    var url = "http://livechat.locus.net/my_chat/index.php?site=" + site 
    			+ "&lang=" + lang
    			+ "&ref_url=" + location.href;
    confirmWin = window.open(url, site, "width=430,height=360,resizable=yes");
}
*/



	
function open_chat(site, lang)
{
	window.open('', 'chat', 'width=430,height=360,resizable=yes')
	
	theForm = document.createElement("FORM");
	theForm.setAttribute("id", "form_livechat");
	theForm.setAttribute("action", "http://livechat.locus.net/my_chat/index.php");
	theForm.setAttribute("method", "post");
	theForm.setAttribute("target", "chat");
	document.body.appendChild(theForm);
	//theForm.setAttribute("onSubmit", "window.open('', 'chat', 'width=430,height=360,resizable=yes')");
	//theForm.onSubmit = "window.open('', 'chat', 'width=430,height=360,resizable=yes')";
	
	field_site = document.createElement("INPUT");
	field_site.type="hidden";
	field_site.setAttribute("id", "site");
	field_site.setAttribute("name", "site");
	field_site.value = site;
	theForm.appendChild(field_site);

	field_lang = document.createElement("INPUT");
	field_lang.type="hidden";
	field_lang.setAttribute("id", "lang");
	field_lang.setAttribute("name", "lang");
	field_lang.value = lang;
	theForm.appendChild(field_lang);

	field_ref = document.createElement("INPUT");
	field_ref.type="hidden";
	field_ref.setAttribute("id", "ref_url");
	field_ref.setAttribute("name", "ref_url");
	field_ref.setAttribute("value", location.href);
	theForm.appendChild(field_ref);

	//div = document.getElementById("chat");
	//div.appendChild(theForm);
		
	
	//document.getElementById("site").value= site;
	//document.getElementById("lang").value= lang;

	
	theForm.submit();
	//document.getElementById("form_livechat").submit();


	/*	
	theForm = document.createElement("form");
	theForm.setAttribute("action", "http://livechat.locus.net/my_chat2/index.php");
	theForm.setAttribute("method", "post");
	theForm.setAttribute("target", "chat");
	theForm.setAttribute("onSubmit", "window.open('', 'chat', 'width=430,height=360,resizable=yes')");
	
	field_site = document.createElement("input");
	field_site.setAttribute("name", "site");
	field_site.setAttribute("value", site);
	theForm.appendChild(field_site);

	field_lang = document.createElement("input");
	field_lang.setAttribute("name", "lang");
	field_lang.setAttribute("value", lang);
	theForm.appendChild(field_lang);

	field_ref = document.createElement("input");
	field_ref.setAttribute("name", "ref_url");
	field_ref.setAttribute("value", location.href);
	theForm.appendChild(field_ref);

	//theForm.submit();
	*/
}
