// JScript File

function ConfirmDelete(title){
	if(confirm("You are about to delete the Selected "+ title +".\nYou will not be able to get back the details once deleted.\nDo you wish to continue?"))
	{
		return true;			
	}
	else
	{
		return false;
	}
	return false;
}	

function ConfirmArchive(status, title){
	if(confirm("You are about to "+ status +" the Selected "+ title +".\nDo you wish to continue?"))
	{
		return true;			
	}
	else
	{
		return false;
	}
	return false;
}	

function onOpenPopup(url, nWidth, nHeight, name) {
	
	var nLeft	= 0;
	var nTop	= 0;
	nLeft		= (window.screen.width - nWidth)/2;
	nTop		= (window.screen.height - nHeight)/2;
	window.open(url, name, "width=" + nWidth + ", height=" + nHeight + ", location=no,left=" + nLeft + ",top=" + nTop + ", menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no");
}

function navigatePage(pageIndex) {
	var frm	= document.aspnetForm;
	frm.ctl00_PageIndexHidden.value	= pageIndex;
	frm.ctl00_ActionHidden.value = "PAGINATION";
	frm.submit();
}

var	strFocusControlId	= "";
function setFocus() {
	if(strFocusControlId != "") {
		var objControl	= document.getElementById(strFocusControlId);
		objControl.focus();
	}
}

function getGridControl(gridId, controlId, nRowIndex) {
	var objControl	= null;
    
	if(nRowIndex >= 10) {
		controlId	= "ctl00_MainContent_" + gridId + "_ctl" + nRowIndex + "_" + controlId;
	} else {
		controlId	= "ctl00_MainContent_" + gridId + "_ctl0" + nRowIndex + "_" + controlId;
	}
	
	objControl	= document.getElementById(controlId);
	return(objControl);
}

function resetPage(formId) {
	var frm	= document.getElementById(formId);
	frm.reset();
	return false;
}

function isValidImage(source, clientside_arguments)
{
	var imageName	= clientside_arguments.Value;
	var nIndex		= imageName.lastIndexOf(".");
	var imageExtension	= "";
	clientside_arguments.IsValid	= false;
	if(nIndex >= 0) {
		imageExtension	= imageName.substring(nIndex + 1);
		imageExtension	= imageExtension.toLowerCase();
		if(imageExtension != "gif" && imageExtension != "jpg" && imageExtension != "jpeg" 
			&& imageExtension != "jpe" && imageExtension != "png" && imageExtension != "bmp") {
			clientside_arguments.IsValid	= false;
		} else {		
			clientside_arguments.IsValid	= true;
		}
	}	
}