function loginFaq() {
}

function showFaqElement(thep) {
    var fl = document.getElementById("login_faq_list");
    var itemps = fl.getElementsByTagName("p");
    for(var i=0;i<itemps.length;i++) {
        itemps[i].style.display = (itemps[i] == thep)?'block':'none';
    }
}

/** Log user in as demo user it CM student, which takes user as an anonymous user
 *  into a predetermined test, reset on each invocation.
 *  
 * @return
 */
function startSampleSession() {
	 document.location = '/loginService?user=catchup_demo&pwd=demo';
}


String.prototype.trim = function() {
	  a = this.replace(/^\s+/, '');
	  return a.replace(/\s+$/, '');
	};


function $get(x) {
	return document.getElementById(x);
}



/** Show DHTML window using the innerHTML
    from predefined blocks of HTML in educators.html
*/
function showStandardInfoWindow(title, infoMessage) {
       var closer = '<a id="closer" href="#" onclick="YAHOO.infoWin.destroy();return false">Close</a>';
       infoMessage = closer + infoMessage;

       YAHOO.infoWin = new Object();
       YAHOO.infoWin = new YAHOO.widget.Panel("info-window", {
           width : "500px",
           height : "auto",
           draggable : true,
           fixedcenter : true,
           close : true
       });

       YAHOO.infoWin.setHeader(title);
       YAHOO.infoWin.setBody(infoMessage);
       YAHOO.infoWin.setFooter("");
       YAHOO.infoWin.render("bd");

       YAHOO.infoWin.show();
}

/** Show DHTML window using the innerHTML
from predefined blocks of HTML in educators.html
*/
function showStandardErrorWindow(title, infoMessage) {
	var browserMsg = 'If the problem persists, please clear your browser\'s cache and try again.';
	showErrorWindow(title, infoMessage, browserMsg);
}

function showLoginErrorWindow(title, infoMessage) {
	var browserMsg = '';
	showErrorWindow(title, infoMessage, browserMsg);
}

function showErrorWindow(title, infoMessage, browserMsg) {
   var closer = '[ <a id="closer" href="#" onclick="YAHOO.errorWin.destroy();return false">Close</a> ]';
   var body = '<div style="text-align: center;">' + infoMessage + '<div style="margin: 10px 25px;">' + browserMsg + '</div></div> <div style="padding-top: 10px; text-align: center;">' + closer + '</div>';
   
   YAHOO.errorWin = new Object();
   YAHOO.errorWin = new YAHOO.widget.Panel("error-window", {
       width : "400px",
       height : "auto",
       draggable : true,
       fixedcenter : true,
       close : true
   });

   YAHOO.errorWin.setHeader(title);
   YAHOO.errorWin.setBody(body);
   YAHOO.errorWin.setFooter("");
   YAHOO.errorWin.render("bd");

   YAHOO.errorWin.show();
}


function showGettingStartedGuide() {

    var html = "<iframe width='100%' height='400px' frameborder='no' src='/gwt-resources/cm-admin-getting-started-guide.html'></iframe>";
    var title = "Catchup Math Administrator's Getting Started Guide";

    var closer = '<a id="closer" href="#" onclick="YAHOO.adminManual.destroy();return false">Close</a>';
    html = closer + html;

    YAHOO.adminManual = new Object();
    YAHOO.adminManual = new YAHOO.widget.Panel("adminManual-window", {
        width : "500px",
        height : "auto",
        draggable : true,
        fixedcenter : true,
        close : true
    });

    YAHOO.adminManual.setHeader(title);
    YAHOO.adminManual.setBody(html);
    YAHOO.adminManual.setFooter("");
    YAHOO.adminManual.render("bd");

    YAHOO.adminManual.show();
}

function closeGettingStartedGuideAndGotoURL(newLocation) {
	//alert("in closeAdminGuideAndGotoURL(): " + newLocation);
	var t = setTimeout("YAHOO.adminManual.destroy()", 500);
	parent.gotoURL(newLocation);
}

function gotoURL(newLocation) {
	//alert("gotoURL(): " + newLocation);
	window.location = newLocation;
}

function showHowItWorksVideo() {

    var closer = '<a href="#" onclick="YAHOO.cm.howvideo.destroy();">Close</a>';
    var html= closer + '<iframe src="/how-it-works/" width="100%" height="520px" scrolling="no" frameborder="no"></iframe>' + closer;
    YAHOO.cm = new Object();
    YAHOO.cm.howvideo = new YAHOO.widget.Panel("howvideo", { width:"680px",visible:false, draggable:true, close:true ,fixedcenter:true} );
	 YAHOO.cm.howvideo.setHeader("How Does Catchup Math Work?");
	 YAHOO.cm.howvideo.setBody(html);
	 YAHOO.cm.howvideo.setFooter("");
	 YAHOO.cm.howvideo.render("bd");
	 
    YAHOO.cm.howvideo.show();

    YAHOO.cm.howvideo.hideEvent.subscribe(function(e, a, o){
      // .destroy() throws error in IE, main thing is to stop the video
      YAHOO.cm.howvideo.setBody("");
    });
}

function showMonaMotivationalVideo() {

    var closer = '<a href="#" onclick="YAHOO.cm.motivate.destroy();">Close</a>';
    var html= closer + '<iframe src="/motivational_video/" width="100%" height="250px" scrolling="no" frameborder="no"></iframe>' + closer;
    YAHOO.cm = new Object();
    YAHOO.cm.motivate = new YAHOO.widget.Panel("motivate", { width:"340px",visible:false, draggable:true, close:true ,fixedcenter:true} );
	YAHOO.cm.motivate.setHeader("Catchup Math Motivational Video");
	YAHOO.cm.motivate.setBody(html);
	YAHOO.cm.motivate.setFooter("");
	YAHOO.cm.motivate.render("bd");
	 
    YAHOO.cm.motivate.show();

    YAHOO.cm.motivate.hideEvent.subscribe(function(e, a, o){
      // .destroy() throws error in IE, main thing is to stop the video
      YAHOO.cm.motivate.setBody("");
    });
}



function doLoginAgain() {
	history.go(-1);
}
