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=600,height=350');
	if (!newwin.opener) {
		newwin.opener = self;
	}
	formobj.submit();
}
/*
function load_background() {
	var rand_pic = Math.floor(Math.random()*15)+1
	document.getElementById('row_info_td').style.background = 'url("/images/backgrounds/'+rand_pic+'.jpg") no-repeat top center;'
}*/

function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function show_hotel_info(hotel_id){
	newwin = window.open('?page_label=hotel_popup&hotel_id='+hotel_id , 'hotel_info', 'status,width=1000,height=550,scrollbars=1');
	newwin.focus();
	if (!newwin.opener) {
		newwin.opener = self;
	}
	return false;
}

function show_package_info(package_id){
	newwin = window.open('?page_label=package_info_popup&package_id='+package_id , 'package_info', 'status,width=770,height=550,scrollbars=1');
	newwin.focus();
	if ( ! newwin.opener) {
		newwin.opener = self;
	}
	return false;
} // End show_package_info()