function retrieveCenterOptions(id)
{

    state= document.getElementById('state1');
    state_id = state.options[state.selectedIndex].value;
    document.getElementById('center').options.length = 0;

    url="./centerandSpecSelection.do?value="+state_id+"&valuetype=State";


    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0")
    {
        req.open("POST", url, true);
        req.send(null);
        req.onreadystatechange =function(){
            document.getElementById('center').options.length = 0;
		    
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {   // OK response
                    document.getElementById('center').options[0] = new Option("- - - - - -Select- - - - - -", "0");
                    for ( var i=1; i<(returnElements .length)+1; i++ )
                    {
                        valueLabelPair = returnElements[i-1].split(",");
                        document.getElementById('center').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                var returnElements1=textToSplit1[1].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {                                        // OK response
                    document.getElementById('specialization_id').options[0] = new Option("- - - - - -Select- - - - - -", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ )
                    {
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }				 
			
                }			
			

            }
        }
    }
    return true;
}


function retrieveSpecforCenterOptions(id)
{
    var req;           
    var college= document.getElementById('center');
            
    var college_id = college.options[college.selectedIndex].value;

    if(college_id==0)
    {
        document.getElementById('specialization_id').options[0]= new Option('- - - - -Select- - - - -','0');
    }
    var url="./specilizationSelection.do?college_id="+college_id;

               
    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
                                   
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    alert('hi');
    req.open("POST", url, true);
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.send(college_id);
    req.onreadystatechange =function(){
              
        document.getElementById('specialization_id').options.length = 0;
        if (req.readyState == 4) {
            var textToSplit = req.responseText;    
            var returnElements=textToSplit.split("|");
            if (req.status =="200" | req.status ==200) {                                        // OK response
                document.getElementById('specialization_id').options[0] = new Option("-----Select-----", "0");
                for ( var i=1; i<(returnElements .length)+1; i++ ){
                    var valueLabelPair = returnElements[i-1].split(",");
                    //alert(valueLabelPair);
                    document.getElementById('specialization_id').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                }
            }
        }                 
    };
    return true;
}


function retrieveCenterCourse(){ 
    
   

    specialization= document.getElementById('specialization_id');
            
    specialization_id = specialization.options[specialization.selectedIndex].value;
    if(specialization_id==0){
        document.getElementById('specialization_id').options[0]= new Option('Select','0');
    }

    college= document.getElementById('center');
    college_id = college.options[college.selectedIndex].value;	

    url="./CenterCourseSelection.do?specialization_id="+specialization_id+"&college_id="+college_id;
    
    //Do the Ajax call
    try{
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
                                   
    }catch (e){
        // Internet Explorer
        try{
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
             
    req.open("POST", url, true);
    req.send(null);
    req.onreadystatechange = function(){
        document.getElementById('course_id').options.length = 0;
        if (req.readyState == 4) {
            var textToSplit = req.responseText;
            var textToSplit1=textToSplit.split("~");
            var returnElements1=textToSplit1[1].split("|");
            //alert(textToSplit[0]);
            
            if(textToSplit[0] == "Y"){
                // If selected program is a program with fees
                document.getElementById('course_id').options[0] = new Option("No Courses","No");
                document.getElementById("course_id").disabled = true;
            }else{
                // If selected program is a program without fees
                document.getElementById("course_id").disabled = false;
                document.getElementById('course_id').options[0] = new Option("Select","0");
                for ( var j=1; j<=(returnElements1.length); j++){
                    valueLabelPair = returnElements1[j-1].split(",");
                    //alert('value label pair ='+valueLabelPair[0]+' '+valueLabelPair[1])
                    document.getElementById('course_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                }				 
            }
        }
    };
    return true;
}

function retriveDownPayment(){
    maximuminst= document.getElementById("maximum_installment");            	
    maximum_inst = maximuminst.options[maximuminst.selectedIndex].value;
    var url="./maxInstallmentCount.do?maximum_inst="+maximum_inst;
    document.forms[0].action=url;
    document.forms[0].submit();
}
function showwarningmsg(){	
    //var value=confirm("Please Confirm Course Installment is on Country Level");

    //if (value== true)
    //{
    document.forms[0].submit();
    //}
}


////////////////////////////////

function retrieveZoneandSpecOptions(id)
{
    country= document.getElementById('country');
    country_id = country.options[country.selectedIndex].value;
    document.getElementById('country_region').options.length = 0;
    //document.getElementById('city').options.length = 0;
    document.getElementById('country_region').options[0]= new Option('- - - - - -Select- - - - - -','0');
    //document.getElementById('city').options[0]= new Option('- - - - - -Select- - - - - -','0');
    url="./zoneandSpecSelection.do?value="+country_id+"&valuetype=Country";

    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0")
    {
               
        req.open("POST", url, true);
        req.send(null);
        req.onreadystatechange =function(){
            document.getElementById('country_region').options.length = 0;
		    
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {   // OK response
                    document.getElementById('country_region').options[0] = new Option("Select", "0");
                    for ( var i=1; i<(returnElements .length)+1; i++ ){
                        valueLabelPair = returnElements[i-1].split(",");
                        document.getElementById('country_region').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                var returnElements1=textToSplit1[1].split("|");
                if ((req.status == "200") ||(req.status == 200)){                                        // OK response
                    document.getElementById('specialization_id').options[0] = new Option("Select", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ ){
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }			
			

            }
        }
    }
    return true;
}

///////////////////////////////

function retrieveZoneStateAndSpecOptions(id)
{

    country= document.getElementById('country_region');
    country_id = country.options[country.selectedIndex].value;
    document.getElementById('state1').options.length = 0;
    //document.getElementById('city').options.length = 0;
    document.getElementById('state1').options[0]= new Option('Select','0');
    //document.getElementById('city').options[0]= new Option('Select','0');
    url="./zoneStateandSpecSelection.do?value="+country_id+"&valuetype=CountryRegion";
    
    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0")
    {
        req.open("POST", url, true);
        req.send(null);
        req.onreadystatechange =function(){
            document.getElementById('state1').options.length = 0;
            //		    alert('Hi');
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                //                        alert(returnElements);
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {   // OK response
                    document.getElementById('state1').options[0] = new Option("Select", "0");
                    for ( var i=1; i<(returnElements .length)+1; i++ ){
                        valueLabelPair = returnElements[i-1].split(",");
                        //alert(valueLabelPair);
                        document.getElementById('state1').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                //                        alert("textToSplit1---->"+textToSplit1);
                var returnElements1 = textToSplit1[1].split("|");
                //                        alert("returnElements1---->"+returnElements1);
                if ((req.status == "200") ||(req.status == 200)) 
                {                                        // OK response
                    document.getElementById('specialization_id').options[0] = new Option("Select", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ ){
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }			
            }
        }
    }
    return true;                   
}

/**/ 
function retrieveSpecZoneandSpecOptions(id)
{
    country= document.getElementById('country');
    country_id = country.options[country.selectedIndex].value;
    document.getElementById('country_region').options.length = 0;
    //document.getElementById('city').options.length = 0;
    document.getElementById('country_region').options[0]= new Option('All Zones','0');
    //document.getElementById('city').options[0]= new Option('- - - - - -Select- - - - - -','0');
    url="./zoneandSpecSelectionForSpec.do?value="+country_id+"&valuetype=Country";
      
    //Do the Ajax call
    try
    {
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0")
    {
        req.open("POST", url, true);
        req.send(country_id);
        req.onreadystatechange =function(){
            document.getElementById('country_region').options.length = 0;
            document.getElementById('state1').options.length = 0;  
            document.getElementById('center').options.length = 0;  
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {   // OK response
                    document.getElementById('country_region').options[0] = new Option("All Zones", "0");
                    document.getElementById('state1').options[0] = new Option("All States", "0");
                    document.getElementById('center').options[0] = new Option("All Centers", "0");
                    
                    for ( var i=1; i<(returnElements.length)+1; i++ )
                    {
                        valueLabelPair = returnElements[i-1].split(",");
                        document.getElementById('country_region').options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                var returnElements1=textToSplit1[1].split("|");
                if ((req.status == "200") ||(req.status == 200)){                                        // OK response
                    document.getElementById('state1').options[0] = new Option("All States", "0");
                    document.getElementById('center').options[0] = new Option("All Centers", "0");
                    document.getElementById('specialization_id').options[1] = new Option("All Programs", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ ){
                        //document.getElementById('specialization_id').options[1] = new Option("All Programs", "0");
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }				 
			
                }			
		

            }
        }
    }
    return true;
}
        
/**/  
      
/**1111**/
          
function retrieveSpecZoneStateAndSpecOptions(country_region, state1)
{

    country= document.getElementById(country_region);
    country_id = country.options[country.selectedIndex].value;
    document.getElementById(state1).options.length = 0;
    //document.getElementById('city').options.length = 0;
    document.getElementById(state1).options[0]= new Option('All States','0');
    //document.getElementById('city').options[0]= new Option('- - - - - -Select- - - - - -','0');
    url="./zoneSpecStateandSpecSelection.do?value="+country_id+"&valuetype=CountryRegion";

    //Do the Ajax call
    try{
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }catch (e){
        // Internet Explorer
        try{
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0"){
        req.open("POST", url, true);
        req.send(country_id);
        req.onreadystatechange =function(){
            document.getElementById(state1).options.length = 0;
		    
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)){   // OK response
                    document.getElementById(state1).options[0] = new Option("All States", "0");
                    for ( var i=1; i<(returnElements .length)+1; i++ ){
                        valueLabelPair = returnElements[i-1].split(",");
                        document.getElementById(state1).options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                var returnElements1=textToSplit1[1].split("|");
                if ((req.status == "200") ||(req.status == 200)){                                        // OK response
                    document.getElementById('specialization_id').options[0] = new Option("All Programs", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ ){
                        //document.getElementById('specialization_id').options[0] = new Option("- - - - - -Select- - - - - -", "0");
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }				 
                }			
            }
        }
    }
    return true;                   
}

/**1111**/
          

/**2222**/

function retrieveSpecCenterOptions(state1, center)
{

    state= document.getElementById(state1);
    state_id = state.options[state.selectedIndex].value;
    document.getElementById(center).options.length = 0;

    url="./centerSpecAndSpecSelection.do?value="+state_id+"&valuetype=State";
    

    //Do the Ajax call
    try{
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
    }catch (e){
        // Internet Explorer
        try{
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
    if(country_id!="0"){
        req.open("POST", url, true);
        req.send(state_id);
        req.onreadystatechange =function(){
            document.getElementById(center).options.length = 0;
		    
            if (req.readyState == 4) {
                var textToSplit = req.responseText;
                var textToSplit1=textToSplit.split("~");
                var returnElements=textToSplit1[0].split("|");
                if ((req.status == "200") ||(req.status == 200)) 
                {   // OK response
                    document.getElementById(center).options[0] = new Option("All Centers", "0");
                    for ( var i=1; i<(returnElements .length)+1; i++ )
                    {
                        valueLabelPair = returnElements[i-1].split(",");
                        document.getElementById(center).options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }
			
                }
                //alert("2 : "+textToSplit1[1]);
                var returnElements1=textToSplit1[1].split("|");
                if ((req.status == "200") ||(req.status == 200)){                                        // OK response
                    document.getElementById('specialization_id').options[0] = new Option("All Programs", "0");
                    for ( var j=1; j<(returnElements1.length)+1; j++ ){
                        //document.getElementById('specialization_id').options[0] = new Option("- - - - - -Select- - - - - -", "0");
                        valueLabelPair = returnElements1[j-1].split(",");
                        document.getElementById('specialization_id').options[j] = new Option(valueLabelPair[0], valueLabelPair[1]);
                    }				 
                }			
            }
        }
    }
    return true;
}
/**2222**/        
  
        
/**3333**/
            
function retrieveSpecForSpecCenterOptions(fromId, toId)
{
    var req;           
    var college= document.getElementById(fromId);
            
    var college_id = college.options[college.selectedIndex].value;

    if(college_id==0){
        document.getElementById(toId).options[0]= new Option('All Programs','%');
    }
    var url="./specSpecilizationSelection.do?college_id="+college_id;
    

               
    //Do the Ajax call
    try{
        // Firefox, Opera 8.0+, Safari
        req=new XMLHttpRequest();
                                   
    }catch (e){
        // Internet Explorer
        try{
            req=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                req=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    // req=GetXmlHttpObject();
             
    req.open("POST", url, true);
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.send(college_id);
    req.onreadystatechange =function(){
              
        document.getElementById(toId).options.length = 0;
        if (req.readyState == 4) {
            var textToSplit = req.responseText;      
           
            var returnElements=textToSplit.split("|");
            if (req.status =="200" | req.status ==200) {                                        // OK response
                document.getElementById(toId).options[0] = new Option("All Programs", "%");
                for ( var i=1; i<(returnElements .length)+1; i++ ){
                    var valueLabelPair = returnElements[i-1].split(",");
                    document.getElementById(toId).options[i] = new Option(valueLabelPair[0], valueLabelPair[1]);
                }
            }
        }                 
    };
    return true;
}


/**3333**/