function rsHistory(uid)
{
	window.open("../popups/rs_history.php?uid=" + uid, "RsHist", "width=850,height=550,menubar=no,scrollbars=yes,resizable=no");	
}

function regDest(tento, dst)
{
	if (dst == 1)
	{
		getDataForDIV('tools/pump_item.php?item=region&id='+tento.value, 'fregion');
		getDataForDIV('tools/pump_item.php?item=city&id='+tento.value, 'fcity');
	}
	if (dst == 2)
		getDataForDIV('tools/pump_item.php?item=city&id='+tento.value, 'fcity');

	if (dst == 3)
		getDataForDIV('tools/pump_item.php?item=cityp&id='+tento.value, 'tmpid');
}

function loginFocus()
{
	document.loginForm.Login.focus();
}

function callTel(p_call, p_list)
{
	window.open("../popups/dch_tel.php?cid=" + p_call + '&lid=' + p_list, "Dialog" + p_call,"width=350,height=250,menubar=no,scrollbars=yes,resizable=yes");
}

function startDialog(p_id)
{
	window.open("../popups/dialog.php?id=" + p_id, "Dialog" + p_id,"width=720,height=540,menubar=no,scrollbars=yes,resizable=yes");
}

function addDoc(p_id)
{
	window.open("../popups/docadd.php",  "delDoc","width=800,height=640,menubar=no,scrollbars=yes,resizable=yes");
}

function editDoc(p_id)
{
	window.open("../popups/docedit.php?id=" + p_id,  "delDoc","width=800,height=640,menubar=no,scrollbars=yes,resizable=yes");
}

