///confirm delete
function confirmSubmit()
{
var agree=confirm("NOTE: ALL DATA RELATED TO THIS RECORD WILL BE DELETED!\n -------------- ARE YOU SURE YOU WISH TO DELETE? --------------");
if (agree)
	return true ;
else
	return false ;
}

//show hide div layer
function ShowHideDiv(id)
{
	var div_style;
	var title;
	
	div_style = document.getElementById(id).style;
	title = document.getElementById(id+'Title');
	
	if(div_style.visibility == 'hidden')
	{
		div_style.visibility = 'visible';
		div_style.display = 'block';
		if(title)
			title.innerText = ' -';
	}
	else
	{
		div_style.visibility = 'hidden';
		div_style.display = 'none';
		if(title)
			title.innerText = '+';
	}
}

function ShowDiv(id)
{
	var div_style;
		
	div_style = document.getElementById(id).style;
		
	div_style.visibility = 'visible';
	div_style.display = 'block';
}

function HideDiv(id)
{
	var div_style;
	div_style = document.getElementById(id).style;

	div_style.visibility = 'hidden';
	div_style.display = 'none';
}
//open popup window
function windowOpen(url)
{	
	window.open(url, '_blank',  'left=20,top=20,width=700,height=500,toolbar=0,resizable=1,scrollbars=1');
}

//check decimal value
function checkNum(input) 
{
	acceptLength = 2;   
	if (isNaN(input) || input == "") 
	{
	    return false;
	}
	else 
	{    
	    if (input.indexOf('.') == -1) 
		{
	    	input += ".";
		}	
	    restText = input.substring(input.indexOf('.')+1, input.length);	
	    if (restText.length > acceptLength)
	    {
	 		return false;
	    }
	    else 
	 	{
			return true;
	    }
  	}
}
function checkMail(email)
{
	var x = email;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;	
	return false;
}
function trim(str)
{
	return str.replace(/^\s+|\s+$/, ''); 
}

function DropDownSelected(theSel){
	for(i=0; i<theSel.length; i++){		
		if(theSel.options[i].selected && theSel.options[i].value != '')return true;
	}
	return false;
}