// idea & code by RGdesign.org - 2009

/* -------- */
$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++) {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});

$(document).ready(function(){
						   
	if($.getUrlVar('test')==1){
		$('body').prepend('<div id="os"></div><div id="browser"></div>');
		$('#os, #browser').attr('class','output');
		$('#os').html("<span>OS: </span>" + $.client.os + "");
  		$('#browser').html("<span>Browser: </span>" + $.client.browser + "");
	}
	
	if($.client.os == "Mac" && $.client.browser == "Safari"){
		$("ul#menu li.first").addClass('firstmac');
	}
	
	/* cat items custom functions */
	if($('.cat').attr('class')){

		$('.cat').each(function(){
			title = $(this).find('h3').html();
			thumb = $(this).find('.thumb a');
			thumb.attr('rel','[gal]');
			thumb.colorbox({title:title});
			ico = $(this).find('.ico a');
			ico.click(function(){
				t = $(this).parent().parent().find('.thumb a');
				t.trigger('click');
				})
			})
	}
	/* cat items custom functions */
	
	/* -- */
	$('#giant img').fadeMe(1,0,300);
	$('#mainForm .formBt').fadeMe(.8,1,150);
	/* -- */
	$('ul.accthumbs li.last').hover(
		function(){
			$(this).addClass('bth');
			},
		function(){
			$(this).removeClass('bth');
			}
		);
	/* -- */
	$('#homeboxes .homebox').each(function(){
		$(this).hover(
			function(){
				$(this).find('h2').addClass('txt_Azul_0065aa');
				$(this).css('cursor','pointer');
				},
			function(){
				$(this).find('h2').removeClass('txt_Azul_0065aa');
				}
			);
		$(this).click(function(){
			href = $(this).find('a').attr('href');
			window.open(href, "_blank"); 
			return false;
			})
	});
	/* -- */
});
/* -------- */