//allow only numbers
function Numbers(e)
 {
 var keynum;
 var keychar;
 var numcheck;
 
 if(window.event) // IE
   {
   keynum = e.keyCode;
   }
 else if(e.which) // Netscape/Firefox/Opera
   {
   keynum = e.which;
   }
 keychar = String.fromCharCode(keynum);
 numcheck = /\d/;
 return numcheck.test(keychar);
 }

 
 
// appear  divs

  function OpenAnsw(ans_id) {
    var obj_ctrl = getObj(ans_id);
    if ( obj_ctrl ) {
      obj_ctrl.style.display = (obj_ctrl.style.display == "none" ? "block" : "none");
    }
  }
  
  function getObj(obj_name, doc_obj) {
    if (!doc_obj) doc_obj = document;
    if (doc_obj.all)
        return doc_obj.all[obj_name];
    else if (doc_obj.getElementById)
        return doc_obj.getElementById(obj_name);
    return null;
}






startList = function() {
      if (document.all&&document.getElementById) {
            navRoot = document.getElementById("nav");
            for (i=0; i<navRoot.childNodes.length; i++) {
                  node = navRoot.childNodes[i];
                  if (node.nodeName=="LI") {
                        node.onmouseover=function() {
                              this.className+=" over";
                        }
                        node.onmouseout=function() {
                              this.className=this.className.replace (" over", "");
                        }
                  }
            }
      }
}
window.onload=startList;






$(document).ready(function() {
	$("#table-1").tableDnD({
	    onDragClass: "myDragClass",
	    onDrop: function(table, row) {
            var rows = table.tBodies[0].rows;
            var debugStr = "";
            for (var i=0; i<rows.length; i++) {
                debugStr += rows[i].id+":";
            }
	        $("#debugArea").html('<input type="hidden" name="userlist" value="'+debugStr+'">');

	    }
	});
});






$(document).ready(function(){
	
	if (!$.browser.webkit) {
		
		$('INPUT[placeholder], TEXTAREA[placeholder]').blur(function(){ 
			
			if ($(this).val()=='') {
				$(this).val($(this).attr('placeholder'));
				$(this).addClass('m-placeholder');
			}
			
		}).focus(function(){
			
			$(this).removeClass('m-placeholder');
			if ($(this).val()==$(this).attr('placeholder'))
				$(this).val('');
			
		}).each(function(){
			
			if ( ($(this).val()=='') || ($(this).val()==$(this).attr('placeholder')) ) {
				$(this).val( $(this).attr('placeholder') );
				$(this).addClass('m-placeholder');
			}
			
			var form = $(this).closest('FORM');
			if (form.length)
				form.submit(function(){
					if ($(this).val()==$(this).attr('placeholder'))
						$(this).val('');
				});
			
		});
		
	}
	
});
