
function Form_reverce_values(targetForm)
{
	var inputs = targetForm.elements;
	var i, c_val;
	var manager = new CookieManager;
	
	for(i=0; i<inputs.length; i++){
		if(inputs[i].type == '' || inputs[i].type == 'text' || inputs[i].tagName == 'textarea'){
			c_val = manager.getCookie('save_' + inputs[i].name);
			if(typeof(c_val) == 'string'){
				inputs[i].value = unescape(c_val);
			}
			
		}else if((inputs[i].type == 'radio' || inputs[i].type == 'checkbox')){
			c_val = manager.getCookie('save_' + inputs[i].name + escape(inputs[i].value));
			if(c_val == 1){
				inputs[i].checked = 1;
			}
			
		}else if(inputs[i].tagName == 'SELECT'){
			inputs[i].selectedIndex = parseInt(manager.getCookie('save_' + inputs[i].name));
		}
	}
}

function Form_save_values(targetForm)
{
	var inputs = targetForm.elements;
	var i;
	var manager = new CookieManager;
	
	for(i=0; i<inputs.length; i++){
		if(inputs[i].type == '' || inputs[i].type == 'text' || inputs[i].tagName == 'TEXTAREA'){
			manager.setCookie('save_' + inputs[i].name, escape(inputs[i].value));
			
		}else if((inputs[i].type == 'radio' || inputs[i].type == 'checkbox')){
			if(inputs[i].checked){
				manager.setCookie('save_' + inputs[i].name + escape(inputs[i].value), 1);
			}else{
				manager.setCookie('save_' + inputs[i].name + escape(inputs[i].value), 0);
			}
			
		}else if(inputs[i].tagName == 'SELECT'){
			manager.setCookie('save_' + inputs[i].name, inputs[i].selectedIndex);
		}
	}
}


function Form_clear_values(targetForm)
{
	var inputs = targetForm.elements;
	var i;
	var manager = new CookieManager;
	
	for(i=0; i<inputs.length; i++){
		if(inputs[i].type == '' || inputs[i].type == 'text' || inputs[i].tagName == 'textarea'){
			manager.clearCookie('save_' + inputs[i].name);
			
		}else if((inputs[i].type == 'radio' || inputs[i].type == 'checkbox')){
			manager.clearCookie('save_' + inputs[i].name + escape(inputs[i].value));
			
		}else if(inputs[i].tagName == 'SELECT'){
			manager.clearCookie('save_' + inputs[i].name);
		}
	}
}