// JavaScript Document
function comments_add(id)
{$('#comments_add_'+id).toggle(0,function(){document.getElementById('comments_add_'+id).scrollIntoView(false);$('#comments_add_'+id+' textarea').focus();});}

function comments_show(id)
{$('#comments_show_'+id).toggle(0,function(){document.getElementById('comments_show_'+id).scrollIntoView(false);});}

function comments_scroll(id)
{
	var strUrl,strWID;
	strUrl=window.location.href;
	if(strUrl.indexOf("#w")>0)
	{
		strWID=strUrl.substring(strUrl.indexOf("#w")+2);
		if(strWID=='')
		{$('#comments_add_'+id).show();document.getElementById('comments_add_'+id).scrollIntoView(false);$('#comments_add_'+id+' textarea').focus();}
		else
		{$('#comments_show_'+strWID).show();document.getElementById('comments_show_'+strWID).scrollIntoView(false);}
	}
}

function comments_check(id)
{
	$("#comment_fm_"+id).submit(function(){
		if($.trim($("form#comment_fm_"+id+" input[name='author']").val())=="")
		{alert("Please enter a value for \"Name\" field.");$("form#comment_fm_"+id+" input[name='author']").focus();return false;}

		if($.trim($("form#comment_fm_"+id+" input[name='email']").val())=="")
		{alert("Please enter a value for \"E-mail\" field.");$("form#comment_fm_"+id+" input[name='email']").focus();return false;}
		if (!isEmail($.trim($("form#comment_fm_"+id+" input[name='email']").val())))
		{alert("Please enter a valid email address.");$("form#comment_fm_"+id+" input[name='email']").focus();return false;}


		if($.trim($("form#comment_fm_"+id+" input[name='code']").val())=="")
		{alert("Please enter a value for \"captcha\" field.");$("form#comment_fm_"+id+" input[name='code']").focus();return false;}
		if($.trim($("form#comment_fm_"+id+" textarea[name='content']").val())=="")
		{alert("Please enter a value for \"comments\" field.");$("form#comment_fm_"+id+" textarea[name='content']").focus();return false;}
	});
}


function add_home_comments(id)
{
	$('.con_top_rr').hide();
	$('.con_top_rr2').show();
	$('#comments_add_'+id).toggle();
	$(".con_top,.con_top_l").height($('.con_top_rr2').height()+$('.con_top_rb').height());
	document.getElementById('comments_add_'+id).scrollIntoView(false);
}
function show_home_comments(id)
{
	$('.con_top_rr').hide();
	$('.con_top_rr2').show();
	$('#comments_show_'+id).toggle();
	$(".con_top,.con_top_l").height($('.con_top_rr2').height()+$('.con_top_rb').height());
	document.getElementById('comments_show_'+id).scrollIntoView(false);
}

function full_mode()
{
	if(url == 'http://wiretap.magiclamp.net/' || url == 'http://www.wiretapmusic.com/' || url == 'http://wiretapmusic.com/')
	{
		$("#shows_leftnav li[class!='nobor']:gt(1)").show();
		$("#articles_leftnav li:eq(1)").removeClass("nobor");
		$("#articles_leftnav li:gt(1)").show();
		$("#media_leftnav li[class!='nobor']:gt(1)").show();
	}
	fixHeight();

	$('.con_top_rr').hide();
	$('.con_top_rr2').show();
}
function preview_mode()
{
	if(url == 'http://wiretap.magiclamp.net/' || url == 'http://www.wiretapmusic.com/' || url == 'http://wiretapmusic.com/')
	{
		$("#shows_leftnav li[class!='nobor']:gt(1)").hide();
		$("#articles_leftnav li:eq(1)").addClass("nobor");
		$("#articles_leftnav li:gt(1)").hide();
		$("#media_leftnav li[class!='nobor']:gt(1)").hide();
	}
	$(".con_top,.con_top_r").height($(".con_top_l").height());

	$('.con_top_rr').show();
	$('.con_top_rr2').hide();
	document.getElementById('header').scrollIntoView(false);
}
