$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed:500, // Slide transition speed
        pauseTime:3000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
    });
});
$(document).ready(function(){
    
    /*
    if($('.columns .column.second').height()>$('.columns .column.first').height()){
		$('.columns .column.first .inner').height($('.columns .column.second').height()+40);
	}
	
	
	$('#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($('.page-items').length) {
    	var maxHeight = 0;
	    $('.page-items .page-item').each(function(){
	        if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
	    });
	    $('.page-items .page-item').each(function(){
	        $(this).height(maxHeight);
	    });
    }

	if($("#menus").length) {
		$("#menus").tabs();
		$("#menu-tabs a").click(function(){
        	Cufon.refresh('.ui-tabs .ui-tabs-nav li a');
        }); 
	}
    
	*/
	$(".toggleme").click(function(){
		$(this).toggleClass("down");
		$(this).prev().slideToggle("fast");
	});
	
	$("#alltypesbtn").click(function(){
		$(this).toggleClass("open");
		$("#alltypes").slideToggle("fast");
		return false;
	});
	$("#allclientsbtn").click(function(){
		$(this).toggleClass("open");
		$("#allclients").slideToggle("fast");
		return false;
	});
	
	$("#allclients a").hover(
		function(){
			$(this).children("img.colorimg").show();
		},
		function(){
			$(this).children("img.colorimg").hide();
		}
	);
	
	$("#nav").hover(
		function(){
			$(this).css({'box-shadow': '1px 1px 3px 1px #555','-moz-box-shadow': '1px 1px 3px 1px #555','-webkit-box-shadow': '1px 1px 3px 1px #555'});
		},
		function(){
			$(this).css({'box-shadow': 'none','-moz-box-shadow': 'none','-webkit-box-shadow': 'none'});
		}
	);
	
	$("#primary-menu a").hover(function(){
		$(this).parent().siblings().toggleClass("dim");
	});
	$("#nav.level").hover(
		function(){
			$("#primary-menu").css({'display': 'block'});
		},
		function(){
			$("#primary-menu").css({'display': 'none'});
		}
	);
	
	$("#findus").hover(
		function(){
			$(this).children("#findus-menu-w").animate({opacity: 'show'},300);
			$(this).css({"background-position":"0 -32px"});
		},function(){
			$(this).children("#findus-menu-w").animate({opacity: 'hide'},300);
			$(this).css({"background-position":"0 0"});
		}
	);
	
	$(".work-entry").hover(
		function(){
			$(this).children(".hovertitle").css({'background':'#C20125','color':'#fff'});
		}, function(){
			$(this).children(".hovertitle").css({'background':'url(/site_images/alpha2.png) left top repeat','color':'#C20125'});
		}
	);
	
	$(".hinter").delay(7000).animate({opacity: 'hide'}, 350);
	
	$(".colorpop").colorbox({iframe:true, width:560, height:349});
	
});
			
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()
}

