function loadmainframe(mainurl, lefturl, framecount) {	

		
	var curframecount = top.frames.length ;

		if (framecount == 7){framecount = 4;}
		if (framecount == 6){framecount = 3;}
	
	
	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 = top.frames.length ;
	var offset;
	var strToEscape;
	var strMain;
	
	
	if (framecount == 7){framecount = 4;}
	if (framecount == 6){framecount = 3;}
	
	
	if (curframecount != framecount) {
		top.location.href = mainurl;

	}
	else {


		if (mainurl != ''){
			
			if ( mainurl.indexOf("facade")!= -1){
	
			offset=mainurl.indexOf("action");
			strToEscape=mainurl.substring(offset, mainurl.length);
			
			strMain=mainurl.substring(0,offset);
	
				if (strToEscape.indexOf("notfromxml=1")==-1){
		
					mainurl=strMain.concat(escape(strToEscape));
				}
				
			}


		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() {
	//	get the express list
	var searchText = location.search.substr(6)
	var recipe = '';
		
	if (searchText.indexOf('&') != -1) {
		var recipenames = searchText.split('&');
		recipe = recipenames[1];
		
		

	}	
		
	//	if comma delimited list coming from GET	
	//	parse and get the first item
	if (searchText.indexOf(',') != -1) {
		var searchItems = searchText.split(',');
		searchText = searchItems[0];
		searchText = searchText + '&' + recipe

	}	
	else {	
		//	search the string for url encoded characters
		//	to get the position of the first item
		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){
					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;
				}
			}
		}
		searchText = searchText.substring(0, results)
	// + '&recipe=' + recipename;	
	
	}	
	loadmainframe('/dnet/searchresult.aspx?search=' + searchText, '', 4);
}