//ESTE ARCHIVO CONTIENE LAS FUNCIONES AJAX DEL SITIO, ASI COMO LA FUNCIONALIDAD DE LAS ANIMACIONES PARA TODO EL SITIO.

//funcion que se dispara cuando inicial el sitio.
function startSite(ini){
	if(ini!=null){
		LoadTemplate_PageContent('templates/comunicacion.php', ini, 45);
	}else{
		ajaxRequest('comp/buildPage.php?idPagina=1','', '', 'swf/basebaners.swf');
	}
	//ajaxRequest('comp/buildPage.php?idPagina=1','', '', 'swf/basebaners.swf');
	//ajaxRequest('comp/buildPage.php?idPagina=1','', '', 'swf/footer.swf');
	
	SetBaseHeader_View(0);
	SetFooter();
	
	window.open ("intro.php", "intro","top=350,left=450,directories=0,location=0,status=0,toolbar=0,menubar=0,resizable=0,width=320,height=240");
}

function ajaxRequest(url, parameters, onComp, bannerUrl)
{	
	$('content').innerHTML = "<div align='center'><br><br><br><br><br><img src='images/spinner.gif' style='height:32px; width:32px;' /></div>";

	var ajaxRequest = new Ajax.Request(url,
                        {
                                method: 'get',
                                parameters: parameters,
                                asynchronous: true,
								evalScripts: true,
								onCreate:startAjaxRequest,
                                onComplete: function (resp)
								{
									switch(onComp)
									{									
										case "":											
											showResponse(resp);
											//animarContenido();
										break;
										
										case "BuscadorProductos":
											showResponse(resp);																												
											//animarBuscadorProductos();
										break;
										
										case "DetalleProducto":																					
											showResponse(resp);
											animarDetalleProducto();
										break;																	
										
										default:
											alert('NO SE ESTA RECIBIENDO PARAMETRO ONCOMPLETE');
									}																		
								}
                        });	
}

function getHTML(div, url, parameters){
        var myAjax = new Ajax.Updater( div, url, { method: 'get', parameters: parameters });
}

function showResponse(resp)
{
	// Función que recibe el resultado de la petición
	
	$("content").innerHTML = resp.responseText;
}

function startAjaxRequest()
{//Funcion que se lanza al iniciar el llamado del Request.
	//Effect.SlideDown('content');
	//Effect.SlideDown('content', { duration: 1.0 });
}

function modalAjaxWindow(url, iwidth, oklabel) 
{	
	Dialog.alert({url: "comp/contacto.php", options: {method: 'get'}}, 
            {className: "alphacube", width:540, okLabel: "Close"});
	//Dialog.alert({url: url, options: {method: 'get', destroyOnClose:true}}, {width:iwidth, className: "alphacube", okLabel:oklabel})					
}

