//***********************************paging***********************************
function Paging(f,path,page)
{
	obj = f;
	if(page != null)
	{
		obj.PageNo.value = page;
	}
	
	obj.action = path;
	obj.submit();
}
///////////////////////////////////end paging////////////////////////////////////

//Button Highlight code
function HighLightHeader(rBtn,bState,offColour,onColour)
		{
			// browser check unless page is from server for particular agent.
			if (typeof(rBtn) == 'undefined' || typeof(rBtn) == 'unknown') return
			bState ? rBtn.style.background = onColour : rBtn.style.background = offColour;
			
		}

function HighLightStdNav(rBtn,bState)
		{
			// browser check unless page is from server for particular agent.
			if (typeof(rBtn) == 'undefined' || typeof(rBtn) == 'unknown') return
			bState ? rBtn.style.background = "#A9A9A9" : rBtn.style.background = "#808080"
			
		}

//Modal popup code
function OW(strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg)
{
	if (TYPE=="modal" || TYPE=="modalIframe")
	{
		var sF=""
		var _rv
		sF+=T?'unadorned:'+T+';':'';
		sF+=TB?'help:'+TB+';':'';
		sF+=S?'status:'+S+';':'';
		sF+=SC?'scroll:'+SC+';':'';
		sF+=R?'resizable:'+R+';':'';
		sF+=iW?'dialogWidth:'+iW+'px;':'';
		sF+=iH?'dialogHeight:'+iH+'px;':'';
		sF+=TOP?'dialogTop:'+TOP+'px;':'';
		sF+=LEFT?'dialogLeft:'+LEFT+'px;':'';
		if (TYPE=="modal")
			_rv=window.showModalDialog(URL,dArg?dArg:"",sF);
		else
		{
			var da=new Object()
			da.w=iW;
			da.h=iH;
			da.url=URL;
			_rv=window.showModalDialog(da,sF);
		}
		if ("undefined" != typeof(_rv) )
			return _rv;
	}
	else
	{
		var sF=""
		sF += iW?'width='+iW+',':'';
		sF+=iH?'height='+iH+',':'';
		sF+=R?'resizable='+R+',':'';
		sF+=S?'status='+S+',':'';
		sF+=SC?'scrollbars='+SC+',':'';
		sF+=T?'titlebar='+T+',':'';
		sF+=TB?'toolbar='+TB+',':'';
		sF+=TB?'menubar='+TB+',':'';
		sF+=TOP?'top='+TOP+',':'';
		sF+=LEFT?'left='+LEFT+',':'';
		var HMW=window.open(URL?URL:'about:blank',strName?strName:'',sF);
		if ( (document.window != null) && (!HMW.opener) )
		HMW.opener=document.window;
		HMW.focus();
	}
}

//popup windows 
//training modules start
function newTrainingModule(TYPE )
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","training_module_edit_frame.asp?source=launch",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "training_list.asp"
	}
}

function newTrainingModuleNS(editAccountID) 
{
	var newModuleWinType;
	newModuleWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("training_module_edit_frame.asp?source=launch",'_blank',newModuleWinType);		
}

function editTrainingModule(TYPE, editModuleID)
{
	var refreshes =OW("Error","350","485","","","no","yes","no","no","yes","training_module_edit_frame.asp?source=launch&editModule="+editModuleID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "training_list.asp"
	}
}
		
function editTrainingModuleNS(editModuleID) 
{
	var editModuleWinType;
	editModuleWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("training_module_edit_frame.asp?source=launch&editModule="+editModuleID,'_blank',editModuleWinType);		
}
//training modules end




//in-car training modules start
function newInCarTraining(TYPE )
{
	var refreshes = OW("Error","350","550","","","no","yes","no","no","yes","in-car-training_edit_frame.asp?source=launch",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "training_list.asp"
	}
}

function newInCarTrainingNS(editAccountID) 
{
	var newModuleWinType;
	newModuleWinType="width=350,height=525,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("in-car-training_edit_frame.asp?source=launch",'_blank',newModuleWinType);		
}

