function lettersubmit( myletter )
	{
	document.searchform.search_letter.value = myletter ;
	document.searchform.submit();
	}
	
function search_catsubmit( mycat )
	{
	document.catsearchform.search_cat.value = mycat ;
	document.catsearchform.submit();
	}
function SubmitMain() {
	if (document.catbrowseform.sub_cat) {
		var suboptions = document.catbrowseform.sub_cat.options;
		var optionexists = false;
		for(i=0;i<suboptions.length;i++) {
			if(suboptions[i].value == ' | ') {
				optionexists = true;	
			}
		}
		if(!optionexists) {
			suboptions[suboptions.length + 1] = new Option('', ' | ');
		}
		document.catbrowseform.sub_cat.value = ' | ' ;
	}
	if (document.catsearchform.search_cat) {
		document.catsearchform.search_cat.value = ' | ' ;
	}
	document.catbrowseform.submit();
}

function SubmitMain_back()
	{
	if (document.catbrowseform.sub_cat)
		{
		document.catbrowseform.sub_cat.value = ' | ' ;
		}
	if (document.catsearchform.search_cat)
		{
		document.catsearchform.search_cat.value = ' | ' ;
		}
	
	document.catbrowseform.submit();
	}

function SubmitMain_Profile()
	{
	if (document.catbrowseform.sub_cat)
		{
		document.catbrowseform.sub_cat.value = ' | ' ;
		}
		
	document.catbrowseform.submit();
	}
		
function SubmitSearch()
	{
	if (document.catsearchform.search_cat)
		{
		document.catsearchform.search_cat.value = ' | ' ;
		}	
	//document.catsearchform.submit();
	}
	
function togglecat(id){
	ul = "cat_" + id + '_ul';
	img = "img_" + id;
	ulElement = document.getElementById(ul);
	imgElement = document.getElementById(img);
	if (ulElement){
		if (ulElement.className == 'closed'){
			ulElement.className = "open";
			imgElement.src = "/2_0/images/tree_open.gif";
			}
		else{
			ulElement.className = "closed";
			imgElement.src = "/2_0/images/tree_closed.gif";
			}
		}
}

function togglesubcat(id){
	ul = "div_" + id + '_exh';
	img = "img_" + id;
	ulElement = document.getElementById(ul);
	imgElement = document.getElementById(img);
	if (ulElement){
		if (ulElement.className == 'closed'){
			ulElement.className = "open";
			imgElement.src = "/2_0/images/tree_open.gif";
			}
		else{
			ulElement.className = "closed";
			imgElement.src = "/2_0/images/tree_closed.gif";
			}
		}
}

function showExhibitors(id,uid,approot){
	togglesubcat(id);
	if($mys_jquery('#div_' + id + '_exh').hasClass('open')){
		$mys_jquery.ajax({
			type: 'get',
			url: approot + '/ajax/profile_exhlist.cfm?exhid=' + id + '&userid=' + uid,
			success: function(data) {
				$mys_jquery('#div_' + id + '_exh').html(data);
			}
		});
	} else {
		$mys_jquery('div_' + id + '_exh').html('');
	}
}
	

function showSubCategories(id,uid,approot){
	togglecat(id);
	if($mys_jquery('#cat_' + id + '_ul').hasClass('open')){
		$mys_jquery.ajax({
			type: 'get',
			url: approot + '/ajax/profile_catlist.cfm?prodid=' + id + '&userid=' + uid,
			success: function(data) {
				$mys_jquery('#cat_' + id + '_ul').html(data);
			}
		});
	} else {
		$mys_jquery('cat_' + id + '_ul').html('');
	}
}
