
mysPath = function(path){
	return MYS_Path + path + MYS_URLParams;
};

//exhibitor calls
toggleExhibitor = function(element, exhid, exhname, frompage)
{
	if(element.checked){
		manageExhibitor("add", exhid, frompage);
		$$('.item_' + exhid).each(function(e){e.checked = true;});
		return true;
	}else{
		if (confirm('Are you sure you want to remove ' + exhname + ' from your MyShow?')){
			manageExhibitor("delete", exhid, frompage);
			$$('.item_' + exhid).each(function(e){e.checked = false;});
			element.checked = false;
		}else{
			element.checked = true;
		}
	}
}


toggleExhibitorLink = function(element, exhid, exhname, frompage)
{
	element = $(element);
	if(element.hasClassName('exh_add')){
		manageExhibitor("add", exhid, frompage);
		element.innerHTML = 'Remove from MyShow';
		element.removeClassName('exh_add');
		element.addClassName('exh_remove');
	}else{
		if (confirm('Are you sure you want to remove ' + exhname + ' from your MyShow?')){
			manageExhibitor("delete", exhid, frompage);
			if(frompage == 'myshow'){
				$$(".item_" + exhid).each(function(e){e.remove();})
			}else{
				element.innerHTML = 'Add to MyShow';
				element.removeClassName('exh_remove');
				element.addClassName('exh_add');
			}
		}
	}
	return false;
}

manageExhibitor = function(action, exhid, frompage){

	new Ajax.Request(mysPath('/ajax/manage_exhibitor.cfm'), {
		method: 'get',
		parameters: {exhid: exhid, act: action, from: frompage},
		evalScripts: true
	});
	return true;
}
//end exhibitor calls


// profile calls
toggleCategory = function(element, catid, catname)
{
	if(element.checked){
		manageCategory(catid, "add", catname);
	}else{
		if (confirm('Are you sure you want to remove ' + catname + ' from your MyShow Profile?')){
			manageCategory(catid, "delete", catname);
		}else{
			element.checked = true;
		}
	}
}



manageCategory = function(cat_id, action, catname) 
{
	new Ajax.Request(mysPath('/ajax/manage_category.cfm'), {
		method: 'get',
		parameters: {id: cat_id, act: action, redir: '<cfoutput>#CGI.PATH_INFO#</cfoutput>' },
		evalScripts: true,
		onSuccess: function(transport) {
			if (action == 'add') {
				if (confirm('Do you wish to add all exhibitors in ' + catname +'?'))
				{
					AddAllExhibitors(cat_id);
				}
			}}
		}
	);
}

AddAllExhibitors = function(catid) {
	new Ajax.Request(mysPath('/ajax/manage_category_addall.cfm'), {
		method: 'get',
		parameters: {id: catid},
		evalScripts: true,
		onSuccess: function(transport) {
			var exhibitors = [];
			
			$$('#div_' + catid + '_exh input').each(function(e){
				e.checked = true;
				//exhibitors.push(e.value);
			});
			
			//exhibitors.each(function(exhid){$$('.item_' + exhid).each(function(e){;});})
	}});
}


// end profile calls



function validateform()
{
	var frm = document.search
	
	if(frm.rfname.value.length < 1)
	{
		alert('Please fill in your First Name.')
		return false;
	}
	
	if(frm.rlname.value.length < 1)
	{
		alert('Please fill in your Last Name.')
		return false;
	}
	
	if(frm.remail.value.length < 1)
	{
		alert('Please fill in your Email.')
		return false;
	}
	
	if(frm.password.value.length < 1)
	{
		alert('Please fill in a Password.')
		return false;
	}
	
	return true;
}
