var version = 6.1;
var versionstr = "6.1";
var v = 0;


function openFullScreenChat(url)
{
	if (document.all)
	{
		var w = screen.width - window.screenLeft - 10;
		var h = screen.height - window.screenTop;
		var win = window.open(url, "_123FullscreenDemo", "resizable=1, width="+w+",height="+h+",status=1");
		win.moveTo(0,0);
	}
	else
	{
		window.open(url, "_123FullscreenDemo", "resizable=1, fullscreen=1");
	}
}

function openPrivateWin(winId,w,h)
{
	window.open ("privatewin.html?"+winId, "privateMsg_"+winId, "height="+h+", width="+w+", top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

function openCustomLiteClient(win_width,win_height)
{
	var win_width = window.screen.width - 5;
	var win_height = window.screen.Height - 10;
	if(document.customForm.customsize[0].checked==true)
	{
			win_width=document.customForm.win_width.value;
			win_height=document.customForm.win_height.value;
	}
	
	if (win_width < 270)
	{
		alert("width can't be less than 270");
		return;
	}
	
	if (win_height < 200)
	{
		alert("height can't be less than 200");
		return;	
	}
	
	var init_user=document.customForm.init_user.value;
	var init_password=document.customForm.init_password.value;
	var init_room=document.customForm.init_room[document.customForm.init_room.selectedIndex].value;
	var url="lite_client.html?init_user="+init_user+"&init_password="+init_password+"&init_room="+init_room;
	var win = window.open(url, "_123flashchat_lite", "resizable=1, width=" + win_width + ",height=" + win_height + ",status=1,top=0,left=0");
	
	
	if(document.customForm.customsize[0].checked)
		window.open(urlStr, "_123flashchat_lite", "resizable=1, width=" + win_width + ",height=" + win_height + ",status=1,top=0,left=0");
	else
	{
		
		window.open(urlStr, "_123flashchat_fullscreen_demo2", "resizable=1, fullscreen=1");
		//openFullScreenChat(urlStr);
	}
	
}

function openCustomStandardClient()
{
	var win_width = window.screen.width - 5;
	var win_height = window.screen.Height - 10;
	if(document.customForm.customsize[0].checked==true)
	{
			win_width=document.customForm.win_width.value;
			win_height=document.customForm.win_height.value;
	}
	
	if (win_width < 468 || isNaN(win_width))
	{
		alert("width can't be less than 468");
		return;
	}
	
	if (win_height < 360 || isNaN(win_width))
	{
		alert("height can't be less than 360");
		return;	
	}

	
	var urlStr= "flashchat8/123flashchat.html";
	var init_user;
	var init_password="";
	var init_room;
	var init_skin=(document.customForm.init_skin.value != "") ? document.customForm.init_skin.value : "default";
	var init_lang=document.customForm.init_lang[document.customForm.init_lang.selectedIndex].value;
	//var init_user=document.customForm.init_user.value;
	//var init_age =document.customForm.init_age.value;
	var init_birth=document.customForm.init_birth.value;
	var init_gender=document.customForm.init_gender.value;
	var init_location=document.customForm.init_location.value;
	init_location = encodeURIComponent(init_location);
	if(document.customForm.autologin[1].checked==true)
	{
			init_user=document.customForm.init_user.value;
	}
	
	if(document.customForm.roomlist[document.customForm.roomlist.selectedIndex].value=="true")
	{
			init_room="1";
	}
	
	var init_ad=document.customForm.adbanner[document.customForm.adbanner.selectedIndex].value;

	if(init_user!=undefined && document.customForm.autologin[1].checked==true)
	{
		init_user = encodeURIComponent(init_user);
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_user="+init_user:urlStr+"&init_user="+init_user;	
		urlStr+="&init_password="+init_password;
	}

	if(init_room!=undefined )
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_room="+init_room:urlStr+"&init_room="+init_room;
		if(urlStr.indexOf("init_user") == -1 && document.customForm.autologin[1].checked==true)
		{
			if(init_user==undefined)
			{
				init_user="guest";
			}
			init_user = encodeURIComponent(init_user);
			urlStr+="&init_user="+init_user;
			urlStr+="&init_password="+init_password;
		}
	}
	
	if(init_lang!="*")
	{
		urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_lang="+init_lang:urlStr+"&init_lang="+init_lang;
	}
	urlStr=(urlStr.indexOf("?")==-1)?urlStr+"?init_skin="+init_skin:urlStr+"&init_skin="+init_skin;
	urlStr+="&init_ad="+init_ad+"&init_gender="+init_gender+"&init_location="+init_location+"&init_birth="+init_birth;
	urlStr+="&init_host=www.123flashchat.com&init_port=51128&init_host_s=chat.123flashchat.com&init_port_s=80&init_host_h=chat2.123flashchat.com&init_port_h=80";
//window.alert(urlStr);	
	if(document.customForm.customsize[0].checked)
		var win = window.open(urlStr, "_123flashchat_demo", "resizable=1, width=" + win_width + ",height=" + win_height + ",status=1,top=0,left=0");
	else
		var win = window.open(urlStr, "_123flashchat_fullscreen_demo", "resizable=1, fullscreen=1" + ',width='+screen.width+',height='+screen.height);
}

function openPrivateWin(winId,w,h)
{
	window.open ("/privatewin.html?"+winId, "privateMsg_"+winId, "height="+h+", width="+w+", top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

