$(document).ready(function(){
	$('.tab').click(function(e){
		var tabarray = Array("tab1","tab2","tab3","tab4","tab5"); // I'm building an array with my tab ids
		//console.log(tabarray.length);
		for(i=1;i<=tabarray.length;i++){ //looping for each element in my array
			if(tabarray[i-1]!=this.id){ // if the element is not the one that has been clicked
				if($("#tab"+i).hasClass("isactive")){ // if it has the 'isactive' class
					$("#tab"+i).removeClass("isactive"); // remove it.
				}
				$("#tab-"+i).css("display","none"); // hidding other contents
			} else {				
				$("#tab-"+i).css("display","block"); // showing the content for active tab with nice fade
				$("#tab-"+i).hide();
				$("#tab-"+i).fadeIn("slow");
				//alert("#tab-"+i);
			}
			$(this).addClass("isactive"); // add the 'isactive' class to the tab that has been clicked.
		}
	});
	$(".WTBuy").click(function(){
		 botabar=Array("","tabbtm1","tabbtm2");
		 for(i=1;i<=2;i++){
			 if(botabar[i]!="tabbtm2"){
				var elt = $("#"+botabar[i]);
				if(elt.hasClass("isactive")){ // if it has the 'isactive' class
					elt.removeClass("isactive"); // remove it.
				}
				$("#tabbtm-"+i).css("display","none"); // hidding other contents
			} else {    
				$("#tabbtm-"+i).css("display","block"); // showing the content for active tab with nice fade
				$("#tabbtm-"+i).hide();
				$("#tabbtm-"+i).fadeIn("slow");
			}
	   		$("#tabbtm2").addClass("isactive"); // add the 'isactive' class to the tab
		}
		 $.scrollTo($("#tabbtm2"),900,"y");
    });
	$('.tabbtm').click(function(e){
		var tabarraybtm = Array("tabbtm1","tabbtm2"); // I'm building an array with my tab ids
		//console.log(tabarray.length);
		for(i=1;i<=tabarraybtm.length;i++){ //looping for each element in my array
			if(tabarraybtm[i-1]!=this.id){ // if the element is not the one that has been clicked
				if($("#tabbtm"+i).hasClass("isactive")){ // if it has the 'isactive' class
					$("#tabbtm"+i).removeClass("isactive"); // remove it.
				}
				$("#tabbtm-"+i).css("display","none"); // hidding other contents
			} else {				
				$("#tabbtm-"+i).css("display","block"); // showing the content for active tab with nice fade
				$("#tabbtm-"+i).hide();
				$("#tabbtm-"+i).fadeIn("slow");
				//alert("#tab-"+i);
			}
			$(this).addClass("isactive"); // add the 'isactive' class to the tab that has been clicked.
		}
	});


//	$("h2").append('<em></em>')

	$(".thumbs a").click(function(){
	
		var largePath = $(this).attr("href");
		var largeAlt = $(this).attr("title");
		
		$("#largeImg").attr({ src: largePath, alt: largeAlt });
		
		$("h2 em").html(" (" + largeAlt + ")"); return false;
	});
	
});

