// JavaScript Document
function ele_hide(id)
{
	document.getElementById(id).style.display = "none"
}
function ele_show(id)
{
	document.getElementById(id).style.display = "block"
}
function changeimgsrc(id,src)
{
	var obj = document.getElementById(id);
	obj.src = src
}
function changeclass(id,class1)
{
	document.getElementById(id).className = class1;
}
function fadein(id)
{
	id = "#" + id;
	$(id).fadeIn("slow");
}
function fadeout(id)
{
	id = "#" + id;
	$(id).fadeOut("slow");
}
function slidedown(id)
{
	id = "#" + id;
	$(id).slideDown("medium");
}
function slideup(id)
{
	id = "#" + id;
	$(id).slideUp("medium");
}

function slidetoggle(id)
{
	id = "#" + id;
	$(id).slideToggle("medium");
}
/*function lplinks(currid)
{
	for(i=1;i<=9;i++)
	{
		var id = "LP-link-" + i;
		if(i == Number(currid))
		{
			new slidedown(id);
		}
		else
		{
			new slideup(id);
		}
	}
}*/

function lplinks(currid)
{
	for(i=1;i<=9;i++)
	{
		var id = "LP-link-" + i;
		if(i == Number(currid))
		{
			new slidetoggle(id);
		}else
		{
			new slideup(id);
		}
		
	}
}

function switchabannertabs(currid)
{
	for(i=1;i<=4;i++)
	{
		var id = "bannerpanel-" + i;
		if(Number(currid) == i)
		{
			new fadein(id);
		}
		else
		{
			new ele_hide(id);
		}
	}
}
function festivecont(currid,total)
{
	//alert(total)
	var prefetivehead = "festivehead";
	var prefetivecont = "festivecont";
	for(i=1;i<=Number(total);i++)
	{
		var fetiveheadid = prefetivehead + i;
		var fetivecontid = prefetivecont + i;		
		if(i == Number(currid))
		{
			if(document.getElementById(fetiveheadid).className == "link_festivedetsheadon")
			{
				new ele_hide(fetivecontid);
				document.getElementById(fetiveheadid).className = "link_festivedetshead";	
			}
			else
			{
				new fadein(fetivecontid);
				document.getElementById(fetiveheadid).className = "link_festivedetsheadon";
			}
		}
		else
		{
			new ele_hide(fetivecontid);
			document.getElementById(fetiveheadid).className = "link_festivedetshead";
		}
	}
}

$(document).ready(function(){
						   
	//$(".accordion h3").addClass("active");
	//$(".accordion h3:first").addClass("active");
	//$(".accordion div:not(:first)").hide();

	$(".accordion h3").click(function(){
		$(this).next("div").slideToggle("slow")
		//.siblings("div:visible").slideUp("slow");
		//$(this).toggleClass("active");
		//$(this).siblings("h3").removeClass("active");
	});
	
	
	//////Tab gallery//////
	$(".btm-panel-bg").css({opacity:.4})
	
	$("#collections ul li").hover(function(){
		$(this).addClass('hover');
		//Cufon.refresh('h1');
	},function(){
		$(this).removeClass('hover')
		})
	
	$('#tbWrapper #tab01-content .btm-panel-bg').animate({bottom:'0px'});
	$('#tbWrapper #tab01-content .btm-panel').animate({bottom:'0px'});
	
	$("#collections ul li").click(function(){
		$(this).addClass('active').siblings('li').removeClass('active');
		var tabid ='#'+$(this).attr('id')+'-content';
		var tabImg = ' #'+$(this).attr('id')+'-img01';
		//alert('#tbWrapper2 '+tabid+tabImg);
		//$('#tbWrapper2 '+tabid+tabImg).show();
		$('#tbWrapper2 '+tabid+' div:not(".bye-btn, .btm-panel-bg, .btm-panel")').hide();
		$('#tbWrapper2 '+tabid).stop().fadeIn().siblings('div:visible').hide();
		$('#tbWrapper2 '+tabid).find(tabImg).stop().fadeIn();
		$('#tbWrapper2 '+tabid).find('.btm-panel-bg').show().css({bottom:'-84px'});
		$('#tbWrapper2 '+tabid+' .btm-panel-bg').animate({bottom:'0px'});
		$('#tbWrapper2 '+tabid).find('.btm-panel').css({bottom:'-84px'});
		$('#tbWrapper2 '+tabid+' .btm-panel').animate({bottom:'0px'});
		clearInterval(interval);
		//alert('#'+tabid+'-content')
	})
	
	
	$("#tab01-content .btm-panel img").click(function(){
		$("#tab01-content div:not('.bye-btn, .btm-panel-bg, .btm-panel')").stop().fadeOut();
		var imgId=$(this).attr('id');
		$("#"+imgId).stop().fadeIn();
		clearInterval(interval);
		//alert(largePath);
		return false;
		})
		
		$("#tab02-content .btm-panel img").click(function(){
		$("#tab02-content div:not('.bye-btn, .btm-panel-bg, .btm-panel')").stop().fadeOut();
		var imgId=$(this).attr('id');
		$("#"+imgId).stop().fadeIn();
		clearInterval(interval);
		//alert(largePath);
		return false;
		})
		
		$("#tab03-content .btm-panel img").click(function(){
		$("#tab03-content div:not('.bye-btn, .btm-panel-bg, .btm-panel')").stop().fadeOut();
		var imgId=$(this).attr('id');
		$("#"+imgId).stop().fadeIn();
		clearInterval(interval);
		//alert(largePath);
		return false;
		})
		
		$("#tab04-content .btm-panel img").click(function(){
		$("#tab04-content div:not('.bye-btn, .btm-panel-bg, .btm-panel')").stop().fadeOut();
		var imgId=$(this).attr('id');
		$("#"+imgId).stop().fadeIn();
		clearInterval(interval);
		//alert(largePath);
		return false;
		})
		
	////////////////////////////////////////////////
	var interval;
	interval = setInterval("getTab()", 5000);// 5 secs between requests
	var currentTab = "tab02";
	var i =2;
	getTab=function() {
	//alert("1")
		if (currentTab == "tab0"+i) {
			$("#tab0"+i).addClass('active').siblings('li').removeClass('active');
			$('#tbWrapper2 #tab0'+i+'-content .bigImg').attr({src:'images/tab0'+i+'-img01.jpg'})
			$('#tbWrapper2 #tab0'+i+'-content').fadeIn().siblings('div:visible').hide();
			$('#tbWrapper2 #tab0'+i+'-content').find('.btm-panel-bg').show().css({bottom:'-84px'});
			$('#tbWrapper2 #tab0'+i+'-content .btm-panel-bg').animate({bottom:'0px'});
			$('#tbWrapper2 #tab0'+i+'-content').find('.btm-panel').css({bottom:'-84px'});
			$('#tbWrapper2 #tab0'+i+'-content .btm-panel').animate({bottom:'0px'});
			if(i<4){
				i++;
				}else{
					i=1;	
				}
			currentTab = "tab0"+i;
			//alert(currentTab)
		}

	}
	
	
})

