function clear_me(field,default_value) {
	if (field) {
		if (field.value === default_value) {
			field.value = '';
		}
	}
}

function text_to_password(elm){
	if(elm.type!='password'){
		elm.type='password';
		elm.value='';		
	}
}

function submit_wrapping_form(form_id,product_id) {
	form = document.getElementById(form_id);
	product_field = document.getElementById('wrap_product_id');
	product_field.value = product_id;
	form.submit(); 
}


function submit_card_form(form_id,product_id) {
	form = document.getElementById(form_id);
	product_field = document.getElementById('card_product_id');
	product_field.value = product_id;
	form.submit(); 
}

function copyTo(fromFieldId,toFieldId) {
	from = document.getElementById(fromFieldId);
	to = document.getElementById(toFieldId);
	if (from && to) {
		to.value = from.value;
		return true;
	}
}

function switch_to_password(text_id, pass_id) {
	text = document.getElementById(text_id);
	pass = document.getElementById(pass_id);
	if (text && pass) {
		text.style.visibility = 'hidden';
		text.style.display = 'none';
		pass.style.visibility = 'visible';
		pass.style.display = 'inline';
		pass.focus();
	}
}
		

function submit_to_payment_window(formobj){
	targetname=formobj.target;
	newwin = window.open ('about:blank' , targetname,'status,width=390,height=350');
	if (!newwin.opener) {
		newwin.opener = self;
	}
	formobj.submit();
}

function form_submit(form_id) {
	document.getElementById(form_id).submit();
}

function open_window(url,name,x,y){
	window.open(url, name, 'width='+x+', height='+y+', scrollbars=yes');
}

function submit_on_enter(e, input) {
	if ( ! e) {
 		var e = window.event;
	}
	var code = false;
	if (e.keyCode) { // IE
		code = e.keyCode;
	}
	else if (e.which) {
 		code = e.which;
	}
	if (code == 13) {
		input.form.submit();
	}
} // End submit_on_enter()
