var tables = ["table7", "table8", "table9", "table10", "table11", "table12"];
var tbodys = new Array();

window.onload = function () {
	var nationalitySelect = document.getElementById("nationalitySelect");
	var purposeOfVisitSelect = document.getElementById("purposeOfVisitSelect");
	var nationalitySelect2 = document.getElementById("nationalitySelect2");
	var typeVSD = document.getElementById("typeVSD");
	nationalitySelect.onchange = nationalitySelect2.onchange = nationalityChange;
	showRussianRequirements(nationalitySelect.options[nationalitySelect.selectedIndex].text, purposeOfVisitSelect.options[purposeOfVisitSelect.selectedIndex].text, typeVSD.options[typeVSD.selectedIndex].text);
	purposeOfVisitSelect.onchange = nationalityChange;
	typeVSD.onchange = OnChangeTypeVSD
	prepareTables();
	window.nosameday = "true";
	document.getElementById("questionP").style.display = "none";
	document.getElementById("answerNo").onclick = hideSameDay;
	//document.getElementById("answerYes").onclick = enableLinks;
	document.getElementById("answerYes").onclick = recalcPrice;
	document.getElementById("addInfo").style.display = "none";

	document.getElementById("purposeInfo").onclick = openPurposeOfVisitInfo;

	//REMOVE!!!
	var debugConsole = document.getElementById('debugConsole');
	if (debugConsole) {
		with (debugConsole.style) {
			position = 'fixed';
			zIndex = '300';
			top = '300px';
			right = '40px';
			height = '300px';
			width = '200px';
			overflow = 'auto';
			background = 'white';
			border = '1px solid black';
			font = '10px Courier'
		}
	}

}

function openPurposeOfVisitInfo()
{
    var newWin=window.open("/apply/bvsdinfo4.asp", "VSDService", "width=560, height=700, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no"); 
    return false;
}

var yellowHighlight = function(elem,colour,tbl,textColour)
{
    var topTH, leftTH, classname;
    var service = {'5':1,'S':2}[elem.getAttribute('code').split('-')[2]];
    leftTH = elem.parentNode.parentNode.getElementsByTagName("TH")[0];
    leftTH.getElementsByTagName("A")[0].className = colour;
    topTH = tbl.getElementsByTagName("TR")[1].getElementsByTagName("TH")[service];
    classname = topTH.className;
    if(textColour!="") classname = "prices " + textColour; else classname = "prices";
    topTH.className = classname;
}

function prepareTables()
{
    var trigger = function()
    {    
        var tbl = this.parentNode;
        if (tbl.getElementsByTagName("TBODY").length>0) tbl.removeChild(tbodys[tbl.id]); 
        else 
        {
            tbl.appendChild(tbodys[tbl.id]);
            getNewProcessingDate(document.getElementById("nationalitySelect").options[document.getElementById("nationalitySelect").selectedIndex].text);
        }        
        recalcPrice(document.getElementById("nationalitySelect").options[document.getElementById("nationalitySelect").selectedIndex].text);
    };
    var columnClasses = {l:0, r:1};
    
    var highlight = function(ev)
    {
        var tbl = this.parentNode.parentNode.parentNode.parentNode;
        var left = this.parentNode.parentNode.firstChild;
        
        if (/over/.test((ev||window.event).type)) 
        {
            this.nextSibling.className = 'titleHolder';
            yellowHighlight(this,"yellowLink",tbl,"yellowText");
        } 
        else 
        {
            this.nextSibling.className = 'titleHolderHidden';
            yellowHighlight(this,"",tbl,"");
        }
    };
    for (var i=0, temp, caption, tds; i<tables.length; ++i) 
    {
        temp = document.getElementById(tables[i]);
        temp.prices = tbl[temp.getAttribute("entry")];
        caption = temp.getElementsByTagName('caption')[0];
        tbodys[temp.id] = temp.getElementsByTagName("TBODY")[0];
        caption.style.width = "100%";
        caption.onmouseover = caption.onmouseout = function()
                                                   { 
                                                        this.className = this.className == "hovered" ? "" : "hovered"; 
                                                   };
        caption.onclick = trigger;
        tds = temp.getElementsByTagName('td');
        for (var j=0, link; j < tds.length; ++j) 
        {
            link = tds[j].firstChild;
            link.onmouseover = link.onmouseout = highlight;
            with (tds[j].appendChild(document.createElement('div'))) 
            {
                innerHTML  = "If ordered today, this visa should be ready on or before <br><strong>" +link.title+ "</strong>";
	            link.title ='';
	            className  = 'titleHolderHidden';
            }
        }
        temp.removeChild(tbodys[temp.id]);
    }
}

