﻿// JScript File
window.history.forward(1); 
window.status = "Developed By Systematix Software Team";
var message="You are Not Authorized to perform this Operation";
var shell;
function click(z) 
{
 if (document.all) 
 {
  if (event.button == 2) 
  {
   alert(message);
   return false;
  }
 }

 if (document.layers) 
 {
  if (z.which == 3) 
  {
   alert(message);
   return false;
  }
 }
}



if (document.layers) 
{
 document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

function rejection_reason(ctrl1)
{
    var str = '';
    while ((str == null) || (str == ''))
    {
        str = window.prompt('Enter the rejection reason....','');
    }
    document.getElementById(ctrl1).value=str;
    return;
}

function printSpecial(ctr1) 
{
	var gAutoPrint = true;
	if (document.getElementById != null) 
	{
		var html;
		var printReadyElem = document.getElementById(ctr1); 
		if (printReadyElem != null) 
		{ 
			if (printReadyElem.innerHTML != '')
			{
			    html = printReadyElem.innerHTML; 
			}
			else
			{
			    alert("Please Generate Report First"); 
			    return; 
			}
		} 
		else 
		{ 
			alert("Could not find the printReady section in the HTML"); 
			return; 
		} 
		var printWin = window.open("","printSpecial","location=0,scrollbars=0,status=0,toolbar=0,menubar=0,resizable=0,width=1,height=1;"); 
		//var printWin = window.open("","printSpecial",""); 
		printWin.document.open(); 
		printWin.moveTo(7500,1000);
		printWin.document.write(html); 
		printWin.document.close(); 
		if (gAutoPrint) printWin.print();
		//printWin.close(); 
		printWin.close(); 
	}
	else 
	{ 
		alert("Sorry, the print ready feature is only available in modern browsers."); 
	} 
}

// Added by rachita for HelpDesk
function Show_Hide()
{
        if(document.getElementById('btnhide').value=='Show')
        {
            window.parent.document.getElementById('Contents').style.visibility='';
            window.parent.document.getElementById('menuset').cols="190,*";
            document.getElementById('btnhide').value='Hide';                
        }
        else if(document.getElementById('btnhide').value=='Hide')
        {
            window.parent.document.getElementById('Contents').style.visibility='hidden';
            window.parent.document.getElementById('menuset').cols="0,*";
            document.getElementById('btnhide').value='Show';                              
       }            
}

//Added by rachita for Helpdesk 
function showDate()
{
var dt=new Date();
var dd=dt.getDate();
var mm=dt.getMonth()+1;
var yyyy=dt.getYear();
document.getElementById('txtdatetime').value=dt;
document.getElementById('txtdatetime').value=document.getElementById('txtdatetime').value.replace(document.getElementById('txtdatetime').value.substring(document.getElementById('txtdatetime').value.indexOf("UTC")+8,document.getElementById('txtdatetime').value.indexOf("UTC")),"");
timer=setTimeout("showDate()",100);
}  



function printSpecial_1(ctr1) 
{
	var gAutoPrint = true;
	if (document.getElementById != null)
	{
		var html;
		var printReadyElem = document.getElementById(ctr1); 
		if (printReadyElem != null) 
		{ 
			if (printReadyElem.innerHTML != '')
			{
			    html = printReadyElem.innerHTML; 
			    //html = html.replace('<TD noWrap>','<TD nowrap><font size=1>');
			    //html = html.replace('</TD>','</font></TD>');
			    
			}
			else
			{
			    alert("Please Generate Report First"); 
			    return; 
			}
		} 
		else 
		{ 
			alert("Could not find the printReady section in the HTML"); 
			return; 
		} 
		//alert(printReadyElem.innerHTML);
		// + printReadyElem.innerHTML;
		//window.open('../Common/PrintData.aspx?Dataprint='+html,'printSpecial','location=0,scrollbars=0,status=0,toolbar=0,menubar=1,resizable=0,width=640,height=640;'); 
		var printWin = window.open("","printSpecial",'location=0,scrollbars=0,status=0,toolbar=0,menubar=1,resizable=0;'); 
		printWin.document.open(); 
		printWin.moveTo(7500,1000);
		printWin.document.write(html); 
		printWin.document.close(); 
		if (gAutoPrint) 
		{
		    printWin.print();		    
		}
		printWin.close(); 
	}
	else 
	{ 
		alert("Sorry, the print ready feature is only available in modern browsers."); 
	} 
}


function validatepassword()
{
    if(document.getElementById('txtoldpassword').value == '')
    {
        alert('Enter Old Password');
        document.getElementById('txtoldpassword').focus();
        return false;
    }
    else if(document.getElementById('txtnewpassword').value == '')
    {
        alert('Enter NEW Password');
        document.getElementById('txtnewpassword').focus();
        return false;
    }
    else if(document.getElementById('txtnewconfpassword').value == '')
    {
        alert('Enter Confirm Password');
        document.getElementById('txtnewconfpassword').focus();
        return false;
    }
    else if(document.getElementById('txtnewpassword').value != document.getElementById('txtnewconfpassword').value)
    {
        alert('New Password And Confirm Password Does Not Match');
        document.getElementById('txtnewpassword').focus();
        return false;
    }
    else if(document.getElementById('txtnewpassword').value.length < 6 )
    {
        alert('Password Length should be 5 Character Minimum');
        document.getElementById('txtnewpassword').focus();
        return false;
    }
    else 
    {
        var ValidAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        var Validnumber = "0123456789";
        var Validspecialcharacter = "@#$*";
        var aplhabool,numbool,specbool;
        var Char;
        aplhabool=false;
        numbool=false;
        specbool=false;
        for (i = 0; i < document.getElementById('txtnewpassword').value.length; i++)
        {
            Char = document.getElementById('txtnewpassword').value.charAt(i);
            if (ValidAlphabet.indexOf(Char) != -1)
            {
                aplhabool=true;        
            }
            if (Validnumber.indexOf(Char) != -1)
            {
                numbool=true;        
            }
            if (Validspecialcharacter.indexOf(Char) != -1)
            {
                specbool=true;        
            }
        }
        if (aplhabool && numbool && specbool)
        {
            document.getElementById('btnserversidesubmit').click();
        }
        else
        {
            alert('New Password Does Not Meet the Criteria Defined Above');
            document.getElementById('txtnewpassword').focus();
            return false;
        }
    }
} 


function Show_Hide()
{
    if(document.getElementById('btnHide').value=='Show')
    {
        window.parent.document.getElementById('Menu').style.visibility='';
        window.parent.document.getElementById('menuset').cols="190,*";
        document.getElementById('btnHide').value='Hide';                
    }
    else if(document.getElementById('btnHide').value=='Hide')
    {
        window.parent.document.getElementById('Menu').style.visibility='hidden';
        window.parent.document.getElementById('menuset').cols="0,*";
        document.getElementById('btnHide').value='Show';                              
    }            
}
