// JavaScript Document

 									/* Function to Save  And validation of Enter DD details */
function userDD_details()
{ 
	
	if($('ddNum').value=='')
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter your DD Number!';
		$('ddNum').focus();
		return;
	}
	if(isNaN($('ddNum').value))
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter numeric values for DD number!';
		$('ddNum').focus();
		return;
	}
	if($('date11').value=='')
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter Date!';
		$('date11').focus();
		return;
	}
	if($('bank').value=='')
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter your bank name!';
		$('bank').focus();
		return;
	}
	if($('ddamt').value=='')
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter your amount!';
		$('ddamt').focus();
		return;
	}
	if($('Inwords').value=='')
	{
		$('message').style.display='block';
		$('message').innerHTML='Please enter your amount in words!';
		$('Inwords').focus();
		return;
	}
	thisForm.txtWhat2Do.value = 'SAVEDDDETAILS';
	thisForm.action="ddDetails.php";
	thisForm.submit();
}	
										/*Functioin to show DD balance amount */
function showbalance_amount()
{	 
	var totAmt = Number($('totAmt').value);
	var ddAmt  = Number($('ddamt').value);
	var balance	=	 totAmt - ddAmt;
	$('balamt').value = balance;
}
										/*Functioin to show DD balance amount for relase order */
/*function showbalance()
{	 
	var totAmt = Number($('total').value);
	var ddAmt  = Number($('txtDD').value);
	var balance	=	 totAmt - ddAmt;
	$('balamt').value = balance;
}
*/	
										/*Function to Get Enter DD Details Form */
function GetDDForm()
{ 
	thisForm.txtWhat2Do.value="GETFORM";
	thisForm.action='ddDetails.php';
	thisForm.submit();
}
										/*Function to hide Error message Div*/
function hideErrorMsgDiv()
{
	$('message').style.display='none';
	return false;		
}
										/*Function to Convert Number to Figure*/
function numbertofigures_forschool(ddamt)
{ 
	url         =   base_url+"ajaxdatatransfer.php";
    params      =   "ddamt="+escape(ddamt);
    new Ajax.Request(url,
                        {
                            method      :   "post",
                            parameters  :   params,
                            onComplete  :   update_dd_amount
                        }
                    );
	function update_dd_amount(req_obj)
	{
		$("Inwords").value = req_obj.responseText;
	}                    
}
									/*Function to Convert Number to Figure during Release order*/
function numbertofigures_releaseorder(txtDD)
{ 
	url         =   base_url+"ajaxdatatransfer.php";
    params      =   "txtDD="+escape(txtDD);
    new Ajax.Request(url,
                        {
                            method      :   "post",
                            parameters  :   params,
                            onComplete  :   update_dd_amount
                        }
                    );
	function update_dd_amount(req_obj)
	{
		$("txtDDWords").value = req_obj.responseText;
	}                    
}
function editnews()
{ 
	thisForm.txtWhat2Do.value = 'EDITNEWS';
	thisForm.action='addnews.php';
	thisForm.submit();
}
function updatenews()
{ 	
	thisForm.txtWhat2Do.value = 'UPDATENEWS';
	thisForm.action='addnews.php';
	thisForm.submit();
}
function savenewsdata()
{ 
	if($('news').value == '')
	{
		alert('Please Enter Your News Content');
		$('news').focus();
		return;
	}
	thisForm.txtWhat2Do.value = 'SAVENEWS';
	thisForm.action='addnews.php';
	thisForm.submit();
}


function addnews()
{
	thisForm.txtWhat2Do.value = 'ADDNEWS';
	thisForm.action='addnews.php';
	thisForm.submit();
}
function cancelnewspanel()
{ 

	thisForm.action='addnews.php';
	thisForm.submit();
}