var recalcPrice = function(country)
{
    enableLinks();
    
    var countrySel=document.getElementById("nationalitySelect");
    var country = country || countrySel.options[countrySel.selectedIndex].Text;
    
    var IsCM = in_array(country, EUCountries);
    var IsRisky = !in_array(country, allowed);
    var links = document.getElementById('tableHolder').getElementsByTagName('a');
    
    var serviceList = {'0':'i have my own visa support','12':'12 working days','8':'8 working days','5':'5 working days','3':'3 working days',
                       '2':'2 working days','1':'1 working day','0.5':'express','18':'18 working days','14':'14 working days','12T':'12 working days (telex)'};
    var consServiceList = {'5':'Standard service','S':'Same day service'};
      
    for (var i=0,x=0, l=links.length, lnk, service, temp, ind, price, vsdSerice,consService; i<l; ++i) 
        if (links[i].className == 'nav3') 
        {
            lnk = links[i];
            ind = (x>1) ? Math.floor(x/2) : 0;
            service = lnk.getAttribute('code').split('-');
            temp = tbl[service[0]];
            
            vsdSerice = serviceList[service[1]];
            consService = consServiceList[service[2]];
            
        price = new allPrices("Russian "+service[0],consService,vsdSerice,"No registration service needed","I will collect from your office",country,"Moscow",false,"SE30-29808-2FA42F7-SM",'Business');
        
      
      lnk.innerHTML = '£'+price.fullPrice.toFixed(2);
      
      
      var consProc = (service[2]=="5") ? 6 : 2;
      var vsdProc = 0;
      var addProc = 0;
      var citizenship = document.getElementById("nationalitySelect");
      citizenship = citizenship.options[citizenship.selectedIndex].text;
      if((service[0]=="SE30")||(service[0]=="SE90")||(service[0]=="DE30")||(service[0]=="DE90")){
        switch(service[1] + "-" + service[2]){
            case "12-5": consProc = 13; vsdProc=6;addProc=0; break;    
            case "12-S": consProc = 13; vsdProc=2;addProc=0; break;  
            case "8-5": consProc = 9; vsdProc=6;addProc=0; break;  
            case "8-S": consProc = 9; vsdProc=2;addProc=0; break;  
            case "5-5": consProc = 6; vsdProc=6;addProc=0; break;  
            case "5-S": consProc = 6; vsdProc=2;addProc=0; break;  
            case "3-5": consProc = 4; vsdProc=6;addProc=0; break;  
            case "3-S": consProc = 4; vsdProc=2;addProc=0; break;  
            case "2-5": consProc = 3; vsdProc=6;addProc=0; break;  
            case "2-S": consProc = 3; vsdProc=2;addProc=0; break;  
            case "1-5": consProc = 2; vsdProc=6;addProc=0; break;  
            case "1-S": consProc = 2; vsdProc=2;addProc=0; break;  
            case "0.5-5": consProc = 0; vsdProc=6;addProc=1; break;  
            case "0.5-S": consProc = 0; vsdProc=2;addProc=1; break;  
            case "0-5": consProc = 0; vsdProc=6;addProc=1; break;  
            case "0-S": consProc = 0; vsdProc=2;addProc=1; break;  
        }
      }
      if((service[0]=="ME06")||(service[0]=="ME12")){
        switch(service[1] + "-" + service[2]){
            case "18-5": consProc = 20; vsdProc=6;addProc=0; break;    
            case "18-S": consProc = 20; vsdProc=2;addProc=0; break;  
            case "14-5": consProc = 16; vsdProc=6;addProc=0; break;
            case "14-S": consProc = 16; vsdProc = 2; addProc = 0; break;
            case "12-5": consProc = 13; vsdProc = 6; addProc = 0; break;
            case "12-S": consProc = 13; vsdProc = 2; addProc = 0; break;  
            case "12T-5": consProc = 12; vsdProc=6;addProc=0; break;  
            case "12T-S": consProc = 12; vsdProc=2;addProc=0; break;  
            case "5-5": consProc = 8; vsdProc=6;addProc=1; break;  
            case "5-S": consProc = 8; vsdProc=2;addProc=1; break;  
            case "3-5": consProc = 6; vsdProc=6;addProc=1; break;  
            case "3-S": consProc = 6; vsdProc=2;addProc=1; break;  
            case "0-5": consProc = 0; vsdProc=6;addProc=1; break;  
            case "0-S": consProc = 0; vsdProc=2;addProc=1; break;  
        }
      }            
      
      if(window.nosameday == "false") {
        switch(citizenship){
            case "Australia": vsdProc = 14; break;    
            case "Italy": vsdProc = 10; break;    
            case "Netherlands": vsdProc = 10; break;    
            case "United States": vsdProc = 14; break;               
            case "Turkmenistan": vsdProc = 14; break;
            case "France": vsdProc = 14; break;    
        }
      } 
            
      var dateDiv = lnk.parentNode.getElementsByTagName("DIV")[0];
      dateDiv.innerHTML  = "If ordered today, this visa should be ready on or before <br><strong>" + formatDate(calc_date(consProc,vsdProc,addProc))+ "</strong>";
      
      if (/cit/.test(lnk.href)) lnk.href = lnk.href.replace(/cit\=(.*)/, 'cit=' + country);
      else lnk.href += '&cit='+country;
    }
    enableLinks();
}

