function answersCallback (resp) {
   	answersQuestions = resp;
	showQuestions();
}
function showQuestions() {
	var x = '';
	if (answersQuestions){
    	if (answersQuestions.all.totalResultsReturned > 0) { 
			for (n in answersQuestions.all.questions){
				if ( _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).UserNick != ""){
					var y = '';
					if ( _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Type == "Open"){
					  y = ' - <a href="'+  _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Link + grpOpts + '">' + answersText.an + '</a>';
					}
					x = x + '<li><a  class="subject l3" title="' +  _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Subject +'" href="'+  _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Link + grpOpts + '">' +  _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Subject +'</a><br>' + answersText.askedby +' ' +  _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).UserNick + ' - ' +   _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).NumAnswers +  ' ' +  ( _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).NumAnswers != 1 ? answersText.as : answersText.a) + calcAge( _proxy_jslib_handle(answersQuestions.all.questions, (n), 0, 0).Timestamp) + y + '</li>';
				}
			}
	    } else {
	        x ='<li>'+ answersText.errornone +'</li>';
	    }
    } else {
		x ='<li>'+ answersText.error +'</li>';
	}
	var lists = [1, 3, 4, 8, 'U'];
	for (i in lists){
		var e =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('questions'+ _proxy_jslib_handle(lists, (i), 0, 0));
		if( e ){
			 _proxy_jslib_assign('', e, 'innerHTML', '=', ( x));
		}
	}

}
function calcAge(datestamp) {
   if (datestamp){
    var date = new (Date)(datestamp * 1000);
	var hour = (60 * 60 * 1000);
	var day = hour * 24;
	var month = day * 30;
	var year = month * 12;
    var now = new (Date)();
    var diff = (now - date);
    var output = '';
    var units;
    var x = 0;
	if (diff < hour){
		units = 'm';
		x = diff / 60 / 1000;
	} else if(diff < day){
			units = "h";
			x = diff / hour;
	} else if (diff < month){
			units = "d";
			x = diff / day;
	} else if(diff < year){
				units = "mn";
				x = diff / month;
	}
	var xString =  _proxy_jslib_handle(x, 'toString', '', 1, 0)();
	xString = xString.substring(0, xString.indexOf('.'));
	output = ' - ' + xString + ' ' + ((xString != 1) ?  _proxy_jslib_handle(answersText, (units + 's'), 0, 0) :  _proxy_jslib_handle(answersText, (units), 0, 0)) + ' ' + answersText.ago;		
	return output;
  } else {
    return '';
  }
}

