function OpenCalandar(formName, txtField)
{
	w=window.open("CalendarPopUp.aspx?formname="+ formName +"." + txtField,"calendar_window","width=220,height=220");
	w.focus();
}

function CheckboxSelectAll(gridName, status) {
	var i;
	
	for (i=0; i < document.forms[0].elements.length; i++) {
		
		if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf(gridName) > -1))							{
			if (!document.forms[0].elements[i].disabled)
			{
				document.forms[0].elements[i].checked = status;
			}
		}
	}
}

function Preview(url)
{
	w=window.open(url); 
	w.focus();
	return true;
}

function OpenModalDialog(url)
{
	window.showModalDialog(url, '', 'dialogHeight:300px; dialogWidth:400px; status:no; help:no; resizable:yes; dialogScrollbars:no;'); 
}
function OpenDialog(url)
{
	w = window.open(url, '', 'width=600,height=500,scrollbars = yes,resizable=yes'); 
	if (w.opener == null) w.opener = self
	w.focus();
	return false;
}
function OpenWideDialog(url)
{
	w = window.open(url, '', 'width=900,height=200,scrollbars = yes,resizable=yes'); 
	if (w.opener == null) w.opener = self
	w.focus();
}
function CloseCurrentAndRefreshParent()
{
	opener.document.forms[0].submit();
	window.close();
}
function RefreshParent()
{
	opener.document.forms[0].submit();
}
function SetTableVisiability(dropdownlistID,dgtableID, rowtableID)
{
	var table = document.getElementById(dgtableID);
	var rows = document.getElementById(rowtableID);
	var ddl = document.getElementById(dropdownlistID);
	if ( ddl.options[ddl.selectedIndex].value == '0')//textbox
	{
		table.style.display ='none';
		rows.style.display ='';
	}
	else
	{
		table.style.display ='';
		rows.style.display ='none';
	}
}
function SetApproverVetterRenmarksVisiability(checkboxID,ddlvetterID, ddlapproverID, txtremarksID)
{
	var visiable = !document.getElementById(checkboxID).checked;
	if (visiable)
	{
		if ( document.getElementById(ddlvetterID) != null)
		{
			document.getElementById(ddlvetterID).style.display = '';
		}
		if ( document.getElementById(ddlapproverID) != null)
		{
			document.getElementById(ddlapproverID).style.display = '';
		}
		if ( document.getElementById(txtremarksID) != null)
		{
			document.getElementById(txtremarksID).style.display = '';
		}
	}
	else
	{
		if ( document.getElementById(ddlvetterID) != null)
		{
			document.getElementById(ddlvetterID).style.display = 'none';
		}
		if ( document.getElementById(ddlapproverID) != null)
		{
			document.getElementById(ddlapproverID).style.display = 'none';
		}
		if ( document.getElementById(txtremarksID) != null)
		{
			document.getElementById(txtremarksID).style.display = 'none';
		}
	}
}
function SetElementVisiability(checkboxID, elementID)
{
	var visiable = !document.getElementById(checkboxID).checked;
	if (visiable)
	{
		if ( document.getElementById(elementID) != null)
		{
			document.getElementById(elementID).style.display = '';
		}
	}
	else
	{
		if ( document.getElementById(elementID) != null)
		{
			document.getElementById(elementID).style.display = 'none';
		}
	}
}
function SetElementVisiabilityExplicit(visiable, elementID)
{
	if (visiable)
	{
		
		if ( document.getElementById(elementID) != null)
		{
			document.getElementById(elementID).style.display = '';
		}
	}
	else
	{
		if ( document.getElementById(elementID) != null)
		{
			document.getElementById(elementID).style.display = 'none';
		}
	}
}
function ActivateFlash(src)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" height="277px" width="628px"  VIEWASTEXT>');
document.write('<param name="movie" value="' + src + '">');
document.write('<param name="quality" value="high">');
document.write('<param name="menu" value="false">');
document.write('<embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" /></object>');
}
function test(){
var i = 0;
alert('jkdk');

alert('2');
alert('3');
alert('4');

}
function OpenLink(controlID)
{
			ddl = document.getElementById(controlID);
			url = ddl.options[ddl.selectedIndex].value;
			if (url != '')
			{
				//w=window.open(url,'','');
				//w.focus();
				window.location=url;
			}
}
