// JavaScript Document
function openWin(url,w,h)
{window.open(url,'REG','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+w+',height='+h+', top=100,left=400');}

function isEmail(strEmail){
	var patrn = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
	return patrn.test(strEmail);
}

function fixHeight(){
	var l=$(".con_top_l").height();
	var r=$(".con_top_r").height();
	if (l>r)
	{$(".con_top,.con_top_r").height(l);}
	else
	{$(".con_top,.con_top_l").height(r);}
	$(".con_top_rb").css({"position":"absolute","left":"0","bottom":"0"});
}

var url = document.URL.toLowerCase();

$(document).ready(function(){
	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();
	}
	
	var l=$(".con_top_l").height();
	var r=$(".con_top_r").height();
	if (l>r)
	{$(".con_top,.con_top_r,.list_right").height(l);$(".list_right").height(l-$(".con_top_r_ad").height());}
	else
	{$(".con_top,.con_top_l,.list_right").height(r);$(".list_right").height(r-$(".con_top_r_ad").height());}
	
	$(".con_top_rb").css({"position":"absolute","left":"0","bottom":"0"});
	
	$('#carousel_home').jcarousel();
	
	//var h=0;
	//$(".con_bottom_col .dv").each(function(){
	//	if ($(this).height()>h)
	//	{h=$(this).height();}
	//});
	//$(".con_bottom_col .dv").height(h);
	
	if($(".blog_l").length>0)
	{$(".blog_l li.l2 p:first-child").addClass("dyfirst");}
	
	//popup reg window
	//$(".reglink").click(function(){
	//	openWin('reg1.html',380,515);
	//});
	$(".reglink").attr("href","reg.html?keepThis=true&TB_iframe=true&width=360&height=580");
	
	$(".blog_lt img").each(function(){
		if($(this).width()>480)
		{$(this).removeAttr("height"); $(this).width(480); $(this).css("margin","0");}
	});
	
	//$(".blog_l li.l2 a.readmore").click(function(){
	//	var id;
	//	id=$(this).attr("id").replace("r","");
	//	$("#s"+id).hide();
	//	$("#l"+id).show();
	//});
	

	//Featured Band Left Right Cols
	$(".band_index_lb .dv1").each(function(){
		if($(this).find("h3.header").height()>$(this).next(".dv2").find("h3.header").height())
		{$(this).next(".dv2").find("h3.header").height($(this).find("h3.header").height());}
		else
		{$(this).find("h3.header").height($(this).next(".dv2").find("h3.header").height());}
		
		if($.trim($(this).find("h4").text())!="" || $.trim($(this).next(".dv2").find("h4").text())!="")
		{
			if($(this).find("h4").height()>$(this).next(".dv2").find("h4").height())
			{$(this).next(".dv2").find("h4").height($(this).find("h4").height());}
			else
			{$(this).find("h4").height($(this).next(".dv2").find("h4").height());}
		}
		else
		{$(this).find("h4").remove();$(this).next(".dv2").find("h4").remove();}
	});
	
	//Posts by Month Collapse and Expand
	$(".list_right li a[id^='y']").toggle(
		function(){$(this).next("ul").show();},
		function(){$(this).next("ul").hide();}
	);
	
	//reg check
	$("#reg1 form").submit(function(){
		var strTemp=$.trim($("input[name=category][checked]").val());
		if(strTemp=="")
		{alert("Please select an item for \"Category\"");return false;}
		if($.trim($("input[name='screenname']").val())=="")
		{alert("Please enter a value for \"Screen Name\" field");$("input[name='screenname']").focus();return false;}
		if($.trim($(":checkbox[checked]").val()))
		{return false;}
		if($.trim($("input[name='signature']").val())=="")
		{alert("Please enter a value for \"Electronic Signature\" field");$("input[name='signature']").focus();return false;}
	});
	
	$("#reg2 form").submit(function(){
		if($.trim($("#firstname").val())=="")
		{alert("Please enter a value for \"First Name\" field");$("#firstname").focus();return false;}
		if($.trim($("#lastname").val())=="")
		{alert("Please enter a value for \"Last Name\" field");$("#lastname").focus();return false;}
		if($.trim($("#password").val())=="")
		{alert("Please enter a value for \"Password\" field");$("#password").focus();return false;}
		if($.trim($("#password2").val())=="")
		{alert("Please enter a value for \"Confirm Password\" field");$("#password2").focus();return false;}
		if($.trim($("#password").val())!=$.trim($("#password2").val()))
		{alert("Please re-enter your password so that it matches.");$("#password2").focus();return false;}
		if($.trim($("#email").val())=="")
		{alert("Please enter a value for \"E-mail\" field");$("#email").focus();return false;}
		if($.trim($("#email2").val())=="")
		{alert("Please enter a value for \"Confirm E-mail\" field");$("#email2").focus();return false;}
		if($.trim($("#email").val())!=$.trim($("#email2").val()))
		{alert("Please re-enter your E-mail so that it matches.");$("#email2").focus();return false;}
		if($.trim($("#state option:selected").val())=="")
		{alert("Please select an item for \"State\" field");$("#state").focus();return false;}
		if($.trim($("#postal").val())=="")
		{alert("Please enter a value for \"Postal Code\" field");$("#postal").focus();return false;}
	});
	
	$("#left_search_fm").submit(function(){
		var keyword = $("#left_search_fm input[name='keyword']").val().replace("type in search topic","");
		if (keyword == "")
		{alert("Please enter a keyword.");return false;}
	});

	
});

function killErrors(){
	return true;
}
window.onerror = killErrors;