function editInCarTraining(TYPE, editModuleID)
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	var refreshes =OW("Error","350","550",iX,iY,"no","yes","no","no","yes","../manage_in_car_training/in-car-training_edit_frame.asp?source=launch&editInCarTraining="+editModuleID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href += '';
	}
}
		
function editInCarTrainingNS(editModuleID) 
{
	var editModuleWinType;
	editModuleWinType="width=350,height=525,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("../manage_in_car_training/in-car-training_edit_frame.asp?source=launch&editInCarTraining="+editModuleID,'_blank',editModuleWinType);		
}
//in-car training modules end




//question modules start
function newModule(TYPE )
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","module_edit_frame.asp?source=launch",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "module_list.asp"
	}
}

function newModuleNS(editAccountID) 
{
	var newModuleWinType;
	newModuleWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("module_edit_frame.asp?source=launch",'_blank',newModuleWinType);		
}

function editModule(TYPE, editModuleID)
{
	var refreshes =OW("Error","350","485","","","no","yes","no","no","yes","module_edit_frame.asp?source=launch&editGroup="+editModuleID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "module_list.asp"
	}
}
		
function editModuleNS(editModuleID) 
{
	var editModuleWinType;
	editModuleWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("module_edit_frame.asp?source=launch&editGroup="+editModuleID,'_blank',editModuleWinType);		
}
//question modules end

function  OpenAssessmentReport(assessmentID)
{
	var WinTypeAssess;
	WinTypeAssess="width=690,height=750,left=30,top=30,status=no,toolbar=yes,menubar=no,scrollbars=yes,resizable=yes";		
	window.open("../____________________assessments/assessment_report.asp?assessmentID=" + assessmentID,'_blank',WinTypeAssess);		
}


function  OpenTrainingReport(onlineTrainingID)
{
	var WinTypeAssess;
	WinTypeAssess="width=690,height=750,left=30,top=30,status=no,toolbar=yes,menubar=no,scrollbars=yes,resizable=yes";		
	window.open("../____________________training/training_certificate.asp?onlineTrainingID=" + onlineTrainingID,'_blank',WinTypeAssess);		
}
			


function newAssessment(TYPE, moduleType, sys )
{
	var width = 645
	var height = 530 
	if (sys == "IE_MAC"){width = width - 5; height = height - 70; }
	var refreshes = OW("Error",width,height,"","","no","yes","no","no","yes","assessment_frame.asp?launch=yes&moduleType="+moduleType,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "driver_assessment_list.asp"
	}
	if (refreshes == "training")
	{
		window.location.href = "../____________________training/training_list.asp";
	}
}

function newAssessmentNS(moduleType) 
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	var assessmentWinType;
	assessmentWinType="width=645,height=480,left="+ iX +",top="+ iY +",status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open("assessment_frame.asp?launch=yes&moduleType="+moduleType,'_blank',assessmentWinType);	
}

function completeAssessment(TYPE,assID, sys )
{
	var width = 645
	var height = 530 
	if (sys == "IE_MAC"){width = width - 5; height = height - 70;}
	var refreshes = OW("Error","645","530","","","no","yes","no","no","yes","assessment_frame.asp?assessmentID="+assID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "driver_assessment_list.asp"
	}
	if (refreshes == "training")
	{
		window.location.href = "../____________________training/training_list.asp";
	}
}

function completeAssessmentNS(assID) 
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	var assessmentWinType;
	assessmentWinType="width=645,height=480,left="+ iX +",top="+ iY +",status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open("assessment_frame.asp?assessmentID="+assID,'_blank',assessmentWinType);	
}






function newTraining(TYPE, moduleType, sys, failedAssessmentID)
{
	var width = 645
	var height = 530 
	if (sys == "IE_MAC"){width = width - 5; height = height - 70; }
	var refreshes = OW("Error",width,height,"","","no","yes","no","no","yes","training_frame.asp?launch=yes&moduleType="+moduleType+"&failedAssessmentID="+failedAssessmentID,TYPE);if (refreshes == "yes")
	{
		window.location.href = "training_list.asp"
	}
}

