function showPanels(typ){
	if(typ=="N"){
		document.getElementById("printmenu").style.display="block";
		document.getElementById("superheader").style.display="none";
		document.getElementById("header").style.display="none";
		document.getElementById("mainnav").style.display="none";
		document.getElementById("news_container").style.display="none";
		document.getElementById("FlexNewsPanel_1").style.display="none";
		document.getElementById("footer").style.display="none";
		
		document.body.style.backgroundColor = "#FFFFFF";
	}
	if(typ=="Y"){
		document.getElementById("printmenu").style.display="none";
		document.getElementById("superheader").style.display="block";
		document.getElementById("header").style.display="block";
		document.getElementById("mainnav").style.display="block";
		document.getElementById("news_container").style.display="block";
		document.getElementById("FlexNewsPanel_1").style.display="block";
		document.getElementById("footer").style.display="block";
		
		document.body.style.backgroundColor = "#CCCCCC";
	}

}
function showPanel(elmID){
  var elm;
  elm = document.getElementById(elmID);
  if(elm.style.display=="none"){
   elm.style.display = "block";
  }
  else{
   elm.style.display = "none";
  }
 }
function buttonChange(id,typ){
	var menuButton = document.getElementById('menuButton'+id);
	if (typ == "OVER") {
		//menuButton.style.backgroundColor='#ffffff';
		//menuButton.style.color='#000000';
	}
	if (typ == "OUT") {
		menuButton.style.backgroundColor='#00393A';
		menuButton.style.color='#ffffff';
	}
}
function getContent(refID,id){
	var menuButtonStr;
	var menuButton = document.getElementById(id);
	menuButton.style.backgroundColor='#ffffff';
	menuButton.style.color='#000000';
	for (i=0;i<=5;i++)
	{
		menuButtonStr = 'menuButton'+ i;
		if (menuButtonStr != id) {
			buttonChange(i,'OUT');
		}
	}
	getAjaxContent('FlexContentPanel_1','C',refID);
}
function clientArea(){
	var ret = 'true';
	var username = document.getElementById("username");
	var password = document.getElementById("password");
	if(username.value == ''){
		alert('Please enter your username');
		username.style.backgroundColor='red';
		ret = 'false';
	}
	if(password.value == ''){
		alert('Please enter your password');
		password.style.backgroundColor='red';
		ret = 'false';
	}
	if (ret == 'true') {
		alert('success');
	}
}
function getGrid(user,passWord){
		$('#grid1').jqGrid("GridUnload");
		jQuery("#grid1").jqGrid({
   		url:'ajax/searchResults.asp?email_LOGIN='+ user +'&password_LOGIN='+ passWord +'',
    		datatype: "json",
		cache: false,
		mtype: "POST",
    		colNames:['Delegate','Document_Type','Document_Title','Document'],
			colModel:[
				{name:'Delegate',index:'Delegate', width:150},
				{name:'Document_Type',index:'Document_Type', width:150},
				{name:'Document_Title',index:'Document_Title', width:150},
				{name:'Document',index:'Document', width:150}
			],
			pager: jQuery('#pager1'),
			rowNum:10,
			rowList:[10,20,30],
			sortname: 'Document_Title',
			viewrecords: true,
			sortorder: "desc",
    			caption: "Available Reports",
			hidegrid: true,
			width:"585",
			height:"300",
			editurl:"ajax/searchResults.asp",
			grouping:true,
			groupingView : {
				groupField : ['Delegate','Document_Type'],
				groupColumnShow : [false],
				groupCollapse : true
			},
			gridComplete: function() { 
			}
		});
		
		jQuery("#grid1").jqGrid('navGrid','#pager1',{cloneToTop:true,edit:false,add:false,del:false},
		{}, // edit options
		{}, // add options
		{}, //del options
		{
		multipleSearch:false,closeAfterSearch:true, closeAfterReset:true, 
		onClose:function() { 
			//jQuery("#grid1").jqGrid('setGridParam',{postData:{_search:'true'} }).trigger("reloadGrid"); 
			}} // search options
		).navButtonAdd('#pager1',{
   			caption:"Close", 
   			buttonicon:"ui-icon-add", 
   			onClickButton: function(){ 
     				$("#yourDocsGrid").slideUp();
				//document.getElementById("yourDocsGrid").style.display="none";
   			}, 
   			position:"last"
		});

		

		 
		//document.contentForm.action = "ajax/searchResults.asp";
		//document.contentForm.submit();
		//document.contentForm.target="_blank";
		
	}
function applyCurves(){

		$( "#QHSEAccordian" ).accordion({
			collapsible: true,
			active:false
		});
	

  		$('.QHSETitle').corner(settings);
  		$('.QHSEMenu').corner(settings);
  		$('.QHSEContent').corner(settings);
}
function getCourseReport(courseID){
	var loadLink= "custom/getQHSEReport1.asp?courseID="+ courseID +"&typ=BOOKING";
	window.open(loadLink,'_blank');
}
function getDelegateDetails(refID,typ){
	var loadLink= "custom/getQHSEReport1.asp?refID="+ refID +"&typ="+ typ +"";
	window.open(loadLink,'_blank');
}
function getCourseDetails(refID,courseID,typ){
	var loadLink= "getQHSEReport1.asp?refID="+ refID +"&courseID="+ courseID +"&typ="+ typ +"";
	window.open(loadLink,'_blank');
}
