function loadmainframe(mainurl, lefturl, framecount) {	

	var curframecount = parent.frames.length ;
	
	if (curframecount != framecount) {
		top.location.href = mainurl;
	}
	else {
		if (mainurl != ''){
			top.frames['main'].location.href = mainurl;
		}
				
		if (lefturl != ''){
			top.frames['navbar'].location.href = lefturl;
		}
		
		//if (objToHighlight != ''){
			//top.frames['topbar'].setHighlight('submenu22');
			
		//}				

	}	
}
	
function load_secondary_leftbar(mainurl, lefturl, framecount, primaryhighlight, secondaryhighlight) {	
		
	var curframecount = parent.frames.length ;
	
		
	if (curframecount != framecount) {
		top.location.href = mainurl;
	}
	else {
		if (mainurl != ''){
			top.frames['main'].location.href = mainurl;
		}
				
		if (lefturl != ''){
			top.frames['navbar'].location.href = lefturl;
		}
		
		// Code Sample of what to pass setPrimaryNav method
		// top.frames['topbar'].setPrimaryNav('save', 'SubMenu24');

		// code to highlight primary nav and secondary nav if they exist
		// on top bar	
		if (primaryhighlight != ''){
			
			top.frames['topbar'].setPrimaryNav(primaryhighlight, secondaryhighlight);
			
		}				

	}	
}

function expressShopSearch() {

	searchText = location.search.substr(6)
	rExp = /%0D/g;
	results = searchText.search(rExp)
	if (results == -1) {
		rExp = /%0A/g;
		results = searchText.search(rExp)
		if (results == -1) {
			rExp = /%2C/g;
			results = searchText.search(rExp)
			if (results == -1) {
				rExp = /%20/g;
				results = searchText.search(rExp)
				if (results == -1) {
					results = searchText.length;
				}
			}
		}
	}
	if (results > 30) {
		rExp = /%2C/g;
		results = searchText.search(rExp)
		if (results == -1) {
			rExp = /%20/g;
			results = searchText.search(rExp)
			if (results == -1) {
				results = searchText.length;
			}
		}
	}

	loadmainframe('/superstore/search.asp?search=' + searchText.substring(0, results), '', 7);
}