function msgCnfrm(mmsg) 
	{return confirm(mmsg);}
	
function uploadOpenWin(rUrl, rWinName)
{
	if (window.name==rWinName)
	{
		window.location=rUrl;window.focus();
	}else{
	javascript:mwin=window.open(rUrl, rWinName , "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400, height=150");
	mwin.focus();}
}

function ValidateDGSearchResults(ItemID){
	var IsAnyChecked = false;
	var aReturn= document.body.getElementsByTagName('input');
	for(i=0; i < aReturn.length; i++ )
	{
		if( (aReturn[i].id).indexOf(ItemID) > -1 )
			if (aReturn[i].checked )
			{
				IsAnyChecked = true 
				return true;
			}
		 
	}
	if( ! IsAnyChecked)
	{
		alert("Please Select an item!");
		return false;
	}
}

function CheckAll(ItemID, Item){
	var aReturn= document.body.getElementsByTagName('input');
	for(i=0; i < aReturn.length; i++ )
	{
		if( (aReturn[i].id).indexOf(ItemID) > -1 )
			aReturn[i].checked = Item.checked;
	}
	
}

function dgSearchResultsCheckAll(obj){
	var x = obj.getElementsByTagName("input")
	var xx = true
	for (i=1 ; i<x.length; i++){
		if (! x[i].checked) {
			xx = false
			break;
		}	
	}
	
	document.getElementById("chkAllSearchResults").checked = ! xx;

}

function dgChosenResultsCheckAll(obj){
	var x = obj.getElementsByTagName("input")
	var xx = true
	for (i=1 ; i<x.length; i++){
		if (! x[i].checked) {
			xx = false
			break;
		}	
	}
	document.getElementById("chkAllChosenResults").checked = xx;

}




function addField(avBox,selBox)
{
	avBox=document.all(avBox)
	selBox=document.all(selBox)
	fl_add_country=true
	for (i=0; i< avBox.options.length; i++)
			{
				if (avBox.options(i).selected)
				{
					fl_add_country=false
					lastn=selBox.length
					selBox.length=lastn+1
					selBox.options[lastn].text=avBox.options(i).text;
					selBox.options[lastn].value=avBox.options(i).value;
					avBox.options[i]=null;
					i=i-1
				}
			}
			if (fl_add_country==true)
			{
				alert("Please Select an Item to Add")
				avBox.focus
			}
	}
	
	function moveAll(avBox,selBox)
	{
		avBox=document.all(avBox)
		selBox=document.all(selBox)
		for (i=0; i< avBox.options.length; i++)
			{
				lastn=selBox.length
				selBox.length=lastn+1
				selBox.options[lastn].text=avBox.options(i).text;
				selBox.options[lastn].value=avBox.options(i).value;
				avBox.options[i]=null;
				i=i-1
			}
	}
	
	function delField(selBox,avBox)
	{
	avBox=document.all(avBox)
	selBox=document.all(selBox)
		fl_del_country=true
		for (i=0; i< selBox.options.length; i++)
			{
				if (selBox.options(i).selected)
				{
					fl_del_country=false
					lastn=avBox.length
					avBox.length=lastn+1
					avBox.options[lastn].text=selBox.options(i).text;
					avBox.options[lastn].value=selBox.options(i).value;
					selBox.options[i]=null;
					i=i-1
				}
			}
			if (fl_del_country==true)
			{
				alert("Please Select an Item to Remove")
				selBox.focus
			}
	}
	
function previewOpenWin(rUrl, rWinName)
{
	if (window.name==rWinName)
	{
		window.location=rUrl;window.focus();
	}else{
	javascript:mwin=window.open(rUrl, rWinName , "toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1024, height=600");
	mwin.focus();}
}
function setFoucs(obj)
{
	//alert("dsffssd");
	if(event.which || event.keyCode)
	{
		if ((event.which == 13) || (event.keyCode == 13)) 
		{
			document.getElementById(obj).click();
			return false;
		}	
	}else
	return true;			
}

	
		