$(document).ready(function() {


	//check if user are login, change frontpage buttons and background image
	if($("body").hasClass("logged-in")){
		
		$("#edit-login").addClass("adminLogin");
		$("#np_content_frontpage_box_1").addClass("np_admin-login-bg");
	}
	
	
	
	
	
	
	
	
	
	
	
	//error message
	$("#np-message").dialog();
	
	//Validate system message box
	$("#lol-message-send-message-form").submit(function(){return systemmessage_validate();});
	
	function systemmessage_validate(){
		var error = false;

		// System message box validation check.
		if (systemMessage()) {
		  error = true;
		}
		if(!error){
			return true;
		}
		// Will prevent form from submitting
		return false;
	}

	function systemMessage(){
		var error = false;
		var message = $("#systemMessageSubmitBox").val();
		
		//check for value en text message box
		if(!message){
			$("#systemMessageSubmitBox").css("border","red 1px solid");
			error = true;
		}
		return error;
	}
	
	
	///*MOVED TO PAGE.TPL.PHP*/
	
//	Cufon.replace('#header a', {hover:true, fontFamily: 'Gotham Bold'});
//	Cufon.replace('button', {hover:true, fontFamily: 'Gotham Bold'});
//	Cufon.replace('h3,h4', {fontFamily: 'Gotham Book'});
//	Cufon.replace('h2','#user-pass button', {fontFamily: 'Gotham Bold'});
//	Cufon.replace('#np_bookmark', {fontFamily: 'Gotham Bold'});
	
	// Make fancy radio buttons
	$('input').checkBox();
	
	
	//IE 6 & 7 HACK, changing the zindex for the submenu, othervise the bottom image of the menu has a higher z-index.
	var $tabs = $("div.tabs");
	if($tabs.length) {
		$("#header").addClass("ieHeader-zindex");
	}

	
	//IE6 & IE7 HACK, add a class to tabs if on a certain page
	var found = (window.location.href.indexOf("/user/register") != -1);
	if(found){
		$tabs.addClass("ieTabTop"); //only adds class that IE reads
	}
	
	//add class to login
	var login = (window.location.href.indexOf("/user/login") != -1);
	if(login){
		//console.log("login page");
		$("div.tabs ul").addClass("leftPanel-Ul"); //add class, so list will layout correctly.
	}


		
	
  var $login = $("#toboggan-login");
  if ($login.length) {
    var $name = $("#edit-name");
    var $pass = $("#edit-pass");
    $("#user-login-form #edit-submit").click(function() {
      var error = false;
      if (!$name.val()) {
        $name.addClass("np-login-error");
        error = true;
      }
      if (!$pass.val()) {
        $pass.addClass("np-login-error");
        error = true;
      }
      if (error) {
        return false;
      }
    });
  }
	
});

