// Default javascript document

function getByID(id)
{
	var tmp = document.getElementById? document.getElementById(id): null;
	return tmp;
}

function goback() {	javascript:history.go(-1); }

function popupwindow (url, height, width)
{
	window.open (url, null, 'location=0,status=0,scrollbars=0,resizable=1,width=' + width + ',height=' + height); 
}

function popupwindow_scroll (url, height, width)
{
	window.open (url, null, 'location=0,status=0,scrollbars=1,resizable=1,width=' + width + ',height=' + height); 
}



function checkemail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) return true;
	else return false;
}

function input_check_all(chk_all, chk)
{
	try
	{
		var chkAll = chk_all;
		var chkCmb = chk;
		
		if (chkCmb[0] != null)
		{	
			for (var i=0; i<chkCmb.length; i++)
				chkCmb[i].checked = chkAll.checked;
		}
		else
		{
			chkCmb.checked = chkAll.checked;
		}
	} 
	catch (e) 
	{}
}

function getSel()
{
	var txt = '';
	var foundIn = '';
	if (window.getSelection)
	{
		txt = window.getSelection();
		foundIn = 'window.getSelection()';
	}
	else if (document.getSelection)
	{
		txt = document.getSelection();
		foundIn = 'document.getSelection()';
	}
	else if (document.selection)
	{
		txt = document.selection.createRange().text;
		foundIn = 'document.selection.createRange()';
	}
	else return;
	
	document.forms[0].selectedtext.value = 'Found in: ' + foundIn + '\n' + txt;
}

function setValue(id, val)
{
	getByID(id).value = val; 
}

function showHide(id)
{
	var o = getByID(id); 
	if (o.style.display != 'none')
		o.style.display = 'none'
	else
		o.style.display = 'block';
}
