﻿ //Manage Registartion
 function confirmEdit(str)
	{
	    try {
	        var i=0;
	        var chkCounter = 0;
	        var gvMain = document.getElementById(str);    
	        var rows = gvMain.rows;    	    
    	    
	        for(var i=1;i<rows.length;i++)
	        {
	            if(rows[i].getElementsByTagName("input")[0]!= undefined)
	            {
	                if(rows[i].getElementsByTagName("input")[0].checked == true)
	                {
	                    chkCounter = chkCounter + 1;
	                }
	            }
	        }
	        if(chkCounter > 1)
	        {
	            alert("Please select only one record ");
	            return false;
	        }
	        if(chkCounter == 0)
	        {
	            alert("Please select the record ");
	            return false;
	        }
	   }
        catch(e) { }
	}

  function confirmDelete(str)
	{
	    try {
	        var i=0;
	        var chkCounter = 0;
	        var gvMain = document.getElementById(str);    
	        var rows = gvMain.rows;    	    
    	    
	        for(var i=1;i<rows.length;i++)
	        {
	            if(rows[i].getElementsByTagName("input")[0]!= undefined)
	            {
	                if(rows[i].getElementsByTagName("input")[0].checked == true)
	                {
	                    chkCounter = chkCounter + 1;
	                }
	            }
	        }
	        if(chkCounter == 0)
	        {
	            alert("Please select the record ");
	            return false;
	        }

	        if (chkCounter >= 1) {
	            return confirm("Are you sure want to Delete the selected Records ?");
	        }
	   }
        catch(e) { }
	}

	function confirmSusp(str) {
	    try {
	        var i = 0;
	        var chkCounter = 0;
	        var gvMain = document.getElementById(str);
	        var rows = gvMain.rows;

	        for (var i = 1; i < rows.length; i++) {
	            if (rows[i].getElementsByTagName("input")[0] != undefined) {
	                if (rows[i].getElementsByTagName("input")[0].checked == true) {
	                    chkCounter = chkCounter + 1;
	                }
	            }
	        }
	        if (chkCounter == 0) {
	            alert("Please select the record ");
	            return false;
	        }

	        if (chkCounter >= 1) {
	            return confirm("Are you sure want to Suspend the selected Job ?");
	        }
	    }
	    catch (e) { }
	}
	function confirmOpen(str) {
	    try {
	        var i = 0;
	        var chkCounter = 0;
	        var gvMain = document.getElementById(str);
	        var rows = gvMain.rows;

	        for (var i = 1; i < rows.length; i++) {
	            if (rows[i].getElementsByTagName("input")[0] != undefined) {
	                if (rows[i].getElementsByTagName("input")[0].checked == true) {
	                    chkCounter = chkCounter + 1;
	                }
	            }
	        }
	        if (chkCounter == 0) {
	            alert("Please select the record ");
	            return false;
	        }

	        if (chkCounter >= 1) {
	            return confirm("Are you sure want to Open the selected Job ?");
	        }
	    }
	    catch (e) { }
	}
	function confirmClose(str) {
	    try {
	        var i = 0;
	        var chkCounter = 0;
	        var gvMain = document.getElementById(str);
	        var rows = gvMain.rows;

	        for (var i = 1; i < rows.length; i++) {
	            if (rows[i].getElementsByTagName("input")[0] != undefined) {
	                if (rows[i].getElementsByTagName("input")[0].checked == true) {
	                    chkCounter = chkCounter + 1;
	                }
	            }
	        }
	        if (chkCounter == 0) {
	            alert("Please select the record ");
	            return false;
	        }

	        if (chkCounter >= 1) {
	            return confirm("Are you sure want to Close the selected Job ?");
	        }
	    }
	    catch (e) { }
	}
 function box()
	{
     if(event.keyCode >= 97 && event.keyCode <= 122)
        event.keyCode -= 32;
		
	//
	var str=document.getElementById("txtPan").value;
	//alert(event.keyCode)
	 //else if(str.charCodeAt(6)< 48  || str.charCodeAt(6)>57)
	if(str.charCodeAt(0)< 65 || str.charCodeAt(0)>90)
	{
    return false;
	}
	else if(str.charCodeAt(1)< 65 || str.charCodeAt(1)>90)
	{
    return false;
	}
	else if(str.charCodeAt(2)< 65 || str.charCodeAt(2)>90)
	{
    return false;
	}
	else if(str.charCodeAt(3)< 65 || str.charCodeAt(3)>90)
	{
    return false;
	}
	//	
		
	 var charCode = event.keyCode
       if (charCode > 31 && (charCode < 65 || charCode > 90)&&(charCode < 48 || charCode > 57))
        return false;
			
         return true;
	}
	
	
	
	function showWait()
{
    if ($get('ctl00_MainContent_upFileName').value.length > 0)
    {
        $get('ctl00_MainContent_UpdateProgress1').style.display = 'block';
        return true;
    }
}

function showWaitForPer()
{
    if ($get('ctl00_MainContent_uploadFile').value.length > 0)
    {
        $get('ctl00_MainContent_UpdateProgress1').style.display = 'block';
        return true;
    }
}
//var allCon=false;
//function checking()
//{

//var chkCon=false;
//chkCon=confirm('A file already exists.Overwrite it ?');
//if(chkCon)
//{
//allCon=true; 
//}

//var answer=confirm('A file already exists.Overwrite it ?');
//if(answer=="true")
//{
//document.getElementById("ctl00_MainContent_btnUpdate").click(); 
//}
//else
//{
//return ;
//}
//}


function showConfirm()
{
//var agree=confirm("Want to overwrite?");
    if (confirm("Want to overwrite?")==true)
    {
	return true ;
	}
    else
    {
	return false ;
    }
    

}
function noCopyMouse(e) {
    var isRight = (e.button) ? (e.button == 2) : (e.which == 3);

    if (isRight) {
        alert('You are prompted to type this twice for a reason!');
        return false;
    }
    return true;
}

function noCopyKey(e) {
    var forbiddenKeys = new Array('c', 'x', 'v');
    var keyCode = (e.keyCode) ? e.keyCode : e.which;
    var isCtrl;

    if (window.event)
        isCtrl = e.ctrlKey
    else
        isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;

    if (isCtrl) {
        for (i = 0; i < forbiddenKeys.length; i++) {
            if (forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                alert('You are prompted to type this twice for a reason!');
                return false;
            }
        }
    }
    return true;
}

function noCTRL(e) {
    var code = (document.all) ? event.keyCode : e.which;

    var msg = "Sorry, this functionality is disabled.";
    if (parseInt(code) == 17) //CTRL
    {
        alert(msg);
        window.event.returnValue = false;
    }
}

//Print

function CallPrint(strid) {
    var prtContent = document.getElementById(strid);
    var WinPrint = window.open('', '', 'right=10,left=0,top=5,width=900,height=700,toolbar=0,scrollbars=0,status=0');
    WinPrint.document.write(prtContent.innerHTML);
    WinPrint.document.close();
    WinPrint.focus();
    WinPrint.print();
    WinPrint.close();

}