function newTrainingNS(moduleType, failedAssessmentID) 
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	var trainingWinType;
	trainingWinType="width=645,height=480,left="+ iX +",top="+ iY +",status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open("training_frame.asp?launch=yes&moduleType="+moduleType+"&failedAssessmentID="+failedAssessmentID,'_blank',trainingWinType);	
}

function openCert(TYPE, iId, sys )
{
	var width = 645
	var height = 530 
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	iX = iX + 20;
	iY = iY + 20;
	if (sys == "IE_MAC"){width = width - 5; height = height - 70; }
	var refreshes = OW("Error",width,height,iX,iY,"no","yes","no","no","yes",'../____________________training/training_certificate.asp?onlineTrainingID=' + iId,TYPE);
}

function openCertNS(iId) 
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	iX = iX + 20;
	iY = iY + 20;
	var trainingWinType;
	trainingWinType="width=645,height=480,left="+ iX +",top="+ iY +",status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open('../____________________training/training_certificate.asp?onlineTrainingID=' + iId,'_blank',trainingWinType);	
}

function completeTraining(TYPE,assID, sys )
{
	var width = 645
	var height = 530 
	if (sys == "IE_MAC"){width = width - 5; height = height - 70;}
	var refreshes = OW("Error","645","530","","","no","yes","no","no","yes","../____________________training/training_frame.asp?onlineTrainingID="+assID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href += '';
	}
}

function completeTrainingNS(assID) 
{
	iX = (screen.width  - 645) / 2;
	iY = (screen.height - 510) / 2;
	var trainingWinType;
	trainingWinType="width=645,height=480,left="+ iX +",top="+ iY +",status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open("../____________________training/training_frame.asp?onlineTrainingID="+assID,'_blank',trainingWinType);	
}








function newDepartment(TYPE,branchID)
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","department_edit_frame.asp?branchID="+branchID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "department_list.asp"
	}
}

function newDepartmentNS(branchID) 
{
	var newDepartmentWinType;
	newDepartmentWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("department_edit_frame.asp?branchID="+branchID,'_blank',newDepartmentWinType);		
}

function editDepartment(TYPE, editDepartmentID)
{
	var refreshes =OW("Error","350","485","","","no","yes","no","no","yes","department_edit_frame.asp?departmentID="+editDepartmentID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "department_list.asp"
	}
}
		
function editDepartmentNS(editDepartmentID) 
{
	var editDepartmentWinType;
	editDepartmentWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("department_edit_frame.asp?departmentID="+editDepartmentID,'_blank',editDepartmentWinType);		
}

function newBranch(TYPE,companyID)
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","branch_edit_frame.asp?companyID="+companyID, TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "branch_list.asp" 
	}
}

function newBranchNS(companyID) 
{
	var newBranchWinType;
	newBranchWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("branch_edit_frame.asp?companyID="+companyID,'_blank',newBranchWinType);		
}

function editBranch(TYPE, editBranchID)
{
	var refreshes =OW("Error","350","485","","","no","yes","no","no","yes","branch_edit_frame.asp?branchID="+editBranchID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "branch_list.asp"
	}
}
		
function editBranchNS(editBranchID) 
{
	var editBranchWinType;
	editBranchWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("branch_edit_frame.asp?branchID="+editBranchID,'_blank',editBranchWinType);		
}

function newAccount(TYPE )
{
	var refreshes = OW("Error","350","525","","","no","yes","no","no","yes","account_edit_frame.asp?launch=yes",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "account_list.asp"
	}
}

function newAccountNS(editAccountID) 
{
	var newAccounWinType;
	newAccounWinType="width=350,height=500,left=380,top=50,status=yes,toolbar=yes,menubar=no,scrollbars=yes,resizable=no";
	window.open("account_edit_frame.asp?launch=yes",'_blank',newAccounWinType);		
}

function editAccount(TYPE, editAccountID)
{
	var refreshes =OW("Error","350","525","","","no","yes","no","no","yes","account_edit_frame.asp?launch=yes&accountID="+editAccountID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "account_list.asp"
	}
}
		
function editAccountNS(editAccountID) 
{
	var editAccounWinType;
	editAccounWinType="width=350,height=500,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("account_edit_frame.asp?launch=yes&accountID="+editAccountID,'_blank',editAccounWinType);		
}

