/*//////////////////////////////////////////////////
QUERY STRING SEARCH...FOR DEEP LINK CAPABLITIES
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

// Build an empty URL structure in which we will store
// the individual query values by key.

var objURL = new Object();
// Use the String::replace method to iterate over each
// name-value pair in the query string. Location.search
// gives us the query string (if it exists).

window.location.search.replace(
	new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
	// For each matched query string pair, add that
	// pair to the URL struct using the pre-equals
	// value as the key.
	function( $0, $1, $2, $3 ){
		objURL[ $1 ] = $3;
	}
);

var theList=""
var sectionCount=menu.length;

startTable = 	'<table cellpadding="0" cellspacing="0" border="0" width="725">'+
				'		<tr>';
endTable = 		'		</tr>'+
				'</table>';

start_td_33 = 	'<td width="33%" class="alignLeft" height="15">';
start_td_25 = 	'<td width="25%" class="alignLeft" height="15">';
end_td = 		'</td>';
newRow="";

for (i=0;i<menu.length;i++){
	if (sectionCount < 3){
			theList+= start_td_33+'<span style=""><img src="http://www.lexus.com/css/img/vc_RHarrow.gif" class="li_bullet" alt="" border="0"><a id="divID'+i+'_link" class="contxt" href="javascript:void(0);" onclick="showHideDivs(\'divID'+i+'\');">'+menu[i].name+'</a></span>'+end_td;
	}else if (sectionCount >= 3 && sectionCount <= 6){
		
		if (i==2){newRow="</tr><tr>";}else{newRow="";}
		
		theList+= start_td_33+'<span style=""><img src="http://www.lexus.com/css/img/vc_RHarrow.gif" class="li_bullet" alt="" border="0"><a id="divID'+i+'_link" class="contxt" href="javascript:void(0);" onclick="showHideDivs(\'divID'+i+'\');">'+menu[i].name+'</a></span>'+end_td + newRow;
	
	}else if (sectionCount > 6 && sectionCount < 9){
	
		if (i==3){newRow="</tr><tr>";}else{newRow="";}
		
		theList+= start_td_25+'<span style=""><img src="http://www.lexus.com/css/img/vc_RHarrow.gif" class="li_bullet" alt="" border="0"><a id="divID'+i+'_link" class="contxt" href="javascript:void(0);" onclick="showHideDivs(\'divID'+i+'\');">'+menu[i].name+'</a></span>'+end_td + newRow;
		
	}
}

theList = startTable + theList + endTable;
old_bg_ID = "";
function loadBG(bg_ID){	
	
	if (old_bg_ID != "" && old_bg_ID != bg_ID){
		document.getElementById("mainBGImg"+old_bg_ID).style.display="none";
	}
	if (old_bg_ID == "" || old_bg_ID != bg_ID){
		document.getElementById("mainBGImg").style.display="none";
		document.getElementById("mainBGImg"+bg_ID).style.display="block";
	}
	old_bg_ID = bg_ID;
}

var oldDiv = 'divID0';
var oldEle;

function showHideDivs(divID) {
	whichBG = divID;	
	theBG = whichBG.substring(divID.length,divID.length-1);
	loadBG(theBG);
	
	if($(divID)) {
		$(divID).style.display = 'block';
	}
	
	if($(divID+"_link"))
		$(divID+"_link").style.fontWeight="bold";
	
	if(oldDiv && $(oldDiv) && oldDiv != divID) 
		$(oldDiv).style.display = 'none';

	if(oldEle && $(oldEle) && oldEle != (divID+"_link"))
		$(oldEle).style.fontWeight="normal";	
	
	if($(divID)) {
		oldDiv = divID;
		oldEle = divID+"_link";
	}
	$(divID+"_link").blur();	
	adjustFooter();
}
function adjustFooter(){
	footer(Array('specEd'));	
}