function calc_date(vsd, con,add) 
{
	todays_date = new Date();
	total = vsd + con ;
	total=total+add;
	while(total != 0){
        if(todays_date.getDay() == 6) {
            todays_date.setDate(todays_date.getDate() + 2);
        }
        if(todays_date.getDay() == 0) {
			todays_date.setDate(todays_date.getDate() + 1);
		}
        total = total - 1;
        todays_date.setDate(todays_date.getDate() + 1);
	}
	if(todays_date.getDay() == 6) {
        todays_date.setDate(todays_date.getDate() + 2);
    }
    if(todays_date.getDay() == 0) {
		todays_date.setDate(todays_date.getDate() + 1);
	}
    return todays_date;
}


var noStandard = "India,Turkey";
var noSameday = "Australia,Italy,Netherlands,United States,Turkmenistan,France";
var noSamedayText = "Do you have UK Leave To Remain or a UK residence permit valid for more than 90 days?"
var noVisa = "Algeria,Angola,Afghanistan,Bangladesh,Vietnam,Georgia,Iraq,Iran,China,North Korea,Nepal,Nigeria,Pakistan,Rwanda,Syria,Somali,Chad,Sri Lanka,Ethiopia";
var noVisaText = "Do you have Long Term UK Leave To Remain or a UK residence permit?";
var visaFree = "Turkey,Azerbaijan,Armenia,Belarus,Kazakhstan,Kirghizia,Cuba,Moldova,Tajikistan,Thailand,Uzbekistan,Ukraine,Israel,Kyrgyzstan,Macedonia,Bosnia and Herzegovina,Venezuela,Montenegro";

//if country = "Dominican Republic" OR country="Venezuela" OR country = "Argentina" OR country = "Cuba" OR country = "Peru" OR country = "Ecuador" then
 
