var sets=1;/** number of sets **/
var sections=3; /** number of sections **/
var sectionNames=new Array("Section I", "Section II", "Section III");
var pre1="<select id='set_no_id'>";
var pp1="<option value ='";
var pp2="'>";
var pp3="</option>";
var post1="</select>";
var opts='';
var saveresponse =   
	{   
		cache:false,
		success: function(o) {
		document.getElementById('section').innerHTML = o.responseText;
		}   
	} 
function populateHtml() {

    opts = opts + pre1;
    if (sets > 0) {
        for (var j=0; j<sets; j++) {
            opts = opts + pp1 + (j + 1) + pp2 + "Set 111" + pp3;         
        }
        opts = opts + post1;        
        document.getElementById('set_dropdown').innerHTML=opts;
        var ss = '';
        for (var k=0; k<sections; k++) {
            ss = ss + "<a href='#' id='" + (k+1) + "' onclick=\"sectionDetail('"+(k+1)+"')\">" + sectionNames[k] + "</a>";

        }
        document.getElementById('sect_hdr').innerHTML = ss;
    }
    
}
function showDetailSolution()
{
	alert('Detail solution will be available in a while');
}

function sectionDetail(setname) {         
       var url = "/pages/solution"+"/"+setname+"/section_all.html";
       var transaction = YAHOO.util.Connect.asyncRequest("POST", url, saveresponse, null);
    }
function showRegister()
{
 document.getElementById('registered').style.display = "";
 document.getElementById('unregistered').style.display = "none";
 document.getElementById('unregSubmit').style.display = "none";
 document.getElementById('regSubmit').style.display = "";
}
function showNonRegister()
{

 document.getElementById('registered').style.display = "none";
 document.getElementById('regSubmit').style.display = "none";
 document.getElementById('unregistered').style.display = "";
 document.getElementById('unregSubmit').style.display = "";
 
}

function startRegDownload()
{
	var n = document.reg_form.username.value;
	var e = document.reg_form.password.value;
	var msg1 = "";
	var msg = "<span style=\"color:red\">"
	if(n == "")
	{
		msg = msg+"Username cannot be empty<br>";
		msg1 = msg;
	}
	if(e == "")
	{
		msg = msg+"password cannot be empty<br>";
		msg1 = msg;
	}
	if(msg1 == "")
	{
		document.reg_form.submit();
	}else
	{
		document.getElementById("errorMsg").innerHTML = msg1+"</span>";
		document.reg_form.username.select();
		return false;
	}
}
function startUnRegDownload()
{
	var n = document.unreg_form.name.value;
	var e = document.unreg_form.email.value;
	var msg1 = "";
	var msg = "<span style=\"color:red\">"
	if(n == "")
	{
		msg = msg+"Name cannot be empty<br>";
		msg1 = msg;
	}
	if(e == "")
	{
		msg = msg+"Email cannot be empty<br>";
		msg1 = msg;
	}
	if(msg1 == "")
	{
		document.unreg_form.submit();
	}else
	{
		document.getElementById("errorMsg").innerHTML = msg1+"</span>";
		document.unreg_form.username.select();
		return false;
	}

}

