function o(id)
{
	return document.getElementById(id);
};

function moveCursor(ev) {
	var arrayPageSize = getPageSize();
	var width = arrayPageSize[0];	
		
	ev = (ev)?ev:((window.event)?event:null);
	m = o("loader");
	
	if (ev.clientX>width-85)
		m.style.left=ev.clientX-85+document.body.scrollLeft + "px";
	else
		m.style.left=ev.clientX+15+document.body.scrollLeft + "px";
	
	if (window.innerHeight) {
		pos = window.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop) {
		pos = document.documentElement.scrollTop;
	}
	else if (document.body) {
		pos = document.body.scrollTop;
	};

	m.style.top=ev.clientY+10+pos + "px";
};

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	};
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	};
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	};

	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	};


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); 
	return arrayPageSize;
}

function init()
{
	try {
			xajax.callback.global.onRequest = function() {
				xajax.$('loader').style.display = 'block';
			};
			
			xajax.callback.global.beforeResponseProcessing = function() {  
				xajax.$('loader').style.display='none';
			};
			
			if (navigator.appName=="Microsoft Internet Explorer") {
			  document.onmousemove = moveCursor;
			} else {
			  window.onmousemove = moveCursor;
			};
	} catch(e) {};
	
 try {
    document.createElement('a');
    HTMLElement.prototype.click = function () {
        if (typeof this.onclick == 'function') {
           if (this.onclick({type: 'click'}) && this.href)
               window.open(this.href, this.target? this.target : '_self');
        }
        else if (this.href)
                 window.open(this.href, this.target? this.target : '_self');
    };
 }
 catch (e) {};
 
 try {
 
  var sHash = location.hash;
  if (sHash == "#360")
    slider_a.showHide(7);
  else {
  
  var sLocation = location.href;
  
  if (sLocation.indexOf('offer') != -1 || sLocation.indexOf('oferta') != -1) {
      location.href = location.href + "#360";
      slider_a.showHide(7);
    }
    }
 
 } catch (e) {}
 
};


var lastPage = 0;
function changePage(n) {
	if(n-1==lastPage)
		return;
	
	var a = YAHOO.util.Dom.getElementsBy(function(e){ return true; },'a', o('pages'));
	YAHOO.util.Dom.replaceClass(a[lastPage], 'p_s', 'p_uns');
	YAHOO.util.Dom.replaceClass(a[n-1], 'p_uns', 'p_s');
	lastPage = n-1;
	xajax_changePage(n);
	o("ev").click();
};

function open360(iId) {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog"+iId ).dialog({
width: 630,
height: 610,
			modal: true
		});
}


(window.attachEvent)?attachEvent('onload', init) : addEventListener('load', init, false);