function newGroup(TYPE )
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","group_edit_frame.asp?launch=yes",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "group_list.asp"
	}
}

function newGroupNS(editAccountID) 
{
	var newGroupWinType;
	newGroupWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("group_edit_frame.asp?launch=yes",'_blank',newAccounWinType);		
}

function editGroup(TYPE, editGroupID)
{
	var refreshes =OW("Error","350","485","","","no","yes","no","no","yes","group_edit_frame.asp?launch=yes&editGroup="+editGroupID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "group_list.asp"
	}
}
		
function editGroupNS(editGroupID) 
{
	var editGroupWinType;
	editGroupWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("group_edit_frame.asp?launch=yes&editGroup="+editGroupID,'_blank',editAccounWinType);		
}

function newQuestion(TYPE )
{
	var refreshes = OW("Error","350","575","","","no","yes","no","no","yes","question_edit_frame.asp?launch=yes&type=new",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "question_list.asp"
	}
}

function newQuestionNS() 
{
	var newQuestionWinType;
	newQuestionWinType="width=350,height=550,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("question_edit_frame.asp?launch=yes&type=new",'_blank',newQuestionWinType);	
}

function editQuestion(TYPE, editQuestionID,typeID)
{
	var refreshes = OW("Error","350","575","","","no","yes","no","no","yes","question_edit_frame.asp?launch=yes&questionID="+editQuestionID+"&type="+typeID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "question_list.asp"
	}
}

function editQuestionNS(editQuestionID,typeID) 
{
	var editQuestionWinType;
	editQuestionWinType="width=350,height=550,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("question_edit_frame.asp?launch=yes&questionID="+editQuestionID+"&type="+typeID,'_blank',editQuestionWinType);		
}

function newUser(TYPE )
{
	var refreshes = OW("Error","350","535","","","no","yes","no","no","yes","user_edit_frame.asp?launch=yes",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "user_list.asp"
	}
}

function newUserNS(editAccountID) 
{
	var newUserWinType;
	newUserWinType="width=350,height=510,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("user_edit_frame.asp?launch=yes",'_blank',newUserWinType);	
}

function editUser(TYPE, editUserID)
{
	var refreshes = OW("Error","350","535","","","no","yes","no","no","yes","user_edit_frame.asp?launch=yes&userID="+editUserID,TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "user_list.asp"
	}
}

function editUserNS(editUserID) 
{
	var editUserWinType;
	editUserWinType="width=350,height=510,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("user_edit_frame.asp?launch=yes&userID="+editUserID,'_blank',editUserWinType);		
}

function newDocument(TYPE )
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","document_edit_frame.asp?launch=yes",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "documents_list.asp"
	}
	else if (navigator.platform.indexOf('Mac') > -1) 
	{
	 	window.location.href = "documents_list.asp"
 	}
}

function newDocumentNS(editDocumentID) 
{
	var newUserWinType;
	newUserWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("document_edit_frame.asp?launch=yes",'_blank',newUserWinType);	
}

function newDocumentMod(TYPE )
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","document_edit_mod_frame.asp",TYPE);
	if (refreshes == "yes")
	{
		window.location.href = "documents_list.asp"
	}
}

function newDocumentModNS(editDocumentID) 
{
	var newUserWinType;
	newUserWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("document_edit_mod_frame.asp",'_blank',newUserWinType);	
}

function editDocument(TYPE, editDocumentID)
{
	var refreshes = OW("Error","350","485","","","no","yes","no","no","yes","document_edit_frame.asp?launch=yes&documentID="+editDocumentID,TYPE);
	
	if (refreshes == "yes")
	{
		window.location.href = "documents_list.asp"
	}
}





function editDocumentNS(editDocumentID) 
{
	var editUserWinType;
	editUserWinType="width=350,height=460,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("document_edit_frame.asp?launch=yes&documentID="+editDocumentID,'_blank',editUserWinType);		
}

function uploadDocNS() 
{
	var editUserWinType;
	editUserWinType="width=360,height=200,left=380,top=50,status=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("upload_document_frame.asp",'_blank',editUserWinType);		
}

