﻿/* Javascript stuff */
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$(document).ready(function() {

    var loginError = '#ctl00_LoginForm1_LoginView1_Login_FailureText';
    var $loginError = $(loginError);
	if($loginError.html()!="")
	    $loginError.addClass("messageBad");

	/* do sliders */
	$(".btnToggle[rel]").each(
	function(){

		var show = $(this).attr("rel");
		var $div = $('#' + show);
		var height = $div.height();
		
		// keep the login div open if there is a login error, or if we're on the login.aspx page (Access Denied)
		if((!$loginError.html()!="") && (window.location.href.indexOf("ReturnUrl")==-1))
		    $div.hide().css({ height : 0 });
		else
		    $(this).addClass("selected");
		
		$(this).bind (
			"click",
			function(){
				if ($div.is(':visible')) {
					$(this).removeClass("selected");
					$div.animate({ height: 0 }, { duration: 500, easing: "easeOutQuad", complete: function () {
						$div.hide();
					} });
				} else {
					$(this).addClass("selected");
					$div.show().animate({ height : height }, { duration: 500, easing: "easeOutQuad" });
				}
				return false;
			}
		);
	});
	
    // do Cufon
    // Cufon.replace('h1');
    
    
//    /* do multi uploads */
//    $('#multiUploads').MultiFile({ 
//        STRING: { 
//            list: '#multiUploadsList'
//        } 
//    }); 

    
});

