var timer=30;$(document).ready(function(){buildTip();doCountdown();});
function buildTip(){
if($('#list li').length>0)$('#list li').hover(function(){$(this).addClass('hover');}, function() {$(this).removeClass('hover');});
if($('a.load-local').length>0)$('a.load-local').cluetip({local:true,cursor:'pointer',showTitle:false,arrows:true,dropShadow:false,width:'700px',positionBy:'auto',tracking:true,sticky:false,leftOffset:'50px'});
if($('a.load-todo').length>0)$('a.load-todo').cluetip({local:true,cursor:'pointer',showTitle:false,arrows:true,dropShadow:false,width:'400px',positionBy:'auto',tracking:true,sticky:false,leftOffset:'20px'});
if($('#date_deadline').length>0)$("#date_deadline").datepicker();
if($('#datepicker').length>0)$("#datepicker").datepicker();
}
function doCountdown(){if ($('#countdown').length > 0&&timer>0) {$('#countdown').html(timer);timer = timer - 1;setTimeout("doCountdown()",1000);} else if ($('#countdown').length > 0&&timer==0) {$('#countdown').html('redirecting...');setTimeout("doRedirect()",1000);}}function doRedirect() {window.location="http://www.ichotelsgroup.com/h/d/pc/1/en/home";}
function deleteConfirmation(v){var q=confirm("Are you sure that you want to delete " + v + "?");if(q)return true;else return false;}
function dialogDelete(e,s,i,w,h) {
	if (w==undefined) w=500;
	if (h==undefined) h=200;
	$("#dialog"+e+i).dialog({
		bgiframe: true,
		height: h,
		width: w,
		resizable: false,
		modal: true,
		title: 'Delete '+s,
		buttons: {
			'Delete': function() {
				__cloneValues = new Array();
                $(":texting", $(this)).each(function()
                {
                        __cloneValues.push($(this).val());
                });
                __cloneValues = __cloneValues.reverse(); 
				var dlg = $(this).clone();
       			$(this).dialog("destroy"); 
       			dlg.css("display", "none");
                $("#form"+e+i).append(dlg);
                $(":password", dlg).each(function()
                {
                	$(this).val(__cloneValues.pop());
                }); 
        		$("#submit"+e+i, dlg).click();
        		return true;
			},
			Cancel: function() {
				$(this).dialog('destroy');
			}
		}
	});
}
