<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title></title>
	
	<!--MqRelPath--><link rel="stylesheet" title="silver" type="text/css" href="../../theme/css/censusmain.css"/><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" title="silver" type="text/css" href="<BASE_VD>/theme/css/censusmain.css"/></MqAbsPath-->
	<!--MqRelPath--><link rel="stylesheet" title="silver" type="text/css" href="../../theme/css/mqwizard.css"/><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" title="silver" type="text/css" href="<BASE_VD>/theme/css/mqwizard.css"/></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqsysutils.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqsysutils.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqsysmsg.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqsysmsg.js" ></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/window.js" ></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/window.js" ></script></MqAbsPath-->
	
	<!--MqRelPath--><link rel="stylesheet" href="../../js/jquery/jquery.ui.all.css"><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" href="<BASE_VD>/js/jquery/jquery.ui.all.css"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery-1.7.1.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery-1.7.1.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.bgiframe-2.1.2.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.bgiframe-2.1.2.js"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.core.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.core.js"></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.widget.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.widget.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.mouse.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.mouse.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.draggable.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.draggable.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.position.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.position.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.resizable.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.resizable.js"></script></MqAbsPath-->
		<!--MqRelPath--><script type="text/javascript" src="../../js/jquery/jquery.ui.dialog.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/jquery/jquery.ui.dialog.js"></script></MqAbsPath-->
		

	<script type="text/javascript">
		// always define this object for the system messages
		var objSysMsg = new CMqSysMsg();
		var m_objMqButton = new MqButton();
		
		var m_objRef;
		
		if(opener){
			if(opener.parent){
				m_objRef=opener.parent;
			}
		}else{
			if(parent){
				m_objRef=parent;
			}
		}
		
		var m_strMsgTitle="";
		var m_strMsgContent="";
		
		function OnLoad(){
			
			var objSNs=document.getElementById("memSerialNums");
			
			if(objSNs){
				objSNs.focus();
			}
			return true;
		}

		function cmdOK_OnClick(blnCloseAfterSave)
		{
			var objSNs=document.getElementById("memSerialNums");
			var strURL="";
			if(objSNs){
				if(m_objRef){
					var strSNs=objSNs.value;
					var strInDelim=";";
					var strOutDelim=";";
					var strAvailableWhere="Asset_Sub_status=2";//in stock
					strSNs=strSNs.replace(/[\n\r]/g,strInDelim);
					strURL="UF=" + g_MqRef.MqStr.MqEncodeURIComponent("Serial_Number;Asset_Tag") + 
							"&UV=" + g_MqRef.MqStr.MqEncodeURIComponent(strSNs) + 
							"&ID=" + g_MqRef.MqStr.MqEncodeURIComponent(strInDelim) + 
							"&OD=" + g_MqRef.MqStr.MqEncodeURIComponent(strOutDelim) + 
							"&UW=" + g_MqRef.MqStr.MqEncodeURIComponent(strAvailableWhere);
					
					var co = m_objRef.objRequest.Post(m_objRef.mstrCurrentLocation + "../ASP/GetIDs.asp", strURL);
					if (co!=""){
						var arrResults=co.split("*|*");
						
						var strIDs=arrResults[0];
						var strSNs=arrResults[1];
						var strNotFound=arrResults[2];
						var strNotAvailable=arrResults[3];
						var strMsg="";
						
						var regExp=new RegExp(strOutDelim,"g");
						strSNs=strSNs.replace(regExp,"<br />");
						if(strNotFound=="" && strNotAvailable==""){
							OpenMassCheckout(strIDs, strSNs);
						}else{
							if(strNotFound!=""){
								strMsg+=g_MqRef.MqStr.FormatString(g_MqRef.RESX["MSG_SNS_NOT_FOUND"], strNotFound);
							}
							if(strNotAvailable!=""){
								if(strMsg!=""){
									strMsg+="<br /><br />";
								}
								
								strMsg+=g_MqRef.MqStr.FormatString(g_MqRef.RESX["MSG_NOT_FOR_CHECKOUT"], strNotAvailable);
							}
							if(strIDs!=""){
								strMsg+="<br /><br />" + g_MqRef.RESX["MSG_CONTINUE_CHECKOUT_MULTIPLE"];
								
								g_MqRef.ConfirmBox.show(g_MqRef.RESX["TITLE_CANT_CHECKOUT"], strMsg).then(function(res)
								{
									if(res)
									{
										OpenMassCheckout(strIDs, strSNs);
									}
									
								});
								
							}else{
								g_MqRef.AlertBox.show(g_MqRef.RESX["TITLE_CANT_CHECKOUT"], strMsg);
							}
						}
					}
				}			
			}
		}
		
		function OpenMassCheckout(strIDs, strSNs)
		{
			if(strIDs!=""){
				var objSLFra=m_objRef.objFrames.GetFrameWindow(m_objRef.SUMMARY_LIST_FRAME_ID);
				if(objSLFra){
					objSLFra.OpenBatchUpdateWindow(1000,700, '<F.ID:Allocated to Person (Overview Tab)>,<F.ID:Comments>,<F.ID:Requested Until Date (Overview Tab)>,<F.ID:Current Location (Overview Tab)>', null, "CHECKOUT_MULTIPLE_HEADER", "CHECKOUT_MULTIPLE_DESC", "<F.ID:Status>=1", "CHECKOUT_MULTIPLE_HDR2_TITLE", strSNs, strIDs);
				}
			}else{
				alert(g_MqRef.RESX["MSG_NO_ASSETS_FOUND_CHECKOUT_MULTIPLE"]);
			}
		}
	</script>
	<style type="text/css">
	<!--
	input,textarea,select{
		font-family: tahoma, sans-serif;
		font-size:12px;
	}
	// -->
	</style>
