var myverydocument = window;
var timeout3 = 0;
var timeout5 = 3;
function ventana(url, w_x, h_x, id_hotel, lang, link_h, name, MyTitle, MyDomain)
{
	
if (!Windows.getWindow(name)){
  var first = MyDomain+"/";
  
  first = first + url + "?id="+id_hotel+"&lang="+lang+"&link="+link_h;
  var win = new Window({id: name, className: "alphacube", title: MyTitle, width: w_x, height: h_x, wiredDrag: true, url: first, showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff }); 
  win.refresh();
  win.setDestroyOnClose();
  win.ProcessHTMLEntities = true;
  win.showCenter(true)
  win.toFront();
  var fin = win.getId();
	}
  
}
function getImage(gallery,name)
	{	
		
		var gal = gallery + 'gallery_imager.php';
		var pars = 'photo='+name+'&gallery='+gallery+"big/";
		var myAjax = new Ajax.Updater( 'show', 	gal, { method: 'post', parameters: pars } );
		
	}
var timeout; 
function reload_page(){
timeout=4;
setTimeout(infoTimeout, 1000);
Dialog.info("This window will reload in "+timeout+" seconds", { width:250, height:100, className: "alphacube", showProgress: true });
}

function infoTimeout() { 
	timeout--; 
		
	if (timeout >0) 
		{  Dialog.setInfoMessage("This window will reload in "+timeout+" seconds...")
			setTimeout(infoTimeout, 1000);
		} else {
			
			Dialog.closeInfo();
			
			window.parent.location.reload();
		}
}


function setTimerWaiting (){
	Dialog.info("This window will reload automaticaly. Please Wait", { width:250, height:100, className: "alphacube", showProgress: true });
	}
function closeTimeWaiting (){
	Dialog.closeInfo();
	}	
function directlyReload(){
	Windows.closeAll();
	window.parent.location.reload(true);
	}
	


function mailingthis (){
	timeout3 = 3;
	setTimeout (mailingthis_function, 1000);
	Dialog.info("Sending Email....", { width:250, height:100, className: "alphacube", showProgress: true });
	}
	
function mailingthis_function() { 
	timeout3--; 
		
	if (timeout3 >1) 
		{  Dialog.setInfoMessage("The Email was sended successfully, Thanks")
			setTimeout(infoTimeout, 1000);
		} else {
			Dialog.closeInfo();
			var fin = Windows.getWindow('mailthis');
			fin.close();
		}
}

function printerFriendly(path) {
	if (typeof document.placeholder != "undefined") {
			var mainSrc = document.placeholder.src;
			var mainCaption = document.placeholder.alt;
			path += "&mainUrlOverride=" + mainSrc + "&mainCaptionOverride=" + mainCaption;
	}


	var popup;
	if (path.indexOf('?')== -1) {	
		popup=window.open(path+'?print=true','printerFriendlyView','width=624,height=600,resizable=yes,status=yes,scrollbars=yes,menubar=yes');
		popup.focus();
	}
	else {
		popup=window.open(path+'&print=true','printerFriendlyView','width=624,height=600,resizable=yes,status=yes,scrollbars=yes,menubar=yes');
		popup.focus();
	}
}


function mailsendok (message, redirect){
    timeout3 = 4;   //El tiempo que tarda el refrescar
    if (!redirect){
        redirect1 = false;
    }else{
        redirect1 = redirect;
    }
    
    
    if (Prototype.Browser.IE){
        alert (message);
    }else{
        //alert (message);
        Dialog.info(message, { width:250, height:100, className: "alphacube", showProgress: true });
        }
    
    setTimeout ('mailsendok_callback(\''+message+'\',\''+redirect1+'\')', 1000);
    }
    
function mailsendok_callback(message, redirect) { 
    timeout3--; 
        
    if (timeout3 == 0){  
            if (!Prototype.Browser.IE){
                Dialog.closeInfo(); 
                }
        } else {
            if (!Prototype.Browser.IE){
                Dialog.setInfoMessage(message); 
                }                               
             setTimeout ('mailsendok_callback(\''+message+'\',\''+redirect1+'\')', 1000);
                          
        }
}	