jQuery(document).ready(function() {

var FlashOverlay;
var embedImgSrc
	
	
	//debug mode; hide video player
	//$('embed').hide();
	
	//share controls
	$('#shareemail').hide();
	$('#shareembed').hide();
	$('#sharelink').hide();
	$('#sharesent').hide();
	
	$('#shareemailicon').click( function(){
		$('#shareemail').toggle('normal');
	});

	$('#shareembedicon').click( function(){
		$('#shareembed').toggle('normal');
	});
	
	$('#sharelinkicon').click( function(){
		$('#sharelink').toggle('normal');
	});

	$('.shareclose').click( function(){
		$(this).parent().toggle('normal');
	});

	
	$('#shareanother').click( function(){
		$('#sharesent').hide();
		$('#shareemailform').show('normal');
	});
	
	$('#Action').click( function () {
		var ToEmail = $('#Email').val();
		var ToName = $('#Name').val();
		var FromEmail = $('#FromEmail').val();
		var FromName = $('#FromName').val();
		var LinkURL = $('#linktext').val();
		
		$.get('/friend.asp',{Action:'Send',URL:LinkURL,ToEmail:ToEmail,ToName:ToName,FromEmail:FromEmail,FromName:FromName},function(){
			$('#shareemailform').hide();
			$('#sharesent').show('normal');
		});
	});
	

	select = $("#recipelist img").attr('src');
//	//$("#recipelist img").attr({src: select.replace('th_','tiny_')});

	$('#3rdLevel').tabs();

	// Clear value from subscribe form
	$("#subscribeform .text").click(function () { 
			$(this).val(""); 
		});

	$("#embed textarea").hide();
	
	$("#embed h2").click( function() {
		$("#embed textarea").toggle("slow");
		
		embedImgSrc = $("#embed img").attr('src');
		
		if (embedImgSrc.indexOf("more") > 0 ) {
			embedImgSrc = embedImgSrc.replace("more","close");
		} else {
			embedImgSrc = embedImgSrc.replace("close","more");
		}
		
		$("#embed img").attr({src: embedImgSrc});
	});

	switch(aryPageSetup["CatID"])
	{
		case "5190563":
		$("#tabbar").css('background-position','-140px 0');
		break;
		
		case "7274242":
		$("#tabbar").css('background-position','-270px 0');
		break;

		case "6113055":
		$("#tabbar").css('background-position','-400px 0');
		break;

		case "7538343":
		$("#tabbar").css('background-position','-530px 0');
		
		if (aryPageSetup["SubCatID"]==8057864 ) {
			// swap small to large pic		
			select = $("#mainfeature img").attr('src');
			$("#mainfeature img").attr({src: select.replace('th_','med_')});
			
			// add <more> and expansion
			$(".closeinfo").hide();
			
			$(".moreinfo").click( function() {
				$(this).parent().animate({height: "175"},1000,"linear");
				$(this).parent().children("p").animate({height:"175px"},500);
				$(this).parent().children(".moreinfo").hide();
				$(this).parent().children(".closeinfo").show();		
				
			});
			
			$(".closeinfo").click( function() {
				$(this).parent().animate({height: "75"},1000,"linear");
				$(this).parent().children("p").animate({height:"30px"},500);
				$(this).parent().children(".closeinfo").hide();	
				$(this).parent().children(".moreinfo").show("slow");	
				
			});
		}
		break;

		case "5970254":
		$("#tabbar").css('background-position','-660px 0');
		
		// Swap Pic Sizes for various elements
		if ( aryPageSetup["PageID"]!=9972777){
		select = $("#mainfeature img").attr('src');
		$("#mainfeature img").attr({src: select.replace('th_','med_')});
		}
		break;
	}
});