﻿$(document).ready(
    function() {
	    //View ISO Certificate
	    $(".ISOViewer").click(
		    function()
		    {
			    $.blockUI(
			    {
				    //theme: true,
				    //draggable: true,
				    message: $('#divISO')
			    });
    			
			    $(".divISOClose").click($.unblockUI);
		    }
	    );
    	
//	    $("#btnLogin").click(onExecuteLogin);	
//	    $("#btnLogout").click(onExecuteLogout);
    }
);

////for client login
//function onExecuteLogin()
//{
//	var uName = $("#txtUN").val();
//	var pswd = $("#txtPW").val();				
//	var entriesFailed = (uName == "" || pswd == "") ? true : false;
//	
//	if(!entriesFailed)
//	{
//		var urlWithParams = "iRequest/Login.aspx?uid=" + uName;
//			urlWithParams += "&pwd=" + pswd;
//			
//		var rsp = $.ajax( { url: urlWithParams,  async: false } ).responseText;
//		
//		if(rsp.indexOf("SUCCESS") != -1)
//		{
//			window.location.href = "ClientPage.aspx";
//		}
//		else
//		{
//			alert(rsp);
//			
//			$("#txtUN").val("");
//			$("#txtPW").val("");
//			$("#txtUN").focus();
//		}
//	}
//	else
//	{
//		alert("Username and Password are required!");
//		$("#txtUN").focus();
//	}			
//}

//function onKeyLogin(evt)
//{
//	if(evt != null)
//	{
//		var kCode = evt.keyCode;
//		
//		if(kCode == null)
//			kCode = evt.charCode;
//			
//		if(kCode != null && kCode == 13)
//			onExecuteLogin();
//	}
//}

//Enter key press for Login
function onKeyLoginCallBack(evt) {
	if(evt != null) {
		var kCode = evt.keyCode;		
		if(kCode == null)
			kCode = evt.charCode;			
		if(kCode != null && kCode == 13)
			__doPostBack("lbox1$btnLoginX","");
	}
}

//function onExecuteLogout()
//{
//    var url = "iRequest/Logout.aspx";
//    
//    var rsp = $.ajax( { url: url,  async: false } ).responseText;
//		
//	if(rsp.indexOf("Logout") != -1)
//	{
//		window.location.href = "Default.aspx";
//	}
//	else
//	{
//		alert(rsp);
//	}
//}

//Resizing the ISO modal to fit in any screen resolution
function fitDiv()
{
	var screenHeight = screen.height;
	var adjustingDiv = document.getElementById('divISO');
	var adjustingImg = document.getElementById('imgISO');
	//alert(screenHeight);
	
	if (screenHeight >= 960 || screenHeight >= 1024)
	{
		
		adjustingDiv.style.width = "560px";
		adjustingDiv.style.marginTop = "-310px";
		adjustingDiv.style.marginLeft= "-90px";
		adjustingDiv.style.marginRight = "auto";
		adjustingImg.style.width = "460px";
	}
	else if(screenHeight < 960 && screenHeight >= 768)
	{
		adjustingDiv.style.width = "410px";
		adjustingDiv.style.marginTop = "-240px";
		adjustingDiv.style.marginLeft= "-60px";
		adjustingDiv.style.marginRight = "auto";
		adjustingImg.style.width = "320px";
	}
	else if(screenHeight < 768 && screenHeight >= 700)
	{
		adjustingDiv.style.width = "400px";
		adjustingDiv.style.marginTop = "-235px";
		adjustingDiv.style.marginLeft= "-50px";
		adjustingDiv.style.marginRight = "auto";
		adjustingImg.style.width = "310px";
	}
	else if(screenHeight < 700 && screenHeight >= 600)
	{
		adjustingDiv.style.width = "300px";
		adjustingDiv.style.marginTop = "-180px";
		adjustingDiv.style.marginLeft= "-35px";
		adjustingDiv.style.marginRight = "auto";
		adjustingImg.style.width = "210px";
	}
	else if(screenHeight < 600 && screenHeight >= 490)
	{
		adjustingDiv.style.width = "280px";
		adjustingDiv.style.marginTop = "-175px";
		adjustingDiv.style.marginLeft= "-20px";
		adjustingDiv.style.marginRight = "auto";
		adjustingImg.style.width = "200px";
	}
}
