
initializeWindows = function(){
	
	if (window.innerHeight){
		alto = window.innerHeight;
		ancho = window.innerWidth;
	
	}else{
		alto = document.body.clientHeight
		ancho = document.body.clientWidth;
	}
	
	//Mostramos Pantalla Principal
	MochaUI.PrincipalWindow = function(){
		new MochaUI.Window({
			id: 'Principal',
			loadMethod: 'iframe',
			contentURL: 'pages/principal.html',
			title:"Principal",
			x: (ancho-600)/2,
			y: (alto-350)/2+50,
			width: 600,
			height: 350
		});
	}	
	if ($('PrincipalLinkCheck')){ 
		$('PrincipalLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.PrincipalWindow();
		});
	}	
	
	// Buscaro de Dominios
	MochaUI.BuscarDominioWindow = function(){
		new MochaUI.Window({
			id: 'BuscarDominio',
			loadMethod: 'iframe',
			contentURL: 'pages/domainwhois/buscarDominio.php',
			title:"Buscar Dominio",
			x: (ancho-550)/2,
			y: (alto-400)/2+50,
			width: 550,
			height: 400
		});
	}	
	if ($('domainwhoisLinkCheck')){ 
		$('domainwhoisLinkCheck').addEvent('click', function(e){
			new Event(e).stop();
			MochaUI.domainwhoisWindow();
		});
	}	
	
	// Quienes Somos
	MochaUI.QuienesSomosWindow = function(){
		new MochaUI.Window({
			id: 'QuienesSomos',
			title: 'Presentaci&oacute;n de la Empresa',
			loadMethod: 'iframe',
			contentURL: 'pages/nosotros.html',
			width: 530,
			height: 450,
			x: (ancho-600)/2,
			y: (alto-500)/2+50,
			resizeLimit:  {'x': [330, 2500], 'y': [250, 2000]},
			contentBgColor: '#000'			
		});
	}
	if ($('QuienesSomosLinkCheck')) {
		$('QuienesSomosLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.QuienesSomosWindow();
			
		});
	}	
	
	//Noticias
	MochaUI.NoticiasWindow = function(){
		new MochaUI.Window({
			id: 'Noticias',
			title: 'En Construccion',
			loadMethod: 'iframe',
			contentURL: 'pages/construction.html',
			width: 300,
			height: 300,
			x: (ancho-600)/2,
			y: (alto-500)/2+50,
			contentBgColor: '#FFFFFF'			
		});
	}
	if ($('NoticiasLinkCheck')) {
		$('NoticiasLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.NoticiasWindow();
			
		});
	}
	
	//Servicios
	MochaUI.ServiciosWindow = function(){
		new MochaUI.Window({
			id: 'Servicios',
			title: 'En Construccion',
			loadMethod: 'iframe',
			contentURL: 'pages/construction.html',
			width: 300,
			height: 300,
			x: (ancho-600)/2,
			y: (alto-500)/2+50,
			contentBgColor: '#ffffff'			
		});
	}
	if ($('ServiciosLinkCheck')) {
		$('ServiciosLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.ServiciosWindow();
			
		});
	}

	//Contactenos
	MochaUI.ContactenosWindow = function(){
		new MochaUI.Window({
			id: 'Contactenos',
			title: 'Contactenos',
			loadMethod: 'iframe',
			contentURL: 'pages/contactenos.php',
			width: 600,
			height: 400,
			x: (ancho-600)/2,
			y: (alto-350)/2+50
		});
	}
	
	if ($('ContactenosLinkCheck')) {
		$('ContactenosLinkCheck').addEvent('click', function(e){
		new Event(e).stop();
			MochaUI.ContactenosWindow();
			
		});
	}	
	
	//Reloj Pingo
	MochaUI.clockWindow = function(){
		new MochaUI.Window({
			id: 'clock',
			title: 'Canvas Clock',
			addClass: 'transparent',
			loadMethod: 'xhr',
			contentURL: 'js/plugins/coolclock/index.html?t=' + new Date().getTime(),
			onContentLoaded: function(){
				if ( !MochaUI.clockScript == true ){
					new Request({
						url: 'js/plugins/coolclock/scripts/coolclock.js?t=' + new Date().getTime(),
						method: 'get',
						onSuccess: function() {
							if (Browser.Engine.trident) {
								myClockInit = function(){
									CoolClock.findAndCreateClocks();
								};
								window.addEvent('domready', function(){
									myClockInit.delay(10); // Delay is for IE
								});
								MochaUI.clockScript = true;
							}
							else {
								CoolClock.findAndCreateClocks();
							}
						}.bind(this)
					}).send();
				}
				else {
					if (Browser.Engine.trident) {
						myClockInit = function(){
							CoolClock.findAndCreateClocks();
						};
						window.addEvent('domready', function(){
							myClockInit.delay(10); // Delay is for IE
						});
						MochaUI.clockScript = true;
					}
					else {
						CoolClock.findAndCreateClocks();
					}
				}
			},
			shape: 'gauge',
			headerHeight: 30,
			width: 160,
			height: 160,
			x: ancho-170,
			y: alto-280,
			padding: { top: 0, right: 0, bottom: 0, left: 0 },
			bodyBgColor: [250,250,250]
		});	
	}
	if ($('clockLinkCheck')){
		$('clockLinkCheck').addEvent('click', function(e){	
			new Event(e).stop();
			MochaUI.clockWindow();
		});
	}

}

window.addEvent('domready', function(){	
	initializeWindows();
	MochaUI.clockWindow();
	MochaUI.PrincipalWindow();

});

// This runs when a person leaves your page.
window.addEvent('unload', function(){
	if (MochaUI) MochaUI.garbageCleanUp();
});

function cerrarVentanas(a){
			if($('Contactenos') && 'Contactenos'!=a) MochaUI.closeWindow($('Contactenos'));
			if($('Servicios') && 'Servicios'!=a) MochaUI.closeWindow($('Servicios'));
			if($('Noticias') && 'Noticias'!=a) MochaUI.closeWindow($('Noticias'));
			if($('QuienesSomos') && 'QuienesSomos'!=a) MochaUI.closeWindow($('QuienesSomos'));
			if($('BuscarDominio') && 'BuscarDominio'!=a) MochaUI.closeWindow($('BuscarDominio'));
			if($('Principal') && 'Principal'!=a) MochaUI.closeWindow($('Principal'));

}