function uploadDoc(TYPE)
{
	var refreshes = OW("Error","360","245","","","no","yes","no","no","yes","upload_document_frame.asp",TYPE);
	if (refreshes != "") 
	{
		if (refreshes != "false") 
		{
			window.document['frmDocumentEdit'].docName.value = refreshes;
		}
		
	}
	if("undefined" == typeof(refreshes) )
	{
	 window.document['frmDocumentEdit'].docName.value = "doc added";
	}
}

function selectImageNS() 
{
	var selectImageType;
	selectImageType="width=350,height=430,left=75,top=200,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("image_select_frame.asp",'_blank',selectImageType);		
}

function selectImage(TYPE)
{
	var refreshes = OW("Error","360","455","200","75","no","yes","no","no","yes","image_select_frame.asp",TYPE);
	if (refreshes != "") 
	{
		if (refreshes != "false") 
		{
			window.document['frmQuestionEdit'].imageName.value = refreshes;
		}
		
	}
	
	if (refreshes == "none") 
	{
		window.document['frmQuestionEdit'].imageName.value = "";
		
	}
	//compliance code for the mac
	if("undefined" == typeof(refreshes) )
	{
	 window.document['frmQuestionEdit'].imageName.value = "image added";
	}
}


function selectSignNS(Field) 
{
	var selectImageType;
	selectImageType="width=350,height=430,left=75,top=200,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("image_select_frame.asp?show=signs&Field=" + Field,'_blank',selectImageType);		
}

function selectSign(TYPE,Field)
{
	var refreshes = OW("Error","360","455","200","75","no","yes","no","no","yes","image_select_frame.asp?show=signs&Field=" + Field,TYPE);
	if (refreshes != "") 
	{
		if (refreshes != "false") 
		{
			if (Field == "strQ1")
			{
				window.document['frmQuestionEdit'].strQ1.value = refreshes;
			}
			if (Field == "strQ2")
			{
				window.document['frmQuestionEdit'].strQ2.value = refreshes;
			}
			if (Field == "strQ3")
			{
				window.document['frmQuestionEdit'].strQ3.value = refreshes;
			}
		}
		
	}
	
	if (refreshes == "none") 
	{
		if (Field == "StrQ1")
		{
			window.document['frmQuestionEdit'].StrQ1.value = "";
		}
		if (Field == "StrQ2")
		{
			window.document['frmQuestionEdit'].StrQ2.value = "";
		}
		if (Field == "StrQ3")
		{
			window.document['frmQuestionEdit'].StrQ3.value = "";
		}		
	}
	//compliance code for the mac
	if("undefined" == typeof(refreshes) )
	{
		if (Field == "StrQ1")
		{
			 window.document['frmQuestionEdit'].StrQ1.value = "image added";
		}
		if (Field == "StrQ2")
		{
			 window.document['frmQuestionEdit'].StrQ2.value = "image added";
		}
		if (Field == "StrQ3")
		{
			 window.document['frmQuestionEdit'].StrQ3.value = "image added";
		}	
	
	}
}


function selectLogoNS() 
{
	var selectLogoType;
	selectLogoType="width=350,height=430,left=75,top=200,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
	window.open("image_select_frame.asp",'_blank',selectLogoType);		
}

function selectLogo(TYPE)
{
	var refreshes = OW("Error","360","455","200","75","no","yes","no","no","yes","image_select_frame.asp",TYPE);
	if (refreshes != "") 
	{
		if (refreshes != "false") 
		{
			window.document['frmAccountEdit'].imageName.value = refreshes;
		}
		
	}
	
	if (refreshes == "none") 
	{
		window.document['frmAccountEdit'].imageName.value = "";
		
	}
	//compliance code for the mac
	if("undefined" == typeof(refreshes) )
	{
	 window.document['frmAccountEdit'].imageName.value = "image added";
	}
}

//Filter code		
function NavTo()
{
	//window.location = document.forms[0].cboNav.value
	document.forms[0].action = document.forms[0].cboNav.value;
	document.forms[0].submit();
}

