//---------------------------------------------------------------------------------------'
//Function fires every time a page is loaded
function fncBody_Load() {
	//Make sure the nav menu is correctly displayed - Refresh the menu to display the current sections
	fnc_NavRefresh();
	
	//Show/hide the myPanel
	var myPanel = new cookie('myPanel').read();
	if (myPanel == null || myPanel == "closed") {
		MyPanel_Vis(0)	//Hide it
	} else {
		MyPanel_Vis(1)	//Show it
	}
}
//---------------------------------------------------------------------------------------'
//Function fires every time a page is resized
function fncBody_Resize() {
	
	//Nothing to do at present
	var myPanel = new cookie('myPanel').read();
	if (myPanel == null || myPanel == "closed") {
		MyPanel_Vis(0)	//Hide it
	} else {
		MyPanel_Vis(1)	//Show it
	}
}
//---------------------------------------------------------------------------------------'











//---------------------------------------------------------------------------------------'
//Added by SJF the three functions control the displaying of items on the home page
//Open item in preview window
function PreviewItem(Id_Item,bln_Preview) {
	
	//Reset other background colours
	var intNC = document.all("ncount").value;
	for (var bgc=0; bgc<intNC; bgc++) {
		bit_Viewed = document.all("row_bit_Viewed" + bgc).value
		if (bit_Viewed == 1) {
			document.all("row_" + bgc).className = "news_noprv";
		}
		else {
			document.all("row_" + bgc).className = "news_notViewed";
		}
		
	}
	
	var strSub = "";
	var strDes = "";
	var strAtt = "";
	var strFil = "";
	var strSze = "";
	var strAtt_II = "";
	
	document.all("row_" + Id_Item).className = "news_prv";		
	
	//Get the information from the array of news
	if (bln_Preview == "true") {

		var selArray = eval("ArrayInformation_" + Id_Item);

		strSub = selArray[0];
		strDes = selArray[1];
		strImg = "";
		intlen = selArray.length
		if (intlen > 5)
		{
		    strImg = ("<img src='img/supplier_promo/" + selArray[5] + "' alt=''>")
		}
		strAtt = "";
		strSze = "";
		strFil = "";
		strAtt_II = "";
		if (selArray[2] != "") {
			strAtt = "<strong>Attachment</strong><br><br><a onClick=btnSubmit('oDownload0') style='cursor:hand;'><img src='img/generic/icon_attachment.gif' border='0'></a>";
			strSze = selArray[3];
			strFil = selArray[4];
			strAtt_II = selArray[2];
		}
		
		//Write the information into the page
		document.all.Pvw_Subject.innerHTML = strSub.replace(/\|/g, "'");
		document.all.Pvw_Content.innerHTML = strDes.replace(/\|/g, "'") + "<br /><br />" + strImg;
		document.all.Pvw_Att.innerHTML = strAtt + " " + strSze;
		document.all.odURL0.value = strFil
		document.all.odPath.value = strAtt_II
		document.all.Id_Info.value = Id_Item
	}
	else {
		//Clear the page of any old preview
		document.all.Pvw_Subject.innerHTML = strSub;
		document.all.Pvw_Content.innerHTML = strDes;
		document.all.Pvw_Att.innerHTML = strAtt + " " + strSze;
		document.all.odURL0.value = strFil
		document.all.odPath.value = strAtt_II
		document.all.Id_Info.value = Id_Item
	}
}


//open welcom item
function OpenWelcomeItem (Id_Welcome,str_Type,info_type) {

	if (str_Type == 1) {document.location.href = "/public/news/news_sup_welcome_drill.asp?Id=" + Id_Welcome}
	if (str_Type == 0) {document.location.href = "/public/news/news_welcome_drill.asp?Id=" + Id_Welcome}	
	
	

}

//Open news item
function OpenItem(Id_Item,str_NavURL,info_type) {
		
	//news article
	if (info_type == "NEWS" || info_type == "DOWNLOAD") {document.location.href = str_NavURL + "?ID_Info=" + Id_Item;}
	
	//Forum Reply
	if (info_type == "FORUM") {document.location.href = "/public/forum/forumtopic.asp?TId=" + info_sgroup + "&HP=TRUE&Id_Info=" + Id_Item;}
	
	if (info_type == "SUP_PROMO") {document.location.href = "/public/sup_promotion/sup_promotion.asp?IN_INID=" + Id_Item;}

}


//Show business address on the contacts page
function ShowBusinessAdd(int_Toggle,int_Count) {
	
	/*get the array that's been selected
	var selectedArray = eval("Array" + Id_Company);
	var flgSel = false
	var strA1 = selectedArray[0]
	var strA2 = selectedArray[1]
	var strA3 = selectedArray[2]
	var strA4 = selectedArray[3]*/

	//show the business address
	if (int_Toggle == 1) {
		document.all("b_" + int_Count).style.display = "";
		document.all("p_" + int_Count).style.display = "none";
	}
	//show the personal details
	if (int_Toggle == 0) {
		document.all("p_" + int_Count).style.display = "";
		document.all("b_" + int_Count).style.display = "none";
	}
}
