
var whatForm, whatTo, whatText, thirdbox;


function reshow1() {
    //define boxes
	whatFrom = document.forms['courseform'].elements['selectbox1'];
    whatTo = document.forms['courseform'].elements['selectbox2'];	
	thirdbox = document.forms['courseform'].elements['selectbox3'];
	
    //sort third box
	thirdbox.disabled=true;//disable 3rd box on change of first always
    thirdbox.options[0].value = "Please Choose";
    thirdbox.options[0].selected = true;
    
    for (var i = whatTo.length;i > 0;i--)
        whatTo.options[0] = null;
	
	//define option selected
    whatText = whatFrom.options[whatFrom.selectedIndex].text;
	
	//If whatText is Please Choose, disable other objects
	if(whatText=="Please Choose" || whatText=="---------------"){
		whatTo.disabled = true;
		
	}else{
		whatTo.disabled = false;
	}

	//renders options in second box
    showLink2();
	
    //whatTo.options[0].selected = true;
    
}


//Second box function
function reshow2() {
    //define boxes
	whatFrom = document.forms['courseform'].elements['selectbox2'];
    whatTo = document.forms['courseform'].elements['selectbox3'];
	
    for (var i = whatTo.length;i > 0;i--)
        whatTo.options[0] = null;
	
	//define option selected
    whatText = whatFrom.options[whatFrom.selectedIndex].text;
    
    
	//If whatText is 'Please Choose', disable other objects
	if(whatText=="Please Choose" || whatText=="---------------" || whatText=="No products currently available"){
		whatTo.disabled = true;
	}else{
		whatTo.disabled = false;
	}

	//renders options in second box
    showLink3();
	
    whatTo.options[0].selected = true;
}



function load(el) {
    //what = document.forms['courseform'].elements['selectbox3'];
    where = el.options[el.selectedIndex].value;
    if(where!='#'){
        window.location.href = where;
    };
    return false;
}


function load2(el,url) {
    where = url + el.options[el.selectedIndex].value;
    if(where!='#'){
        window.location.href = where;
    };
    return false;
}




function showLink2() {
	opt('#','Please Choose',whatTo);//Default 
	
	if (whatText == 'Oracle Primavera') {
opt('training.php?type=1','All Oracle Primavera Courses',whatTo);
opt('#','---------------',whatTo);
opt('#','Primavera P6 Enterprise Project Portfolio Management', whatTo);
opt('#','Primavera Risk Analysis', whatTo);
opt('#','Primavera P3 Project Planner', whatTo);
opt('#','Primavera Contractor', whatTo);
opt('#','Primavera SureTrak', whatTo);
}
if (whatText == 'Oracle Sun') {
opt('training.php?type=12','All Oracle Sun Courses',whatTo);
opt('#','---------------',whatTo);
opt('#','System and Server Administration', whatTo);
opt('#','Sun Middleware', whatTo);
opt('#','MySQL Database', whatTo);
opt('#','Java Programming and Application Development', whatTo);
}
if (whatText == 'Oracle Database') {
opt('training.php?type=14','All Oracle Database Courses',whatTo);
opt('#','---------------',whatTo);
opt('#','Oracle Database 11g', whatTo);
opt('#','Oracle Database 10g', whatTo);
}
if (whatText == 'Microsoft') {
opt('training.php?type=2','All Microsoft Courses',whatTo);
opt('#','---------------',whatTo);
opt('#','Microsoft Office Project Professional 2007', whatTo);
opt('#','Microsoft Office Project Server 2007', whatTo);
}
if (whatText == 'Portfolio and Project Management') {
opt('training.php?type=3','All Portfolio and Project Management Courses',whatTo);
opt('#','---------------',whatTo);
opt('#','Portfolio Management (PfM)', whatTo);
opt('#','Association for Project Management (APM)', whatTo);
opt('#','General Project Management Skills', whatTo);
}
}