function setCookie() {
	var date = new (Date)();
	date.setTime(date.getTime()+(90*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	 _proxy_jslib_assign('', document, 'cookie', '=', (  'yganwt=1'+ expires + '; path=/group/'));
}


// USER VIEW FUNCTIONS
var d=document;

function answers_js_init() {

	
	
  //Now setup display for mod or user:
  if (answersInfo.user == 2) {
  	   
	  //set up all modes buttons in ie
	  if (oBw.ie) {
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b1").attachEvent("onclick", save_go_mod4); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b2").attachEvent("onclick", go_mod9); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b3").attachEvent("onclick", go_mod6); 
	
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m2b1").attachEvent("onclick", save_go_mod9); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m2b2").attachEvent("onclick", cancel_go_mod9); 
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m3b1").attachEvent("onclick", save_go_mod4); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m3b2").attachEvent("onclick", go_mod9); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("clist").attachEvent("onclick", go_mod2);
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m6b1").attachEvent("onclick", save_go_mod7); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m6b2").attachEvent("onclick", go_mod1); 
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b1").attachEvent("onclick", save_go_mod4); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b2").attachEvent("onclick", go_mod9); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b3").attachEvent("onclick", save_go_mod7); 
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m9b1").attachEvent("onclick", go_mod3); 
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m9b2").attachEvent("onclick", go_mod1); 

	  }
	
	  if (!oBw.ie) {
		//moz
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b1").addEventListener("click",save_go_mod4,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b2").addEventListener("click",go_mod9,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m1b3").addEventListener("click",go_mod6,true);
	  
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m2b1").addEventListener("click",save_go_mod9,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m2b2").addEventListener("click",cancel_go_mod9,true);
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m3b1").addEventListener("click",save_go_mod4,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m3b2").addEventListener("click",go_mod9,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("clist").addEventListener("click",go_mod2,true);
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m6b1").addEventListener("click",save_go_mod7,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m6b2").addEventListener("click",go_mod1,true);
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b1").addEventListener("click",save_go_mod4,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b2").addEventListener("click",go_mod9,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m8b3").addEventListener("click",save_go_mod7,true);
		
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m9b1").addEventListener("click",go_mod3,true);
		 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("m9b2").addEventListener("click",go_mod1,true);
		

	  }
	  //Initial launch with 8 open, options disabled. We may wish to replace following line with logic for when mod4 is default.
	  
	  
	  
	  
    //Moderator view
    hide_wt();//

     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-anshead").style.display="block";
     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ans-om").style.display="block";
     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-ans").style.display="block";
     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("mod-1").style.display="block";//the initial phase
     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrowup").style.display="block";    
    d_options();
    if (answersInfo.category.chosen.ID && answersInfo.category.chosen.ID != ""){
	  go_mod4();
	}
	if(answersInfo.hide == 1){
		go_mod7();
	}
  } else {  //user view
    //user view
    if (answersInfo.hide != 1){
	     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-anshead").style.display="block";
	     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-ans").style.display="block";
	     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("user-1").style.display="block";//the initial phase
	
	     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrowup").className="user";    
	     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrowup").style.display="block";    
	    //alert('hey i am here, about to start cookie check');
		
			var ygrp_ck = new (yg_cookie)();;
			if (ygrp_ck.get('yganwt')==1){
				//alert('cookie swapping display');
			     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("user1btip").style.display="none";
				 _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrowup").style.display="none";
				show_wt();
			} else {
				//alert('else');
				disable_wt();
			     _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("user1btip").style.display="block"; //="none" after initial phase
			}
	}
  }

  
}



//a global var or cookie should prevent ajax loading when user has answers turned off
function remove_u() { //disable
  //remove module
  //alert("set cookie that user hides module");
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-pre-ans").style.display="none";
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-anshead").style.display="none";
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-ans").style.display="none";
}


function hide_user1btip() {
  setCookie();
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("user1btip").style.display = "none";
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrowup").style.display = "none";
  show_wt();
}

function disable_wt() { //display of the "what's this?" link
  obj =  _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ans-wt")
 obj.style.color = "#999";
   _proxy_jslib_assign('', obj.style, 'cursor', '=', ( "default"));
  obj.style.textDecoration = "none";
  
  if (oBw.ie) {
   obj.detachEvent('onclick',show_toptip);
  } else {
   obj.removeEventListener('click',show_toptip,true)
 }
  obj = null;
}
function show_wt() { //display of the "what's this?" link
  obj= _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ans-wt");
  obj.style.display = "inline";
  obj.style.color = "#247CD4";
   _proxy_jslib_assign('', obj.style, 'cursor', '=', ( "pointer"));
  obj.style.textDecoration = "";

  if (oBw.ie) {
    obj.attachEvent("onclick", show_toptip); 
  }
  else {
    //moz
    obj.addEventListener("click",show_toptip,true);
  }
  obj=null;
}
function hide_wt() {
	obj =  _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ans-wt");
	obj.style.display = "none";
}

function show_toptip() {
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-pre-ans").style.display = "block";
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrow").style.display = "inline";
  disable_wt();  
}
function hide_toptip() {
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("ygrp-pre-ans").style.display = "none";
   _proxy_jslib_handle(d, 'getElementById', '', 1, 0)("arrow").style.display = "none";
  show_wt();
}
 ;
_proxy_jslib_flush_write_buffers() ;