$(document).ready(function(){

$("#client-access-link").fancybox({'onComplete': function(){
														  $("#username").focus();
														  }});
$("#newsletter-frm").validate({ errorLabelContainer: "#error_box", errorClass: "form-error", rules: {
								email: { required: true, email: true}
							  }, submitHandler: function(){
									// disable the submit bttn
									$("#newsletter-sub-bttn").attr("disabled", "disabled");
									$.post("../subscribe.php", $("#newsletter-frm").serialize(), function(data){ showMsg(data); $("#newsletter-sub-bttn").removeAttr("disabled");});
							  }
	});
});

function showMsg(data){
	$.fancybox({'content': data});
}

function clientLogin(){
	$.post("../processes/client-login.php", $("#client-access-frm").serialize(), function(data){
			if(data == "success"){
				window.location = "http://brillcreative.com/file-upload.php";	
			}
			else{
				$("#client-login-status").html(data);
			}
	});
}

function clearField(id){
	$('#'+id).val('');	
}

function checkField(id, dflt){
	if($('#'+id).val() == ""){
		$('#'+id).val(dflt);
		$('#'+id).addClass('inactive-input');
	}
}

function activateField(id, dflt){
		$('#'+id).removeClass('inactive-input');
		if($('#'+id).val() == dflt){
			clearField(id);
		}
}

//<![CDATA[
box1 = new Image();    
box1.src = "images/box1_hover.jpg";    
box1_hover = new Image();    
box1_hover.src = "images/box1.jpg";    
box2 = new Image();    
box2.src = "images/box2_hover.jpg";   
box2_hover = new Image();    
box2_hover.src = "images/box2.jpg";    
box3 = new Image();    
box3.src = "images/box3_hover.jpg";    
box3_hover = new Image();    
box3_hover.src = "images/box3.jpg";
function swap(){    
	if (document.images){    
	for (var x=0; x < swap.arguments.length; x+=2) {
		document[swap.arguments[x]].src = eval(swap.arguments[x+1] + ".src");    
		}    
	}    
}
//]]>