function getNewProcessingDate(country)
{
    var priceTable = document.getElementById("priceTable");
    var questionP = document.getElementById("questionP");
    var question = document.getElementById("question");
    document.getElementById("addInfo").style.display = "none";
    questionP.style.display = "none";document.getElementById("answerYes").checked=true;
    var texts = "";
    if (in_array(country,visaFree.split(",")))
    {
        window.countryCode = 2;
        hideSameDay();
        document.getElementById("addInfo").style.display = "block";
        if (country == "Thailand") {
            texts = "Citizens of Thailand do not require a visa to visit the Russian Federation for up to 30 days, and it is not currently necessary to present the original visa support documents (invitation) to the immigration authorities at passport control on arrival.";
        }
        else if (country == "Israel") {
            texts = "Citizens of Israel do not require a visa to visit the Russian Federation for up to 90 days; however, it is necessary to present the original visa support documents (invitation) to the immigration authorities at passport control on arrival.";
        }
        else if (country == "Turkey") {
            texts = "Citizens of Turkey do not require a visa for trips of up to 30 days to the Russian Federation (the total time spent in the Russian Federation in the course of multiple visits must not exceed 90 days in any 180-day period).";
        }
        else if (country == "Macedonia") {
            texts = "Citizens of Macedonia do not require a visa to visit the Russian Federation for up to 90 days; however, it is necessary to present the original visa support documents (invitation) to the immigration authorities at passport control on arrival.";
        }
        else if (country == "Bosnia and Herzegovina") {
            texts = "Citizens of Bosnia and Herzegovina do not require a visa to visit the Russian Federation for up to 90 days; however, it is necessary to present the original visa support documents (invitation) to the immigration authorities at passport control on arrival.";
        }
        else if (country == "Montenegro") {
            texts = "Citizens of Montenegro do not require a visa to visit the Russian Federation for up to 30 days.";
        }
        else if (country == "Venezuela") {
            texts = "Citizens of Venezuela do not require a visa to visit the Russian Federation for up to 90 days.";
        }        
        else {
            texts = "Citizens of " + country + " do not require a visa for travel to the Russian Federation.";
        }
        document.getElementById("addInfo").innerHTML = texts;
        alert(texts);
        return false;
    }
    if (in_array(country,noSameday.split(","))){
        questionP.style.display = "";
        question.innerHTML = noSamedayText;
        window.countryCode = 1;
        return false;
    }
    if (in_array(country,noVisa.split(","))){
        questionP.style.display = "";
        question.innerHTML = noVisaText;
        window.countryCode = 2;
        return false;
    } 
    //if(country=="Canada") {window.countryCode = 1; hideSameDay(); return false;}
    if (in_array(country,noStandard.split(",")))
    {
        window.countryCode = 3; 
        //hideStandardService(); 
        return false;
    }
}


function hideStandardService()
{
    window.nostandard = "true";
    
    var nationalitySelect = document.getElementById("nationalitySelect");
    var citizenship = nationalitySelect.options[nationalitySelect.selectedIndex].text;
    var procTime= "6 days";
    recalcPrice(citizenship);
    
    var priceTable, allLinks;
    for (var i=0;i<tables.length;i++)
    {
        priceTable = document.getElementById(tables[i]);  
        allLinks = priceTable.getElementsByTagName("a");
        try 
        {
            var VSDServiceText;
            for (var j=0;j<allLinks.length;j++)
            {
                if (allLinks[j].parentNode.nodeName !="TH") 
                {
                    
                    service = allLinks[j].href.split("service=")[1].split("-")[2].split("&")[0];                    
                    if (window.countryCode==3)
                    {
                        if (service!="S")
                        {
                            allLinks[j].innerHTML = "not available"
                            allLinks[j].onclick = function(){alert("Sorry, this service is not available.");return false;}
                            allLinks[j].className = "notAvailable";
                        }
                        else 
                        {
                            allLinks[j].href += "&sameday=false";  
                        }
                    }                     
                }
                else
                {
                    VSDServiceText=allLinks[j].innerHTML;
                }
            }
        } 
        catch(e){}
    }
}