function NavTo1()
{
	//window.location = document.forms[0].cboNav1.value
	document.forms[0].action = document.forms[0].cboNav1.value;
	document.forms[0].submit();
}

function NavTo2()
{
	//window.location = document.forms[0].cboNav2.value
	document.forms[0].action = document.forms[0].cboNav2.value;
	document.forms[0].submit();
}

function NavToQuestionType(qs)
{
	if (document.forms[0].qType.value == "1")
	{
		window.location = "question_single.asp?" + qs
	}
	else if (document.forms[0].qType.value == "2")
	{
		window.location = "question_multi.asp?" + qs
	} 
	else if (document.forms[0].qType.value == "3")
	{
		window.location = "question_order.asp?" + qs
	}
	else if (document.forms[0].qType.value == "4")
	{
		window.location = "question_signs.asp?" + qs
	}
}


function broadcastCode(TYPE, regcode)
{
	//OW("Error","305","300","","","no","no","no","no","no","../help/broadcast_code.asp?regcode=" + regcode,TYPE);
	editDepartmentWinType="width=450,height=450,left=380,top=50,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
	window.open("../help/broadcast_code.asp?regcode=" + regcode,'_blank',editDepartmentWinType);	
}

//Error popups

function deleteGroupWithCompaniesErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_group_companies.asp",TYPE);
}

function deleteGroupWithQuestionsErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_group_questions.asp",TYPE);
}

function noModuleErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_no_modules.asp",TYPE);
}

function deleteAccountErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_account.asp",TYPE);
}

function deleteMasterErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_master_account.asp",TYPE);
}

function deleteBranchErr (TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_branch.asp",TYPE);
}

function deleteDepartmentErr (TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_department.asp",TYPE);
}

function deleteAdminErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_admin_user.asp",TYPE);
}	

function newContactErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_contact.asp",TYPE);
}

function newContactStatusErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_contact_status.asp",TYPE);
}

function deleteDocumentErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_document.asp",TYPE);
}

function startNewErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_start_assessment.asp",TYPE);
}

function startNewErrTraining(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_start_assessment_training.asp",TYPE);
}

function startNewTrainingErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_start_training.asp",TYPE);
}

function completeErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_complete_assessment.asp",TYPE);
}

function userPermissionErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_delete_higher_user.asp",TYPE);
}

function editUserPermissionErr(TYPE )
{
	OW("Error","305","300","","","no","no","no","no","no","../help/err_edit_higher_user.asp",TYPE);
}

//help files
function helpWinStart(TYPE )
{
	OW("Error","370","480","25","25","no","yes","no","no","yes","../help/help_popup_frame.asp?helpTopic=",TYPE);
	//document.forms[0].elements.toggleHelp.value = '1';
	//document.forms[0].submit();
}

function helpToggle(TYPE )
{
	//OW("Error","370","480","25","25","no","yes","no","no","yes","../help/help_popup_frame.asp?helpTopic=",TYPE);
	document.forms[0].elements.toggleHelp.value = '1';
	document.forms[0].submit();
}

function helpWinNav(TYPE )
{
	OW("Error","370","480","25","25","yes","no","no","yes","help/help_popup_frame.asp?helpTopic=",TYPE);
}

function helpWin(TYPE, helpTopicPage)
{
	//OW("Error","350","460","25","25","no","no","no","no","no","../help/help_topic_frame.asp?helpTopic=" + helpTopicPage,TYPE);
	OW("Error","370","480","25","25","no","yes","no","no","yes","../help/help_topic_frame.asp?helpTopic=",TYPE);
}

//Hide source
var message="Sorry, that function is disabled.\n\nContents & graphics copyright İMavada Ltd\nThis Tool has been designed and\nbuilt by Mavada Ltd. www.mavada.com";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

//***********************************print***********************************

