var currentTrack = 0;
var firstLoad = true;
(function($) {
		$.fn.customFadeIn = function(speed, callback) {
			$(this).fadeIn(speed, function() {
				if(jQuery.browser.msie)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
		$.fn.customFadeOut = function(speed, callback) {
			$(this).fadeOut(speed, function() {
				if(jQuery.browser.msie)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
	})(jQuery);

$(document).ready(function(){

$("a[rel=lightbox-gal]").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.8,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

$("a.lb-letras").click(function() {
	var url = $(this).attr("href");
		$.fancybox({
			'type' : 'iframe',
			'href' : url,
			'width': 450,
			'height': 460,
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
			'scrolling'		: 'auto',
			'titleShow'		: false,
			'hideOnContentClick' : false
		});
	return false;
});

$('#velcro')
	.css( {backgroundPosition: "50px 0"} )
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"(0 0)", opacity: 1}, 
			{duration:200})
		})
	.mouseout(function(){
		$(this).stop().animate(
			{backgroundPosition:"(50px 0)", opacity: .3}, 
			{duration:100})
		});

$('#header_img').imagesLoaded(function () {$(this).hide().fadeIn(500, 'swing');});
$('#left_content img').imagesLoaded(function () {$(this).hide().fadeIn(500, 'swing');});




$("#buynow").tooltip({ 
		position: "bottom center", 
		relative: true,
		offset: [10, 0],
		effect: 'slide'
});




});// fim ready

$.fn.imagesLoaded = function(callback){
  var elems = this.filter('img'),
      len = elems.length;
      
  elems.bind('load',function(){
      if (--len <= 0){ callback.call(elems,this); }
  }).each(function(){
     // cached images don't fire load sometimes, so we reset src.
     if (this.complete || this.complete === undefined){
        var src = this.src;
        // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
        // data uri bypasses webkit log warning (thx doug jones)
        this.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
        this.src = src;
     }
  });
  return this;
};


/* background plugin */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(i($){c(!C.B||!C.B.Z){e p=u.t;u.t=i(a,f,o){c(f===\'n-m\'){f=\'7\'}c(f!==\'7\'||!a.D||a.D[f]){k p.z(x,y)}e h=a.h;c(!o&&h&&h[f]){k h[f]}k p(a,\'T\',o)+\' \'+p(a,\'S\',o)}}e G=$.E.A;$.E.A=i(8){c(\'n-m\'F 8){8.7=8[\'n-m\'];N 8[\'n-m\']}c(\'7\'F 8){8.7=\'(\'+8.7}k G.z(x,y)};i v(b){b=b.q(/W|X/g,\'w\');b=b.q(/Y|12/g,\'11%\');b=b.q(/([0-9\\.]+)(\\s|\\)|$)/g,"$V$2");e j=b.U(/(-?[0-9\\.]+)(H|\\%|M|I)\\s(-?[0-9\\.]+)(H|\\%|M|I)/);k[J(j[1],10),j[2],J(j[3],10),j[4]]}$.5.P.7=i(5){c(!5.L){e 6=$.t(5.a,\'7\');c(!6){6=\'w w\'}6=v(6);5.6=[6[0],6[2]];e d=v(5.O.Q.7);5.d=[d[0],d[2]];5.r=[d[1],d[3]];5.L=R}e l=[];l[0]=((5.d[0]-5.6[0])*5.K)+5.6[0]+5.r[0];l[1]=((5.d[1]-5.6[1])*5.K)+5.6[1]+5.r[1];5.a.h.7=l[0]+\' \'+l[1]}})(u);',62,65,'|||||fx|start|backgroundPosition|prop||elem|strg|if|end|var|name||style|function|res|return|nowPosX|position|background|force|oldCurCSS|replace|unit||curCSS|jQuery|toArray|0px|this|arguments|apply|animate|defaultView|document|currentStyle|fn|in|oldAnim|px|pt|parseFloat|pos|bgPosReady|em|delete|options|step|curAnim|true|backgroundPositionY|backgroundPositionX|match|1px|left|top|right|getComputedStyle||100|bottom'.split('|'),0,{}))
/* fim background plugin */
function PrintThisPage(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popUp(windowUri, windowName, windowWidth, windowHeight, scrollbars){
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;
    window.open(windowUri, windowName, 'toolbar=0,scrollbars='+ scrollbars +',location=0,statusbar=0,menubar=0,resizable=1,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);
}







