function redirect(url)
{
	window.location=url;
}

function confirm_redirect(confirm_text, url)
{
	var answer = confirm(confirm_text);
	if(answer) {
		window.location=url;
		return true;
	}
	return false;
}

function visible(id)
{
  var item = document.getElementById(id);
  var value = item.style.display ? '' : 'none';
  item.style.display = value;
}

function submit(myform)
{
	document.getElementById(myform).submit() ;
}

function show_sig(display, id)
{
	var sig = $('military_signature_large'+id);
	sig.style.display = display;
}

function show_siggy(display, id)
{
	var sig = $('military_siggy_large'+id);
	sig.style.display = display;
}

function show_it(num)
{
	document.getElementById (num).style.visibility = "visible";
}

function hide_it(num)
{
	document.getElementById (num).style.visibility = "hidden";
}

function login_msg() {
	alert('Welcome to MyArmedForces.com  Please update your Military Information so people can search for you.\n\n* It will make it easier for old and new friends to find you when they search.\n* It will only take a few minutes to enter in all of your information.\n\nEnjoy!');
}

function mouseover(div){
	document.getElementById(div).style.backgroundColor='#f8f8f0';
	document.getElementById(div).style.borderColor='#DFDFC3';		
}

function mouseout(div){
	document.getElementById(div).style.backgroundColor='#FFFFFF';
	document.getElementById(div).style.borderColor='#E0E0E0';		
}

function mouseoutuser(div){
	document.getElementById(div).style.backgroundColor='#FAFAFA';
	document.getElementById(div).style.borderColor='#E0E0E0';		
}

function textareafocus(div){
	document.getElementById(div).style.backgroundColor='#FFFFFF';
}	

function textareablur(div){
	document.getElementById(div).style.backgroundColor='#F2F2F2';
}	

function textboxfocus(div){
	document.getElementById(div).style.backgroundColor='#FFFFFF';
}	

function textboxblur(div){
	document.getElementById(div).style.backgroundColor='#F2F2F2';
}	

function dropdownfocus(div){
	document.getElementById(div).style.backgroundColor='#FFFFFF';
}	

function dropdownblur(div){
	document.getElementById(div).style.backgroundColor='#F2F2F2';
}

function check_all(id) {
	var checkboxes = $('cboxes');
	var boxes = checkboxes.getElementsByTagName('input');

	//return false if no records are present to prevent js error
	//if(!theForm.elements['main']) return false;


	if($('main').checked == true) {
		for(var i=0; i < boxes.length; i++) {
			if(boxes[i].type == 'checkbox') boxes[i].checked = true;
		}
	} else {
		for(var i=0; i < boxes.length; i++) {
			if(boxes[i].type == 'checkbox') boxes[i].checked = false;
		}
	}
}


function update_drink(id) {
	var drink_holder = $('drink_holder');
	var drink = $(id);

	var ids = drink_holder.getElementsByTagName('div');

	//hide all images
	for(var i=0; i < ids.length; i++) {
		ids[i].style.display = 'none';
	}

	//show selected image
	drink.style.display = 'block';
}

function check_input(value)
{
	var status = $('status');
	if(status.user_status.value == value) {
		alert('Please enter a status!');
		return false;
	}
	return true;
}
