
function theSlide(id, field){
	if($('#'+field+'state'+id).attr("value") == '1'){
		$("#"+field+id).slideDown(900);
		$('#'+field+'state'+id).attr("value", "0");
	} else if($('#'+field+'state'+id).attr("value") == '0'){
		$("#"+field+id).slideUp(900);
		$('#'+field+'state'+id).attr("value", "1");
	}
}

function removeMenu(id){
	
	var menuid = id;
	
	$.ajax({
		type:"POST",
		url:"process/admin_menu_process.php",
		data:"menuid="+ menuid+"&action=remove",
		dataType:"html",
		success: function(html){ parent.$.fn.colorbox.close(); $('#layer'+menuid).hide(900); }			
	});
	
}


function removePage(id){
	
	var pageid = id;
	
	$.ajax({
		type:"POST",
		url:"process/admin_page_process.php",
		data:"pageid="+ pageid+"&action=remove",
		dataType:"html",
		success: function(html){ parent.$.fn.colorbox.close(); $('#layer'+pageid).hide(900); }			
	});
	
}

function removeUser(id){
	
	var userid = id;
	
	$.ajax({
		type:"POST",
		url:"process/admin_user_process.php",
		data:"userId="+ userid+"&action=remove",
		dataType:"html",
		success: function(html){ parent.$.fn.colorbox.close(); $('#layer'+userid).hide(900); }			
	});
	
}

function removeJob(id){
	var jobid = id;
	$.ajax({
		type:"POST",
		url:"process/admin_jobs_process.php",
		data:"jobid="+ jobid+"&action=remove",
		dataType:"html",
		success: function(html){ parent.$.fn.colorbox.close(); $('#layer'+jobid).hide(900); }			
	});
}

function signUpLoader(){
	$(".miniLoader").show();
}
function signUpDoneLoading(){
	$(".miniLoader").hide();
	$("#signupForm").hide();
	$(".completeMsg").show();
}

function signUp(name, email){
	var thename = name;
	var theemail = email;
	//var itemLayer = layer;
	
	$.ajax({
		type:"POST",
		url:"http://www.touchbasepro.com/Public/Subscription/Subscribe.aspx",
		data:"name="+ thename+"&email="+ theemail+"&ListID=8abccfed-64c0-4162-b41c-ac5222f3822b",
		dataType:"html",
		beforeSend: signUpLoader,
		complete: signUpDoneLoading,
		success: function(html){ /*$(".contentLeft").append(html);*/  }			
	});
}


function cvLoader(){
	$(".miniLoader").show();
}
function cvDoneLoading(){
	$(".miniLoader").hide();
	$("#selectSpan2").hide(600);
	$("#selectSpan").hide(600);
	$("#cvUploadForm").slideUp(900, function(){$(".completeMsg").show(900);});
}

function cvUploadSend(name, email, tel1, tel2, cvfunction, region, thefile, ref, office, apply_to){
	var thename = name;
	var theemail = email;
	var thetel1 = tel1;
	var thetel2 = tel2;
	var thefunction = cvfunction;
	var theregion = region;
	var filename = thefile;
	var theref = ref;
	var theoffice = office;
	var theapply_to = apply_to;
	
	$.ajax({
		type:"POST",
		url:"process/cvupload_process.php",
		data:"name="+ thename+"&email="+ theemail+"&tel1="+ thetel1+"&tel2="+ thetel2+"&function="+ thefunction+"&region="+ theregion+"&thefile="+ filename+"&ref="+ theref+"&office="+ theoffice+"&apply_to="+ theapply_to,
		dataType:"html",
		beforeSend: cvLoader,
		complete: cvDoneLoading,
		success: function(html){ /*$(".contentLeft").append(html);*/ }			
	}); 
}


function staffLoader(){
	$(".miniLoader").show();
}
function staffDoneLoading(){
	$(".miniLoader").hide();
	$("#selectSpan").hide(600);
	$("#needStaffForm").slideUp(900, function(){$(".completeMsg").show(900);});
}

function needStaff(name, email, tel1, person, tel2, cvfunction, region, thefile){
	var thename = name;
	var theemail = email;
	var thetel1 = tel1;
	var theperson = person
	var thetel2 = tel2;
	var thefunction = cvfunction;
	var theregion = region;
	var filename = thefile;
	
	$.ajax({
		type:"POST",
		url:"process/needstaff_process.php",
		data:"name="+ thename+"&email="+ theemail+"&tel1="+ thetel1+"&person="+ theperson+"&tel2="+ thetel2+"&function="+ thefunction+"&region="+ theregion+"&thefile="+ filename,
		dataType:"html",
		beforeSend: staffLoader,
		complete: staffDoneLoading,
		success: function(html){ /*$(".contentLeft").append(html);*/  }			
	}); 
}


