//Form Hintboxes
//Based on: (http://www.askthecssguy.com)
//Updated:5/14/2007
//Notes:
//	Modified to support JQuery

function prepareInputsForHints() {
  var inputs = document.getElementsByTagName("input");
  for (var i=0; i<inputs.length; i++){
    if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
	
	if(inputs[i].parentNode.getElementsByTagName("span")[0].id && $('#' + inputs[i].parentNode.getElementsByTagName("span")[0].id).attr('class') == "registrationHint") {
		
      inputs[i].onfocus = function () {
        this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
      }
      inputs[i].onblur = function () {
        this.parentNode.getElementsByTagName("span")[0].style.display = "none";
      }
	  
	}
    }
  }
  var selects = document.getElementsByTagName("select");
  for (var k=0; k<selects.length; k++){
	 
        if (selects[k].parentNode.getElementsByTagName("span")[0]) {
            if(selects[k].parentNode && selects[k].parentNode.getElementsByTagName("span")[0].id && $('#' + selects[k].parentNode.getElementsByTagName("span")[0].id).attr('class') == "registrationHint") {
          selects[k].onfocus = function () {
            this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
          }
          selects[k].onblur = function () {
            this.parentNode.getElementsByTagName("span")[0].style.display = "none";
          }
        }
	 }
  }
}


function selectDropDown(dropDownID, value)
{
    if(value != null && value.length > 0) {
        var list = document.getElementById(dropDownID);
        
        if(list != null) {    
            for(var i = 0; i < list.options.length; ++i) {
                if(list.options[i].value == value) {
                    list.selectedIndex = i;
                    break;
                }
            }
        }        
    }
}

$(document).ready(function() {

	$('#loginBtn').click(function(){
		$('#loginContainer').fadeIn();
		$('#signupContainer').fadeOut();
		$('#username').focus();
    	return false;
	});
	
	$('#loginCancelBtn').click(function(){
		$('#loginContainer').fadeOut();
		$('#signupContainer').fadeIn();
    	return false;
	});	
	
	 $("#username").bind("keypress", function(e) {
		 if (e.keyCode == 13) {
			 beginLogin();
			 return false;
		}
	 });
	 
	 $("#password").bind("keypress", function(e) {
		 if (e.keyCode == 13) {
			 beginLogin();
			 return false;
		}
	 });	 
});