function delDoc(p_id)
{
	window.open("../popups/docdel.php?id=" + p_id,  "delDoc","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function toNick(p_nick)
{
	document.getElementById('To').value = p_nick;
}

function fillNick(p_nick)
{
	DeskForm.To.value = p_nick;
}

function showRadio(p_id)
{
	window.open("../popups/radio.php", "DCHradio","width=320,height=150,menubar=no,scrollbars=no,resizable=no");
}

function delRoom(p_id)
{
	window.open("../popups/roomdel.php?id=" + p_id,  "delStore","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function phtDel1(p_id, p_aid, p_pg)
{
	window.open("../popups/photodel1.php?id=" + p_id + "&aid=" + p_aid + "&page=" + p_pg,  "delStore","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function photoAdd1(p_id, p_pg)
{
	window.open("../popups/photoadd1.php?aid=" + p_id + "&page=" + p_pg, "Album","width=500,height=170,menubar=no,scrollbars=no,resizable=no");	
}

function albDel1(p_id)
{
	window.open("../popups/albumdel1.php?id=" + p_id,  "delStore","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function dt_edit(p_id, p_rid)
{
	window.open("../popups/dt_edit.php?id=" + p_id + "&rid=" + p_rid,  "delStore","width=600,height=250,menubar=no,scrollbars=no,resizable=no");
}

function albDel(p_id)
{
	window.open("../popups/albumdel.php?id=" + p_id,  "delStore","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function phtDel(p_id, p_aid)
{
	window.open("../popups/photodel.php?id=" + p_id + "&aid=" + p_aid,  "delStore","width=300,height=120,menubar=no,scrollbars=yes,resizable=yes");
}

function delStore(p_id)
{
	window.open("../popups/storedel.php?id=" + p_id,  "delStore","width=300,height=150,menubar=no,scrollbars=yes,resizable=yes");
}

function delItem(p_id, p_iid)
{
	window.open("../popups/itemdel.php?id=" + p_id + "&iid=" + p_iid, "delItem","width=300,height=150,menubar=no,scrollbars=yes,resizable=yes");
}

function showItem(p_id)
{
	window.open("../popups/download.php?id=" + p_id, "showItem","width=300,height=200,menubar=no,scrollbars=yes,resizable=yes");
}

function addItem(p_id)
{
	window.open("../popups/itemadd.php?sid=" + p_id, "Item","width=500,height=210,menubar=no,scrollbars=no,resizable=no");	
}

function disableButton(tento)
{
	tt = document.getElementById('pg');
	tento.style.visibility = "hidden";
	tt.style.visibility = "visible";
}

function frmSubmit(thisis, p_url)
{
	location.replace('../?lang=' + thisis.value + p_url);
}

function sendFM(p_sid, p_tid){
	window.open("../popups/fastmsg.php?sid=" + p_sid + "&tid=" + p_tid, "_new","width=470, height=500,menubar=no,scrollbars=yes,resizable=no");
}

function showFM(p_tid){
	window.open("../popups/showfm.php?tid=" + p_tid, "_new","width=470, height=500,menubar=no,scrollbars=yes,resizable=no");
}

function replyFM(p_msgid, p_srcid){
	window.open("../popups/replymsg.php?mid=" + p_msgid + "&srcid=" + p_srcid, "_self");
}

function newFM(){
	window.open("../popups/newfm.php", "_new","width=470, height=500,menubar=no,scrollbars=yes,resizable=no");
}

// for popups
function popup_window(url, width, height) {
	if (document.all) {
		var left = (event.screenX + 10);
		var top = (event.screenY - height + (height / 4));
	} else {
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
	}
	var popup = window.open(url, "", "width=450,height=340,left=" + left + ",top=" + top);
}

function popup_window_multi(url, width, height, counter) {
	if (document.all) {
		var left = (event.screenX + 10);
		var top = (event.screenY - height + (height / 4));
	} else {
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
	}
	var el = document.getElementById('active_item');
	el.value = counter;
	var popup = window.open(url, "", "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);
}

function popup_window2(url, width, height) {
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	var popup = window.open(url, "", "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top+",scrollbars=yes,resizable=no");
}

function popup_value(inputValueId, value) {
	if ((window.opener == null) || (window.opener == window)) {
		return;
	}
	var inputValueRef = window.opener.document.getElementById(inputValueId);
	tmpVal = inputValueRef.value;
	inputValueRef.value = tmpVal + value;
	window.close();
	inputValueRef.focus();
}

function popup_value_multi(inputValueId, inputNameId, value, name) {
	if ((window.opener == null) || (window.opener == window)) {
		return;
	}
	var c = window.opener.document.getElementById('active_item');
	var inputValueRef = window.opener.document.getElementById(inputValueId+'_'+c.value);
	var inputNameRef = window.opener.document.getElementById(inputNameId+'_'+c.value);
	inputValueRef.value = value;
	inputNameRef.value = name;
	window.close();
}

function set_homepage() {
	var explorer;
	explorer = navigator.appName;
	if (explorer == 'Microsoft Internet Explorer') {
		document.body.style.behavior="url(#default#homepage)";
		document.body.setHomePage('http://www.dailychat.eu/');
	}
	else {
		window.location = 'http://www.dailychat.eu/';
	}
}

function changeData(thisis){
	RegForm.submit();
}

function changeGroup(thisis){
	SmileForm.submit();
}

function showPortrait(p_id, p_width, p_height)
{	
	window.open("../popups/portrait.php?pid=" + p_id, "Portrait","width=" + p_width +", height=" + (p_height+55) + ",menubar=no,scrollbars=no,resizable=no");	
}

function ashowPortrait(p_id, p_width, p_height)
{	
	window.open("../popups/aportrait.php?pid=" + p_id, "Portrait","width=" + p_width +", height=" + (p_height+25) + ",menubar=no,scrollbars=no,resizable=no");	
}

function ashowPhoto(p_id, p_width, p_height)
{	
	window.open("../popups/ashowphoto.php?pid=" + p_id, "Photo","width=" + p_width +", height=" + (p_height+27) + ",menubar=no,scrollbars=no,resizable=no");	
}

function showPhoto(p_id, p_width, p_height)
{	
	window.open("../popups/showphoto.php?pid=" + p_id, "Photo","width=" + p_width +", height=" + (p_height+27) + ",menubar=no,scrollbars=no,resizable=no");	
}

function photoAdd(p_id)
{
	window.open("../popups/photoadd.php?aid=" + p_id, "Album","width=500,height=170,menubar=no,scrollbars=no,resizable=no");	
}
	
function showStreamer(p_uid)
{
	window.open("../popups/streamer.php?uid=" + p_uid, "Streamer","width=240, height=200,menubar=no,scrollbars=no,resizable=no");
}

function openInfo(p_uid){
	window.open("../popups/info.php?id=" + p_uid, "Info","width=400, height=250,menubar=no,scrollbars=no,resizable=no");
}

function charCnt(p_max)
{
  if (DeskForm.MsgBody.value.length > p_max) 
  {
		DeskForm.MsgBody.value = DeskForm.MsgBody.value.substring (0,p_max);
		DeskForm.cntMax.value=(p_max - DeskForm.MsgBody.value.length);
	}
	else 
	{
		DeskForm.cntMax.value=(p_max - DeskForm.MsgBody.value.length);
	}
}

function showMsgLogin()
{
	alert("Pre náhľad fotografie musíš byť registrovaný a prihlásený.");
}

function framePhoto(photoid, evt) 
{
	document.getElementById("minifoto").src="http://img.dailychat.eu/process/portraits/thumbs/" + photoid;
	document.getElementById("minifoto").onload=document.getElementById("minifotodiv").style.visibility = 'visible';

	var isIE = document.all ? true : false;
	
	document.getElementById("minifotodiv").style.left = document.body.clientWidth-129;
	document.getElementById("minifotodiv").style.top = 3;
}

function closeFrame()
{
	document.getElementById("minifotodiv").style.visibility="hidden";
}

function openBoom(style)
{
	//window.open('http://boomradio.eu/boomradio/radio.php','BoomPlayer','width=300,height=210,top=0,left=0,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,fullscreen=no,channelmode=no').focus();
	window.open("../popups/radio.php?station=chill",  "DCHradio","width=350,height=160,menubar=no,scrollbars=no,resizable=no");
}