$(document).ready(function() {
	/*
	$('#customform-subscribe #Field1').val('Enter E-mail Address');
	$('#customform-subscribe #Field1').focus(function() {
		if($('#customform-subscribe #Field1').val()=='Enter E-mail Address'){
			$('#customform-subscribe #Field1').val('');
		};
	});
	$('#customform-subscribe #Field1').blur(function() {
		if($('#customform-subscribe #Field1').val()== ''){
			$('#customform-subscribe #Field1').val('Enter E-mail Address');
		};
	});
	*/
    try { 
	$('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
        delay: 5000,                   // How long between slide transitions in AutoPlay mode
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        animationTime: 600,             // How long the slide transition takes
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",             	// Start text
        stopText: "Stop"               	// Stop text
    });
    } catch(err) {}
    
    if($('.media-section.videos').length) {
    	var maxHeight = 0;
	    $('.media-section.videos .media-item').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.media-section.videos .media-item').each(function(){
	        $(this).height(maxHeight);
	    });
    }
    if($('.media-section.photos').length) {
    	var maxHeight = 0;
	    $('.media-section.photos .media-item').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.media-section.photos .media-item').each(function(){
	        $(this).height(maxHeight);
	    });
    }
    if($('.media-section.ill').length) {
    	var maxHeight = 0;
	    $('.media-section.ill .media-item').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.media-section.ill .media-item').each(function(){
	        $(this).height(maxHeight);
	    });
    }
    
    if($('.store-section').length) {
    	var maxHeight = 0;
	    $('.store-item').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.store-item').each(function(){
	        $(this).height(maxHeight);
	    });
    }
    
    try { $("a[rel='pop']").colorbox(); } catch(err) {}
    
    $('.bodycontent img[src*="uploads"]').css({'margin': '0 8px 25px 8px','padding': '3px','background': '#fff'});
    
    $('#section-index .figure').delay(1500).animate({left: '+=300'}, 800);
    
    $('.activitymod').jScrollPane({
		showArrows: true
	});
    
});
    
Cufon.replace('#primary-menu a,.module.trailer h3,h1.item-title,h2.item-title,h3.style', {
	fontFamily: 'Aeon'
});
Cufon.replace('.slide-detail h2', {
	fontFamily: 'Avenir',
	textShadow: '2px 2px #999'
});
			
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()

}

