function clearField(field, defaultVal) {
	if (field != null && typeof field != "undefined")
	{
		if ((defaultVal != "undefined")&&(field.value == defaultVal)){
			field.value = '';
		}
	}
}


function linkconfirm (text, labelyes, labelcancel, link, classN){
	Dialog.confirm(text, 
			{
				className: classN,
				width:300, 
				okLabel: labelyes, 
				cancelLabel: labelcancel,
				buttonClass: 'button',
				id: 'myD',
				onOk: function(win) {
					document.location.href = link;
				}
			});
	return false;
}

function linkconfirm3D(text, labelyes, labelcancel, url3d, ajaxrequest){
	var idBox = 'myD2';
	var counter = 2;
	while(($(idBox)!= undefined)||($(idBox)!= null)){
		counter++;
		idBox = 'myD'+counter.toString();
		if(counter == 10)
			break;
	}
	Dialog.confirm(text, 
			{
				className: 'alphacube',
				width:500, 
				okLabel: labelyes, 
				cancelLabel: labelcancel,
				buttonClass: 'button',
				id: idBox,
				onOk: function(win) {
					//se l'utente ha checkato il box lo settiamo sul db
					if(document.getElementById('rememberMe').noMore.checked){
						new Ajax.Request(ajaxrequest, {
							method: 'get',
							parameters: {
							op: '2',
							setShipInfos: 'F' 
							}
						});	
					}
					window.location.reload(true);
					var page = window.open(url3d, "aba", "toolbar=0,location=0,status=0,resizable=1");
					page.focus();
				}
			});
	return false;
}