function hideSameDay()
{
    window.nosameday = "false";
    
    var nationalitySelect = document.getElementById("nationalitySelect");
    var citizenship = nationalitySelect.options[nationalitySelect.selectedIndex].text;
    var procTime= "6 days";
    recalcPrice(citizenship);
    switch(citizenship)
    {
        case "Australia": procTime = "10 to 14 days"; break;    
        case "Italy": procTime = "10 days"; break;    
        case "Netherlands": procTime = "10 days"; break;    
        case "United States": procTime = "10 to 14 days"; break;            
        case "Turkmenistan": procTime = "10 to 14 days"; break;
        case "France": procTime = "10 to 14 days"; break;    
    }
    
    var priceTable, allLinks;
    for (var i=0;i<tables.length;i++)
    {
        priceTable = document.getElementById(tables[i]);  
        allLinks = priceTable.getElementsByTagName("a");
        try 
        {
            var changeproc = priceTable.getElementsByTagName("TBODY")[0].firstChild;
            if (changeproc.nextSibling.nodeType==3) 
                changeproc = changeproc.nextSibling.nextSibling; 
            else changeproc = changeproc.nextSibling;
            changeproc = changeproc.firstChild.nextSibling;
            changeproc.innerHTML = procTime;
            
            var bIhave=0;
            for (var j=0;j<allLinks.length;j++)
               {               
                if(allLinks[j].parentNode.nodeName !="TH") 
                   {                    
                    allLinks[j].href += "&sameday=false";
                    service = allLinks[j].href.split("service=")[1].split("-")[2].split("&")[0];
                    if(window.countryCode==1)
                       {
                        if(service=="S")
                           {
                            allLinks[j].innerHTML = "not available";
                            allLinks[j].onclick = function(){alert("Sorry, this service is not available.");return false;}
                            allLinks[j].className = "notAvailable";
                           }
                       } 
                    else 
                       {
                           if ((citizenship == "Thailand") && ((bIhave == 0) || (bIhave == 1)) && ((service == "5") || (service == "S"))) {
                               bIhave++;
                               continue;
                           }
                           else if ((citizenship == "Montenegro") && ((i == 1) || (i == 3)) && ((bIhave == 0) || (bIhave == 1)) && ((service == "5") || (service == "S"))) {
                               bIhave++;
                               continue;
                           }
                        allLinks[j].innerHTML = "not available";
                        allLinks[j].onclick = function(){alert("Sorry, this service is not available.");return false;}
                        allLinks[j].className = "notAvailable";
                       }
                    bIhave++;
                  }
            }
        } catch(e){}
    }
}


