// JavaScript Document

function chbk(id){
	
	document.getElementById(id).style.background = 'url("/img/trBack.png")';
}

function rmbk(id){
	
	document.getElementById(id).style.background = 'transparent';
}

function imgCh(img,id){
	document.getElementById(id).src = "/img/" + img;

}

function mt(items){
	if(items == "&nbsp;(empty)&nbsp;"){
		document.getElementById('itmc').innerHTML = "0";
	}else{
		document.getElementById('itmc').innerHTML = "{{ITEMS}}"
	}
}

function remBr(){
	var str = document.getElementById('dept').innerHTML;
	document.getElementById('dept').innerHTML = str.replace(/(<br>)/g,"</li><li>");
}

function addAtt(page){
	var side = document.getElementById("side");
	var x = side.getElementsByTagName("a");
	for(i=0;i<x.length;i++){
		if(page.indexOf(x[i].innerHTML) == 0){
			x.item(i).className = "deptlinkon";
			x.item(i).setAttribute("onmouseover",""); 
			x.item(i).setAttribute("onmouseout","");
			x[i].innerHTML = page.replace(/:/gi,"<br />-");
		}
	}	
}

function Valid(){

		if(window.document.frmMain.txtName.value.length==0){
			alert("Please enter your Name");
			window.document.frmMain.txtName.focus();
			return false;
		}

		var regExEmail= /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

		if(!regExEmail.test(window.document.frmMain.txtEmail.value)){
			alert("Please enter valid Email");
			window.document.frmMain.txtEmail.focus();
			return false;
		}

		if(window.document.frmMain.txtNotes.value.length==0){
			alert("Please enter a Message");
			window.document.frmMain.txtNotes.focus();
			return false;
		}

		return true

	}

