/*--- IE6 png fix ---*/
var transparentImage = "images/none.gif";
function fixTrans(){
	if (typeof document.body.style.maxHeight == 'undefined'){
		var imgs = document.getElementsByTagName("img");
		for (i = 0; i < imgs.length; i++){
			if (imgs[i].src.indexOf(transparentImage) != -1){
				return;
			}
			if (imgs[i].src.indexOf(".png") != -1){
				var src = imgs[i].src;
				imgs[i].src = transparentImage;
				imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
				imgs[i].style.display = "block";
			}
		}
	}
}
if (document.all && !window.opera) attachEvent("onload", fixTrans);
/*--- gallery function ---*/
function initSlideTabs(){
	
	var change_speed = 800; //in ms
	
	$('div.imagegallery').each(function(){
		
		var thisGallery = $(this);
		
		var btn_prev = $(this).find('div.leftarrow a.previous');
		var btn_next = $(this).find('div.rightarrow a.next');
		
		var imgsList = $(this).find('div.gallery div.block ul li');
		
		var numberOfPanes = parseInt(imgsList.length/3);
		
		if(imgsList.length%3 > 0){
			numberOfPanes = numberOfPanes+1;
		}
		
		var list_h = $(this).find('div.gallery div.block > ul');
		var _step = list_h.parent().width();
		
		var _a = 0;
		list_h.css('left', -_step*_a);
		
		btn_prev.click(function(){
			if(_a > 0) moveList(_a - 1);
			else moveList(numberOfPanes-1);
			return false;
		});
		
		btn_next.click(function(){
			if(_a < numberOfPanes-1) moveList(_a + 1);
			else moveList(0);
			return false;
		});
		
		
		function moveList(_ind){
			if(_ind != _a){
				list_h.animate({left: -_ind*_step}, {queue:false, duration:change_speed});
				_a = _ind;
				
				thisGallery.find("ul.page-numbers li").removeClass('select');
				thisGallery.find("ul.page-numbers li:eq("+_a+")").addClass('select');
			}
		}
		
		//$(this).find("ul.page-numbers li").css('background','black');
		
		$(this).find("ul.page-numbers li").click(function(){
			var index = parseInt( thisGallery.find("ul.page-numbers li").index(this));
			moveList(index);
		});
	});
	
}
if (window.addEventListener) window.addEventListener("load", initSlideTabs, false);
else if (window.attachEvent && !window.opera) window.attachEvent("onload", initSlideTabs);

	
	
			$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-110px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'167px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'100px', left:'167px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
				});
			});