function showLink3(text) {
	opt('#','Please Choose',whatTo);
        
    if (whatText == 'Primavera P6 Enterprise Project Portfolio Management') {
opt('training.php?product=1','All Primavera P6 Enterprise Project Portfolio Management Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=8','Project Management in Primavera P6', whatTo);
opt('training.php?course=10','Advanced Project Management in Primavera P6', whatTo);
opt('training.php?course=41','Resource Management in Primavera P6', whatTo);
opt('training.php?course=13','Migrating from P3 to Primavera P6', whatTo);
opt('training.php?course=44','New Features in Primavera P6 Release 7.0 plus Sneak Peek of Release 8', whatTo);
opt('training.php?course=14','Project Management in Primavera P6 Web Access', whatTo);
opt('training.php?course=21','Resource Management in Primavera P6 Web Access', whatTo);
opt('training.php?course=50','Portfolio Management in Primavera P6 Web Access', whatTo);
opt('training.php?course=27','Primavera P6 System Administration, Configuration and Design', whatTo);
opt('training.php?course=36','Primavera P6 Overview and Reporting', whatTo);
opt('training.php?course=46','Administration in Primavera P6 and P6 Web Access', whatTo);
}
if (whatText == 'Primavera Risk Analysis') {
opt('training.php?product=2','All Primavera Risk Analysis Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=62','Managing Risk in Primavera Risk Analysis 8.6', whatTo);
}
if (whatText == 'Primavera P3 Project Planner') {
opt('training.php?product=3','All Primavera P3 Project Planner Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=4','Planning and Scheduling in Primavera Project Planner (P3)', whatTo);
opt('training.php?course=5','Resource and Cost Analysis in Primavera Project Planner (P3)', whatTo);
opt('training.php?course=6','Managing Project Data in Primavera Project Planner (P3)', whatTo);
}
if (whatText == 'Primavera Contractor') {
opt('training.php?product=4','All Primavera Contractor Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=19','Managing Projects in Primavera Contractor', whatTo);
}
if (whatText == 'Primavera SureTrak') {
opt('training.php?product=5','All Primavera SureTrak Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=7','Introduction to Primavera SureTrak Project Manager', whatTo);
}
if (whatText == 'System and Server Administration') {
opt('training.php?product=24','All System and Server Administration Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=73','Sun Cluster 3.2 Administration', whatTo);
opt('training.php?course=74','Sun SPARC Enterprise MX000 Server Administration', whatTo);
opt('training.php?course=75','Solaris 10 Operating System Essentials', whatTo);
opt('training.php?course=76','System Administration for the Solaris 10 OS Part 1', whatTo);
opt('training.php?course=77','System Administration for the Solaris 10 OS Part 2', whatTo);
opt('training.php?course=78','Make the Transition to the Solaris 10 Operating System', whatTo);
opt('training.php?course=79','Solaris 10 Features for Experienced System Administrators', whatTo);
opt('training.php?course=80','Shell Programming for System Administrators', whatTo);
opt('training.php?course=81','Network Administration for the Solaris 10 Operating System', whatTo);
opt('training.php?course=82','Sun Virtualization: Solaris 10 Logical Domains Administration', whatTo);
opt('training.php?course=83','Sun Virtualization: Solaris 10 Containers Administration', whatTo);
opt('training.php?course=84','Solaris System Performance Management', whatTo);
opt('training.php?course=85','Solaris System Administration for Experienced UNIX Administrators', whatTo);
}
if (whatText == 'Sun Middleware') {
opt('training.php?product=25','All Sun Middleware Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=86','Sun Java System Directory Server EE 6: Maintenance & Operation', whatTo);
opt('training.php?course=87','Sun Identity Manager 8.x: Deployment Fundamentals', whatTo);
}
if (whatText == 'MySQL Database') {
opt('training.php?product=26','All MySQL Database Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=88','MySQL for Developers', whatTo);
opt('training.php?course=89','MySQL for Database Administrators', whatTo);
}
if (whatText == 'Java Programming and Application Development') {
opt('training.php?product=27','All Java Programming and Application Development Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=90','Developing Applications for the Java EE 6 Platform', whatTo);
opt('training.php?course=91','Object-Oriented Analysis and Design Using UML', whatTo);
opt('training.php?course=92','Fundamentals of the Java Programming Language, Java SE 6', whatTo);
opt('training.php?course=93','Java Programming Language, Java SE 6', whatTo);
opt('training.php?course=94','Developing Web Applications using JSF Technologies', whatTo);
opt('training.php?course=95','Web Component Development with Servlets & JSPs, Java EE 6', whatTo);
opt('training.php?course=96','Developing Architectures for Enterprise Java Applications', whatTo);
}
if (whatText == 'Oracle Database 11g') {
opt('training.php?product=28','All Oracle Database 11g Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=97','11g: New Features for Administrators', whatTo);
opt('training.php?course=98','11g: Administration Workshop I', whatTo);
opt('training.php?course=99','11g: Administration Workshop II', whatTo);
opt('training.php?course=100','11g: RAC Administration', whatTo);
opt('training.php?course=101','11g: Performance Tuning', whatTo);
opt('training.php?course=102','11g: Introduction to SQL', whatTo);
opt('training.php?course=103','11g: SQL Tuning Workshop', whatTo);
opt('training.php?course=104','11g: Program with PL/SQL', whatTo);
opt('training.php?course=105','11g: Advanced PL/SQL', whatTo);
opt('training.php?course=106','11g: Data Guard Administration', whatTo);
opt('training.php?course=107','11g: Security', whatTo);
opt('training.php?course=108','11g: Administer a Data Warehouse', whatTo);
opt('training.php?course=111','11g: Data Warehousing Fundamentals', whatTo);
opt('training.php?course=112','11g: Oracle Spatial: Essentials', whatTo);
opt('training.php?course=113','11g: New Features for Administrators Release 2', whatTo);
opt('training.php?course=114','11g: Administration Workshop I Release 2', whatTo);
opt('training.php?course=115','11g: Administration Workshop II Release 2', whatTo);
opt('training.php?course=116','11g: Introduction to SQL Release 2', whatTo);
opt('training.php?course=117','11g: Program with PL/SQL Release 2', whatTo);
}
if (whatText == 'Oracle Database 10g') {
opt('training.php?product=29','All Oracle Database 10g Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=118','10g: Administration Workshop I Release 2', whatTo);
opt('training.php?course=119','10g: Administration Workshop II Release 2', whatTo);
opt('training.php?course=120','10g: Data Guard Administration Release 2', whatTo);
opt('training.php?course=121','10g: Backup and Recovery', whatTo);
opt('training.php?course=122','10g: Oracle Enterprise Manager Grid Control NEW', whatTo);
}
if (whatText == 'Microsoft Office Project Professional 2007') {
opt('training.php?product=6','All Microsoft Office Project Professional 2007 Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=49','Microsoft Project 2007', whatTo);
}
if (whatText == 'Microsoft Office Project Server 2007') {
opt('training.php?product=7','All Microsoft Office Project Server 2007 Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=55','Microsoft EPM 2007 Features Overview', whatTo);
opt('training.php?course=52','Microsoft EPM Fundamentals', whatTo);
opt('training.php?course=53','Microsoft EPM Fundamentals for Administrators', whatTo);
}
if (whatText == 'Portfolio Management (PfM)') {
opt('training.php?product=22','All Portfolio Management (PfM) Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=56','Portfolio Management Overview', whatTo);
opt('training.php?course=57','Project/Programme Portfolio Management', whatTo);
opt('training.php?course=58','GREEN IT and Application Portfolio Management', whatTo);
opt('training.php?course=59','Strategic PfM Alignment, Ranking, Selection and Prioritisation', whatTo);
opt('training.php?course=60','PfM Budget and Resource Allocation', whatTo);
opt('training.php?course=61','PfM Benefits Management Planning and Realisation', whatTo);
}
if (whatText == 'Association for Project Management (APM)') {
opt('training.php?product=11','All Association for Project Management (APM) Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=64','Introductory Certificate in Project Management', whatTo);
opt('training.php?course=65','APMP Complete Project Management (Residential)', whatTo);
opt('training.php?course=66','APMP Complete Project Management (Non-Residential)', whatTo);
opt('training.php?course=67','APMP Examination Preparation', whatTo);
opt('training.php?course=68','Practitioner Qualification Examination Preparation', whatTo);
opt('training.php?course=69','Risk Certificate Level 1', whatTo);
opt('training.php?course=70','Risk Certificate Level 2', whatTo);
}
if (whatText == 'General Project Management Skills') {
opt('training.php?product=10','All General Project Management Skills Courses', whatTo);
opt('#','---------------', whatTo);
opt('training.php?course=38','Fundamentals of Project Management and Planning', whatTo);
}

}

