menu_status = new Array(); 
var total_menus = 3;
var menu1active = 0;


function DontSearchFocus(){
	if (menu_status[dontshow1] != 1) {
	// 		Script selects default radio button when Don't Search text is focused and blank
menu_status[dontshow1] = 1;
SearchType('dontshow1', 'd');
	}	
}

function GenericCheck(theid){
//		Generic script for checkboxes
// takes variable name and ads "chk" before for checkbox ID
		var switch_id = document.getElementById('chk'+theid);
		switch_id.checked = true;
}

function GenericCheckUncheck(theid){
//		Generic script for checkboxes
// takes variable name and ads "chk" before for checkbox ID
		var switch_id = document.getElementById('chk'+theid);
		if (switch_id.checked == true){
				switch_id.checked = false;
		}else{
		switch_id.checked = true;		
		}
}

function ClearField(theid, theid2){
		var switch_id = document.getElementById(theid);
		switch_id.value = '';
		var switch_id = document.getElementById(theid2);
		switch_id.checked = false;		
		}

function SearchDates(theid, var_thedate){

    var switch_id = document.getElementById('lastmonth');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('lastyear');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('last3months');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('last6months');
	switch_id.className = 'munhighlightsm';	

	if (theid == "start_date") {
		var switch_id = document.getElementById('start_date');
//			switch_id.value = "";
			switch_id.select();			
	} else	if (theid == "end_date") {
		var switch_id = document.getElementById('end_date');
			switch_id.select();
	} else {
		var switch_id = document.getElementById(theid);
		switch_id.className = 'mhighlight';
			var switch_id = document.getElementById('start_date');
			switch_id.value = var_thedate;			
	}		
	
}

function SearchType(theid, group){
// 		Script for type of search
// 		Takes ID as variable, hides all menus and checkboxes
// 		Clicks checkbox and highlights correct element
//		Checkbox ID should be 'chk'+variable
	if (group=='s') {
    var switch_id = document.getElementById('searchtypemenu1');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('searchtypemenu2');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('searchtypemenu3');
	switch_id.className = 'munhighlightsm';
	}
	if (group=='d') {
menu_status[dontshow1] = 1;	
    var switch_id = document.getElementById('dontshow1');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('dontshow2');
	switch_id.className = 'munhighlightsm';
    var switch_id = document.getElementById('dontshow3');
	switch_id.className = 'munhighlightsm';
	}
    var switch_id = document.getElementById(theid);
	switch_id.className = 'mhighlight';
		var switch_id = document.getElementById('chk'+theid);
		switch_id.checked = true;
	
}

function SingleCheck(theid){
//  	for Case Sensitive checkbox and other single check boxes
// 		takes id of checkbox as theid variable, then checks or unchecks
	if(menu_status[theid] != 'showed') {
		menu_status[theid] = 'showed';
		var switch_id = document.getElementById(theid);
		switch_id.checked = true;
	} else {
		menu_status[theid] = 'hidden';
		var switch_id = document.getElementById(theid);
		switch_id.checked = false;		
	}
}

function GenericHide(theid){
//		Generic hiding script for headers with checkboxes
//		Takes block ID as variable, menu ID must be 'm'+variable, 
//		Checkbox must be 'chk'+variable

	if(menu_status[theid] != 'showed') {
		var switch_id = document.getElementById(theid);
		switch_id.className = 'show';
		var switch_id = document.getElementById('m'+theid);
		switch_id.className = 'mhighlight';
		menu_status[theid] = 'showed';
		var switch_id = document.getElementById('chk'+theid);
		switch_id.checked = true;

	} else {
		var switch_id = document.getElementById(theid);
		switch_id.className = 'hide';
		var switch_id = document.getElementById('m'+theid);
		switch_id.className = 'munhighlight';
		menu_status[theid] = 'hidden';
		var switch_id = document.getElementById('chk'+theid);
		switch_id.checked = false;
		
	}
}