function submitFunction(i) {
	var theForm=document.getElementById('sortForm');
	var sortBy='P'
	if (i==1) sortBy='D';
	if (i==2) sortBy='R';
	if (i==3) sortBy='P';
	if (i==4) sortBy='DP';
	if (i==5) sortBy='GS';
	if (i==6) sortBy='NCF';
	if (i==7) sortBy='TA';
	if (i==8) sortBy='LN';
	if (i==9) sortBy='ID';
	if (i==10) sortBy='HD';
	theForm.action=displayPageName + '?SB=' + sortBy;
	theForm.submit();
}

function alternate(mousefore,mouseback){ 
	var listID='';
	var cRow='';
	var listObj='';
	var descObj='';
	if(document.getElementsByTagName){  
		var table = document.getElementById('oDivTable');
		var rows = table.getElementsByTagName("tr");   
		for(i = 0; i < rows.length; i++){
			if (rows[i].id.indexOf('X') > -1) {
				cRow=rows[i].id.substring(rows[i].id.indexOf('X')+1);
				rows[i].onmouseover=function() {
					listID=this.id.substring(1);
					listObj=document.getElementById('L' + listID);
					listObj.style.backgroundColor=mouseback;
					listObj.style.color=mousefore;
					if (includeDesc==true) {
						descObj=document.getElementById('D' + listID);
						descObj.style.backgroundColor=mouseback;
						descObj.style.color=mousefore;
					}
				};
				rows[i].onmouseout=function() {
					listID=this.id.substring(1);
					listObj=document.getElementById('L' + listID);
					listObj.style.backgroundColor='';
					listObj.style.color='';
					if (includeDesc==true) {
						descObj=document.getElementById('D' + listID);
						descObj.style.backgroundColor='';
						descObj.style.color='';
					}
				}
				rows[i].onclick=function() {
					listID=this.id.substring(1,this.id.indexOf('X'));
					if (detailsPageName=='/businesses/bli.asp') {
						window.open('/businesses/bli.asp?LID=' + listID,'_blank');
					}
					else {
						location.href=detailsPageName + '?LID=' + listID;
					}
				}
				if(cRow % 2 == 0){
					addClass(rows[i],'shaded'); 
					removeClass(rows[i],'notshaded')
//					rows[i].className = "shaded"; 
				}
				else{ 
					addClass(rows[i],'notshaded'); 
					removeClass(rows[i],'shaded')
//					rows[i].className = "notshaded"; 
				}
			}
		} 
	} 
}

function hasClass (obj, className) {
	if (typeof obj == 'undefined' || obj==null || !RegExp) {
		return false;
	}
	var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
	if (typeof(obj)=="string") {
		return re.test(obj);
	}
	else if (typeof(obj)=="object" && obj.className) {
		return re.test(obj.className);
	}
	return false;
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
	   	var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
	   	ele.className=ele.className.replace(reg,' ');
	}
}