</head>

<body id="frmMain" name="frmMain" class="MainBackgroundPopup" 
style="margin:0;" leftmargin="0" rightmargin="0" 
onload="OnLoad();" bottommargin="0" scroll="no">

	<div class="TopToolBarPopup">
		<table width="98%" class="TopToolBarWizard">
			<tr>
				<td>
					<img src="../../theme/images/images/scannericon_big.png" width="48" height="48" />
				</td>
		        <td valign="top" style="padding-top:15px; padding-left:10px" width="100%">
		            <div class="WizardTitle"><script type="text/javascript">document.write(g_MqRef.RESX["SCAN_CHECKOUT_MULTIPLE_TITLE"]);</script></div>
		            <div class="WizardDescription"><script type="text/javascript">document.write(g_MqRef.RESX["SCAN_CHECKOUT_MULTIPLE_DESC"]);</script></div>
		        </td>
		    </tr>
		</table>
	</div>

	<table id="tblMain" marginwidth="0" cellspacing="0" cellpadding="0" border="0" style="padding-left:10px;width: 98%;" >
		<tr >
			<td align="center" style="padding-top: 15px;padding-bottom: 15px;">
				<textarea style="width:100%" rows='25' cols='25' name='memSerialNums' id='memSerialNums' class='TextBoxWidth'></textarea>
			</td>			
		</tr>
	</table>
	<table align="right" style="padding-right:10px">
		<tr>
			<td align=right>
				<script type="text/javascript">m_objMqButton.WriteTextButtonHTML("OK", g_MqRef.RESX["BUTTON_OK"], 'cmdOK_OnClick(true)', "", 32, "", g_MqRef.RESX["BUTTON_OK"], 90);</script>
			</td>
			<td align=right>
				<script type="text/javascript">m_objMqButton.WriteTextButtonHTML("Close", g_MqRef.RESX["BUTTON_CLOSE"], 'CloseWindow()', "", 32, "", g_MqRef.RESX["BUTTON_CLOSE"], 90);</script>
			</td>
		</tr>
		</tbody> 
	</table>
	
</body>
</html>