$(window).load(function(){
	var imagewidth=$("#section-news .post-content .image-wrap img").width();
	$("#section-news .post-content .image-wrap").width(imagewidth);
});

$(document).ready(function(){
    
    /*
    if($('.columns .column.second').height()>$('.columns .column.first').height()){
		$('.columns .column.first').height($('.columns .column.second').height()+20);
	}
	*/
	
	$('#customform-subscribe #subscribe-email').val('enter your e-mail address');
	$('#customform-subscribe #subscribe-email').focus(function() {
		if($('#customform-subscribe #subscribe-email').val()=='enter your e-mail address'){
			$('#customform-subscribe #subscribe-email').val('');
		};
	});
	$('#customform-subscribe #subscribe-email').blur(function() {
		if($('#customform-subscribe #subscribe-email').val()== ''){
			$('#customform-subscribe #subscribe-email').val('enter your e-mail address');
		};
	});
	
	if($('.modules').length) {
    	var maxHeight = 0;
	    $('.modules .module').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.modules .module').each(function(){
	        $(this).height(maxHeight);
	    });
    }
	
	if($("#menus").length) {
		$("#menus").tabs();
		$("#menu-tabs a").click(function(){
        	Cufon.refresh('.ui-tabs .ui-tabs-nav li a');
        }); 
	}
	
	if($("#submenus").length) {
		$(".submenus").tabs();
		$(".submenu-tabs a").click(function(){
        	Cufon.refresh('.ui-tabs .ui-tabs-nav li a');
        }); 
	}
    
	Cufon.replace('.ui-tabs .ui-tabs-nav li a', {
		fontFamily: 'Aeon'
	});
    
	if($(".wine-info-box").length) {
		$(".cocktailstab").click(function(){
        	$(".wine-info-box div").hide();
        });
        $(".beertab").click(function(){
        	$(".wine-info-box div").hide();
        });
        $(".winetab").click(function(){
        	$(".wine-info-box div").show();
        });
	}
	

});
    
Cufon.replace('#pageheading, #subtle-heading', {
	fontFamily: 'ArthouseDin',
	textShadow: '1px 1px #333'
});
Cufon.replace('.event .icon .month, .event .icon .day, .hometag, .module h3', {
	fontFamily: 'Avenir'
});
			
function validate_email(field,alerttxt) {
	with (field) { 
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);
			return false;
		}
		else { return true; }
	}
}
function validate_form(thisform,fieldtovalidate)
{
	with (thisform)
	{
	if (validate_email(fieldtovalidate,"Not a valid e-mail address!")==false)
	  { return false;}
	}
}


function getPassword(thisTable,thisId){ 
	  var retVal = "" 
	  retVal = prompt("A password is required to view this video.", ""); 
	  thisURL="/video.cfm";
	  $.post(thisURL, { variable: thisTable, variable2: thisId, variable3: retVal }, function(data){
	    newAnswer=data.replace(/^\s*/, "").replace(/\s*$/, "");
		if (newAnswer == "No") {
	 	 	alert("Incorrect Password!");
		  	window.location.reload();
		  	return false;
		  }
		  else {
		  	return true;
		  } 
	  });
}

function popUp1(message) {



var x = 20;

var y = 20;



	var windowparam = "width=" + 500 + ",height=" + 700 + ",scrollbars=yes,menubar=no,left="+x+",top="+y+",screenX="+x+",screenY="+y;

	popwin = window.open(message, "popwin", windowparam)

	popwin.opener = self;

	popwin.focus()

}