function enableLinks()
{
    window.nosameday = "true";
    var nationalitySelect = document.getElementById("nationalitySelect");
    var citizenship = nationalitySelect.options[nationalitySelect.selectedIndex].text;
    var IsRisky = !in_array(citizenship, allowed);
    var arrnoStandard = noStandard.split(",");
    var IsnoStandard = in_array(citizenship, arrnoStandard);    
    //recalcPrice(citizenship);
    var procTime= "6 days";
    var priceTable, allLinks;
    for (var i=0;i<tables.length;i++)
    {
        priceTable = document.getElementById(tables[i]);  
        allLinks = priceTable.getElementsByTagName("a");
        try 
        {
            //priceTable.getElementsByTagName("TBODY")[0].firstChild.nextSibling.firstChild.nextSibling.innerHTML = procTime;
            var changeproc = priceTable.getElementsByTagName("TBODY")[0].firstChild;
            if (changeproc.nextSibling.nodeType==3) 
                changeproc = changeproc.nextSibling.nextSibling; 
            else changeproc = changeproc.nextSibling;
            changeproc = changeproc.firstChild.nextSibling;
            //changeproc.innerHTML = procTime;
            var VSDServiceText;
            for (var j=0;j<allLinks.length;j++)
            {
                //temporary disabled some service
                var parentTR = allLinks[j].parentNode.parentNode;
                if ((parentTR != null) && (parentTR != undefined) && (parentTR.nodeName == "TR")) {
                    var attributeDisabled = parentTR.attributes["disabled"];
                    if ((attributeDisabled != undefined) && ((attributeDisabled.value == "1") || (attributeDisabled.value == "true"))) {

                        if (allLinks[j].parentNode.nodeName == "TD") {
                            allLinks[j].innerHTML = "not available";
                        }

                        allLinks[j].onclick = function () {
                            alert("Sorry, this service is not available.");
                            return false;
                        }
                        allLinks[j].className = "notAvailable";
                        continue;
                    }
                }
                //-------
                
                allLinks[j].href.replace("&sameday=false","");
                if (allLinks[j].parentNode.nodeName !="TH") 
                {
                    service = allLinks[j].href.split("service=")[1].split("-")[2].split("&")[0];
                    if (service=="S") // Next day
                    {                        
                        if (IsRisky) //Risky 
                        {                            
                            if ( ( (i<=1)&&((VSDServiceText=="12 Working Days")||(VSDServiceText=="8 Working Days")) )
                            || (VSDServiceText=="I have my own Visa Support") )
                            {
                                allLinks[j].onclick = function(){}
                                allLinks[j].className = "nav3";
                            }
                            else
                            {
                                allLinks[j].innerHTML = "not available";
                                allLinks[j].onclick = function()
                                {
                                    alert("Sorry, this service is not available.");
                                    return false;
                                }
                                allLinks[j].className = "notAvailable";                            
                            }                            
                        }                                                
                        else if (IsnoStandard) //Turkey India
                        {
                            if (citizenship == "India") {
                                if ((i <= 1) && ((VSDServiceText == "12 Working Days") || (VSDServiceText == "8 Working Days") || (VSDServiceText == "I have my own Visa Support"))) {
                                    allLinks[j].onclick = function () { }
                                    allLinks[j].className = "nav3";
                                }
                                else {
                                    allLinks[j].innerHTML = "not available";
                                    allLinks[j].onclick = function () {
                                        alert("Sorry, this service is not available.");
                                        return false;
                                    }
                                    allLinks[j].className = "notAvailable";
                                }
                            }
                            else if (citizenship == "Turkey") {
                                if ((i == 0)||(i==2)) {
                                    allLinks[j].innerHTML = "not available";
                                    allLinks[j].onclick = function () {
                                        alert("Sorry, this service is not available.");
                                        return false;
                                    }
                                    allLinks[j].className = "notAvailable";                                    
                                }
                                else if ((VSDServiceText == "12 Working Days") || (VSDServiceText == "8 Working Days") || (VSDServiceText == "I have my own Visa Support") 
                                    || (VSDServiceText == "18 Working Days") || (VSDServiceText == "14 Working Days")) {
                                    allLinks[j].onclick = function () { }
                                    allLinks[j].className = "nav3";
                                }
                                else {
                                    allLinks[j].innerHTML = "not available";
                                    allLinks[j].onclick = function () {
                                        alert("Sorry, this service is not available.");
                                        return false;
                                    }
                                    allLinks[j].className = "notAvailable";
                                }
                            }
                            else {
                                allLinks[j].onclick = function () { }
                                allLinks[j].className = "nav3";
                            }                           
                            
                                                    
                        }
                        else //Other
                        {
                            allLinks[j].onclick = function(){}
                            allLinks[j].className = "nav3";
                        }
                    }
                    else  // standard 6 days
                    {
                       
                        if (IsRisky)
                        {
                            if ( ( (i<=1)&&((VSDServiceText=="12 Working Days")||(VSDServiceText=="8 Working Days")) )
                            || (VSDServiceText=="I have my own Visa Support") )
                            {
                                allLinks[j].onclick = function(){}
                                allLinks[j].className = "nav3";
                            }
                            else
                            {
                                allLinks[j].innerHTML = "not available";
                                allLinks[j].onclick = function()
                                {
                                    alert("Sorry, this service is not available.");
                                    return false;
                                }
                                allLinks[j].className = "notAvailable";                            
                            }                            
                        }                        
                        else if (IsnoStandard) //Turkey India
                        {
                            
                            allLinks[j].innerHTML = "not available";
                            allLinks[j].onclick = function()
                            {
                                alert("Sorry, this service is not available.");
                                return false;
                            }
                            allLinks[j].className = "notAvailable";                            
                            
                        }
                        else
                        {
                            allLinks[j].onclick = function(){}
                            allLinks[j].className = "nav3";
                        }
                        
                    }    
                }
                else
                {                    
                    VSDServiceText=allLinks[j].innerHTML;                    
                }
            }
        } 
        catch(e){}
    }
    //recalcPrice(citizenship);
}

