// JavaScript Document
function DisplayOtherTownField()
{
	if (document.getElementById('selTown').selectedIndex == 1)
	{
		document.getElementById('tdTown').style.display = 'block';
	}
	else
	{
		document.getElementById('tdTown').style.display = 'none';
		document.getElementById('txtTown').value = '';
	}
}

function OpenPopupWindow(url)
{
	window.open(url,'_blank','status = no,toolbar = no,top = 100, width = 600, scrollbars = yes');
}

function OpenCustomPopupWindow(url, top, left, width, height)
{
	window.open(url,'_blank','status = no,toolbar = no,top = ' + top   + ', left = ' + left + ', width = ' + width  + ', height = ' + height);
}

function ConfirmShortUrl(url)
{
	if (window.confirm('The short url can be created only one and can not change after that. Are you sure about this name ?'))
		if (window.confirm('Once again we would like to confirm that this short url can not be change after creating. Are you sure?'))
			return true;
	return false;
}

function SelectIpCheckBox()
{
	var frm = document.forms[0];
	var e = frm.elements.length;
	//alert(e);
	for (i=0; i<e; i++)
	{
		temp = frm.elements[i].id;
		//alert (substring(frm.elements[i].id,0,6));
		if (temp.substring(0,6) == 'chkBan')
		{
			frm.elements[i].checked = 'checked';
		}
	}
}

function ConfirmBan()
{
	return confirm('Are you sure to ban these IP and delete this member?\nAll information of this member will be deleted along such as forum, topic, comment, etc.');
}

function ConfirmDelete()
{
	return confirm('Are you sure to delete this member?\nAll information of this member will be deleted along such as forum, topic, comment, etc.');
}

function CheckAll(frm, flag)
{
	var e;
	for (i=0; i<frm.elements.length; i++)
	{
		e = frm.elements[i];
		if (e.type=='checkbox')
		{
			e.checked = flag;
		}
	}
}

function IsCheck(frm)
{
	var e;
	for (i=0; i<frm.elements.length; i++)
	{
		e = frm.elements[i];
		if (e.type=='checkbox' && e.checked == true)
		{
			return true;
		}
	}
	return false;
}

function getCheckedValue(radioObj) 
{
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
	{
		if(radioObj.checked)
		{
			return radioObj.value;
		}
		else
			return "";
	}
	var addresses = '';
	for(var i = 0; i < radioLength; i++) 
	{
		if(radioObj[i].checked) 
		{
			addresses = addresses + radioObj[i].value + ';';
		}
	}
	return addresses;
}

function GetEmail()
{
	window.opener.GetToAddress(getCheckedValue(document.forms[0].elements['chkSelect']));
}    

function GetToAddress(toAddress)
{
	document.getElementById("address").value = document.getElementById("address").value + toAddress;
}