function opt(href,text,dest,selected) {
	if(selected==""){
    selected = false;
    }
    var optionName = new Option(text, href, false, selected);
    var length = dest.length;
    dest.options[length] = optionName;
}

function iedisplayfix(nou){
    var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

    if(IE6){
        var selectedboxno = document.forms['courseform'].elements['selectbox'+nou].selectedIndex;
        document.forms['courseform'].elements['selectbox'+nou].options[selectedboxno+1].selected = true;
        //alert("sbox:"+nou+" optsel:"+selectedboxno);
    }
}


$(document).ready(function(){
						   
$("#courseformappend").html("<form action=\"#\" name=\"courseform\" method=\"post\"><label for=\"selectbox1\">Please select training type</label><select name=\"selectbox1\" id=\"selectbox1\" onChange=\"reshow1()\"></select><hr /><label for=\"selectbox2\">Select product</label><select name=\"selectbox2\" id=\"selectbox2\" onChange=\"load(this);reshow2()\" disabled=\"disabled\"><option>Please Choose</option></select><hr /><label for=\"selectbox3\">Select course</label><select name=\"selectbox3\" id=\"selectbox3\" onChange=\"load(this)\" disabled=\"disabled\"><option>Please Choose</option></select><hr /></form>");

var appendfirst = document.forms['courseform'].elements['selectbox1'];


opt(false,'Please Choose',appendfirst);
opt(false,'---------------',appendfirst);
opt(false,'Oracle Primavera',appendfirst);
opt(false,'Oracle Sun',appendfirst);
opt(false,'Oracle Database',appendfirst);
opt(false,'Microsoft',appendfirst,true);
opt(false,'Portfolio and Project Management',appendfirst);
reshow1();
reshow2();

});