var da = (document.all) ? 1 : 0; // browser is VB compatible
var pr = (window.print) ? 1 : 0; // must be NS4, IE5
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function printPage() {

  if (pr)
  {
	if ((navigator.appName.substring(0,8) == "Netscape") && (parseInt(navigator.appVersion) <= 4))
	 {
		if ((parseInt(navigator.appVersion) == 4) && (parseInt(navigator.appMinorVersion) == 7)) {
			 alert("Page Help\n===================\nSorry, your browser doesn't\nsupport this feature.\nTo print this page on a\nMacintosh please use\nthe Command and P keys."); 
		}		
	}
	else {
		window.print();

	}
  }	
  else if (da && !mac)
    vbPrintPage()
  else
   
    alert("Page Help\n===================\nSorry, your browser doesn't\nsupport this feature.\nTo print this page on a\nMacintosh please use\nthe Command and P keys."); 
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}
///////////////////////////////////end print////////////////////////////////////

function isNumber(strValue)
{
  var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/; 
  //check for numeric characters 
  return objRegExp.test(strValue);
}

function isAlpha(strValue)
{
  var objRegExp  = /(^[A-Za-z]*$)/;
  //check for alpha characters 
  return objRegExp.test(strValue);
}

function preLoad(img)
{
	image = new Image();
	image.src = '../images/' + img;
}




function editTextNS(Field) 
{
	var editTextType;
	editTextType="width=350,height=430,left=75,top=200,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
	if (Field == "notes")
	{
		window.open("edit_text_frame.asp?type=nonmodal&field=notes&content=" + window.document.forms[0].notes.value,'_blank',editTextType);
	}
}

function editText(TYPE, Field)
{	
	if (Field == "notes")
	{
		var refreshes = OWin("Error","360","455","200","75","no","yes","yes","yes","yes","edit_text_frame.asp?type=modal",TYPE,window.document.forms[0].notes.value);
	}
	
	if (Field == "strIntroText")
	{
		var refreshes = OWin("Error","360","455","200","75","no","yes","yes","yes","yes","edit_text_frame.asp?type=modal",TYPE,window.document.forms[0].strIntroText.value);
	}
	
	if (refreshes != "") 
	{
		if ((refreshes != "false") && (refreshes != "none"))
		{
			if (Field == "notes")
			{
				window.document.forms[0].notes.value = refreshes;
			}
			if (Field == "strIntroText")
			{
				window.document.forms[0].strIntroText.value = refreshes;
			}
		}
	}
}
function OWin(strName,iW,iH,TOP,LEFT,R,S,SC,T,TB,URL,TYPE,dArg)
{
	if (TYPE=="modal" || TYPE=="modalIframe")
	{
		var sF=""
		var _rv
		sF+=T?'unadorned:'+T+';':'';
		sF+=TB?'help:'+TB+';':'';
		sF+=S?'status:'+S+';':'';
		sF+=SC?'scroll:'+SC+';':'';
		sF+=R?'resizable:'+R+';':'';
		sF+=iW?'dialogWidth:'+iW+'px;':'';
		sF+=iH?'dialogHeight:'+iH+'px;':'';
		sF+=TOP?'dialogTop:'+TOP+'px;':'';
		sF+=LEFT?'dialogLeft:'+LEFT+'px;':'';
		if (TYPE=="modal")
			_rv=window.showModalDialog(URL,dArg?dArg:"",sF);
		else
		{
			var da=new Object()
			da.w=iW;
			da.h=iH;
			da.url=URL;
			_rv=window.showModalDialog(da,sF);
		}
		if ("undefined" != typeof(_rv) )
			return _rv;
	}
	else
	{
		var sF=""
		sF += iW?'width='+iW+',':'';
		sF+=iH?'height='+iH+',':'';
		sF+=R?'resizable='+R+',':'';
		sF+=S?'status='+S+',':'';
		sF+=SC?'scrollbars='+SC+',':'';
		sF+=T?'titlebar='+T+',':'';
		sF+=TB?'toolbar='+TB+',':'';
		sF+=TB?'menubar='+TB+',':'';
		sF+=TOP?'top='+TOP+',':'';
		sF+=LEFT?'left='+LEFT+',':'';
		var HMW=window.open(URL?URL:'about:blank',strName?strName:'',sF);
		if ( (document.window != null) && (!HMW.opener) )
		HMW.opener=document.window;
		HMW.focus();
	}
}