var nationalityChange = function () {
    if (this.id == "nationalitySelect") document.getElementById("nationalitySelect2").selectedIndex = this.selectedIndex;
    if (this.id == "nationalitySelect2") document.getElementById("nationalitySelect").selectedIndex = this.selectedIndex;
    var nationalitySelect = document.getElementById("nationalitySelect");
    var citizenship = nationalitySelect.options[nationalitySelect.selectedIndex].text;
    var purposeOfVisitSelect = document.getElementById("purposeOfVisitSelect");
    var typeVSD = document.getElementById("typeVSD");
    var purpose = purposeOfVisitSelect.options[purposeOfVisitSelect.selectedIndex].text;
    var vsd = typeVSD.options[typeVSD.selectedIndex].text;
    
    //enableLinks();
    
    //recalcPrice(citizenship);
    getNewProcessingDate(citizenship);
    showRussianRequirements(citizenship, purpose, vsd);
    recalcPrice(citizenship);    
}

function showRussianRequirements(country,purpose,vsd)
{
    var countryLabel = "<h5>Documents required for passport holders of "+country+":</h5>";
    var nationalityRequirementsDiv = document.getElementById("nationalityRequirements");
    var forWhat = "bisvisa";
    var visatype = "business";
    var sdm = "SE";
    var age = 100;
    var request = getRequest();
    var url  = "/inc/showRequirements.asp" + "?country="+country + "&forWhat="+forWhat + "&visatype="+visatype + "&sdm="+sdm + "&age="+age + "&purpose="+purpose + "&typeVSD="+vsd;
    request.open("GET", url, true);
    request.onreadystatechange = function(){ 
        if (request.readyState == 4) {
            if(request.status==200){
                nationalityRequirementsDiv.innerHTML = countryLabel + request.responseText;
            }
        };
    }
    request.send("0");
}

/*
 * This function change list purpose (relative of "TypeVSD")
 * @param {object} obj - pointer to select object
 */
var OnChangeTypeVSD = function()
{
 var selpurpose=null;
 selpurpose=document.getElementById("purposeOfVisitSelect");
 if (!selpurpose) return; 
 selpurpose.length=0;
 if (this.options[this.selectedIndex].value == 2) //TELEX
    {     
     selpurpose.options[selpurpose.length]= new Option("Business"); 
    }
    else if (this.options[this.selectedIndex].value == 1) //invitation letter
    {     
     selpurpose.options[selpurpose.length]= new Option("Business");
     selpurpose.options[selpurpose.length]= new Option("Charity");
     selpurpose.options[selpurpose.length]= new Option("Commercial");
     selpurpose.options[selpurpose.length]= new Option("Cultural");
     selpurpose.options[selpurpose.length]= new Option("Diplomatic");
     selpurpose.options[selpurpose.length]= new Option("Driver");
     selpurpose.options[selpurpose.length]= new Option("Education");
     selpurpose.options[selpurpose.length]= new Option("Family member");
     selpurpose.options[selpurpose.length]= new Option("Lecturing");
     selpurpose.options[selpurpose.length]= new Option("Private");
     selpurpose.options[selpurpose.length]= new Option("Scientific");
     selpurpose.options[selpurpose.length]= new Option("Sport");
     selpurpose.options[selpurpose.length]= new Option("Study");
     selpurpose.options[selpurpose.length]= new Option("Technical Support");
     selpurpose.options[selpurpose.length]= new Option("Tourist");
     selpurpose.options[selpurpose.length]= new Option("Transit");
     selpurpose.options[selpurpose.length]= new Option("Work");
     selpurpose.options[selpurpose.length]= new Option("Youth Work");
    }
    nationalityChange()
}
