// capa flotante activa con mouseover

var moz = document.getElementById && !document.all;
var difX = -50
var difY = 15

function getMouseXY(e) {
	var tempX = moz ? e.clientX : event.clientX;
	var tempY = moz ? e.clientY : event.clientY;
	document.getElementById("ticket").style.left = tempX+difX
	document.getElementById("ticket").style.top = tempY+difY
	return true
}

function ticketon(valor,estilo) {
	txt1 = '<table border=0 cellpadding=0 cellspacing=0 style="'+estilo+'"><tr><td class=ne1>'+unescape(valor)+'</td></tr></table>'
	document.getElementById("ticket").innerHTML = txt1
	document.getElementById("ticket").style.visibility = 'visible'
}
   
function ticketoff() {
	document.getElementById("ticket").style.visibility = 'hidden'
	document.getElementById("ticket").innerHTML = ''
}
   
// SlideMenu ...I've changed timer function adding by default open default tab on mouseover
var slideMenu=function(){
	var sp,st,t,m,sa,l,w,sw,ot,ma;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t); ma=sl;}
			m.style.visibility = 'visible';
		},
		timer:function(s){
			s.onmouseover=function(){clearInterval(m.htimer);clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}
			s.onmouseout=function(){clearInterval(m.timer);clearInterval(m.htimer);m.htimer=setInterval(function(){slideMenu.slide(sa[ma-1],true)},t)}
		},
		slide:function(s){
			var cw=parseInt(s.style.width,'10');
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
						owt=owt+(ow-oi)}}
				s.style.width=(w-owt)+'px';
			}else{clearInterval(m.timer)}
		}
	};
}();

/*
DezinerFolio.com Simple Accordians.

Author  : G.S.Navin Raj Kumar
Website : http://dezinerfolio.com

*/

/*
* The Variable names have been compressed to achive a higher level of compression.
*/

// Prototype Method to get the element based on ID
function $(d){
	return document.getElementById(d);
}

// set or get the current display style of the div
function dsp(d,v){
	if(v==undefined){
		return d.style.display;
	}else{
		d.style.display=v;
	}
}

// set or get the height of a div.
function sh(d,v){
	// if you are getting the height then display must be block to return the absolute height
	if(v==undefined){
		if(dsp(d)!='none'&& dsp(d)!=''){
			return d.offsetHeight;
		}
		viz = d.style.visibility;
		d.style.visibility = 'hidden';
		o = dsp(d);
		dsp(d,'block');
		r = parseInt(d.offsetHeight);
		dsp(d,o);
		d.style.visibility = viz;
		return r;
	}else{
		d.style.height=v;
	}
}
/*
* Variable 'S' defines the speed of the accordian
* Variable 'T' defines the refresh rate of the accordian
*/
s=7;
t=10;

//Collapse Timer is triggered as a setInterval to reduce the height of the div exponentially.
function ct(d){
	d = $(d);
	if(sh(d)>0){
		v = Math.round(sh(d)/d.s);
		v = (v<1) ? 1 :v ;
		v = (sh(d)-v);
		sh(d,v+'px');
		//d.style.opacity = (v/d.maxh);
		//d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
	}else{
		sh(d,0);
		dsp(d,'none');
		clearInterval(d.t);
	}
}

//Expand Timer is triggered as a setInterval to increase the height of the div exponentially.
function et(d){
	d = $(d);
	if(sh(d)<d.maxh){
		v = Math.round((d.maxh-sh(d))/d.s);
		v = (v<1) ? 1 :v ;
		v = (sh(d)+v);
		sh(d,v+'px');
		//d.style.opacity = (v/d.maxh);
		//d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
	}else{
		sh(d,d.maxh);
		clearInterval(d.t);
	}
}

// Collapse Initializer
function cl(d){
	if(dsp(d)=='block'){
		clearInterval(d.t);
		d.t=setInterval('ct("'+d.id+'")',t);
	}
}

//Expand Initializer
function ex(d){
	if(dsp(d)=='none'){
		dsp(d,'block');
		d.style.height='0px';
		clearInterval(d.t);
		d.t=setInterval('et("'+d.id+'")',t);
	}
}

// Removes Classname from the given div.
function cc(n,v){
	s=n.className.split(/\s+/);
	for(p=0;p<s.length;p++){
		if(s[p]==v+n.tc){
			s.splice(p,1);
			n.className=s.join(' ');
			//alert(n.className);
			break;
		}
	}
}
//Accordian Initializer
function Accordian(d,s,tc){
	// get all the elements that have id as content
	l=$(d).getElementsByTagName('div');
	c=[];
	for(i=0;i<l.length;i++){
		h=l[i].id;
		if(h.substr(h.indexOf('-')+1,h.length)=='content'){c.push(h);}
	}
	sel=null;
	//then search through headers
	for(i=0;i<l.length;i++){
		h=l[i].id;
		if(h.substr(h.indexOf('-')+1,h.length)=='header'){
			d=$(h.substr(0,h.indexOf('-'))+'-content');
			d.style.display='none';
			d.style.overflow='hidden';
			d.maxh =sh(d);
			d.s=(s==undefined)? 7 : s;
			h=$(h);
			h.tc=tc;
			h.c=c;
			// set the onclick function for each header.
			h.onclick = function(){
				for(i=0;i<this.c.length;i++){
					cn=this.c[i];
					n=cn.substr(0,cn.indexOf('-'));
					if((n+'-header')==this.id){
						ex($(n+'-content'));
						n=$(n+'-header');
						cc(n,'');
						n.className=n.className+' '+n.tc;
					}else{
						cl($(n+'-content'));
						cc($(n+'-header'),'');
					}
				}
			}
			if(h.className.match(/header_highlight/)!=undefined){ sel=h;}
		}
	}
	if(sel!=undefined){sel.onclick();}
}

// change iframe height
function ifrheight(ifr,h) {
	document.getElementById(ifr).style.height = h+'px'
}	

// add to favorites
function addtofavorites() {
	title = document.title; 
	url = window.location.href;
	if (document.all) window.external.AddFavorite(url,title);
	if (window.sidebar) window.sidebar.addPanel(title, url,'');
}

function valorate (valoration,cluster) {
	ifrheight('shopping','150');
	document.location.href='#info'
	document.fvaloration.val.value = valoration;
	document.fvaloration.cluster.value = cluster;
	document.fvaloration.submit();
}

function wnd(url) {
	window.open(url,'privacy','height=400,width=600,scrollbars=yes,status=1');
}

function abrir(url,w,h) {
	window.open(url,'privacy','height='+h+',width='+w+',scrollbars=yes,status=1');
}

function cambiadiv (k,total) {
	for (i=1;i<=total;i++) {
		if (i == k) { 
			document.getElementById('perfil'+i).style.visibility = 'visible';
			document.getElementById('perfilpag'+i).className = 'ne';
		}
		else {
			document.getElementById('perfil'+i).style.visibility = 'hidden';
			document.getElementById('perfilpag'+i).className = 'na';
		}
	}
}
