	var browserName = navigator.appName;
	var browserVer = parseInt(navigator.appVersion);
	var browserOK = (((browserName == "Netscape") && (browserVer >= 3)) || 
		((browserName == "Microsoft Internet Explorer") && (browserVer >= 4)));


	var iSex, iAge, iWg, iBuild, iFreq, iDr, iTopSkill, iCountry, iStyle, iLevel;
	var iBrd, iVol, iSail, iSize, iFin, iLen, iBrdL, iBrdM, iBrdH, iVolL, iVolM, iVolH, iFinL, iFinM, iFinH, iLenL, iLenM, iLenH, iSailL, iSailM, iSailH, iSizeL, iSizeM, iSizeH;
	var iRgn, iCountry, iSelSpot, strTime;

	var MaxItem;


	iBuild = 0;

	iBrdL = 0;
	iBrdM = 0;
	iBrdH = 0;
	iVolL = 0;
	iVolM = 0;
	iVolH = 0;
	iFinL = 0;
	iFinM = 0;
	iFinH = 0;
	iLenL = 0;
	iLenM = 0;
	iLenH = 0;
	iSailL = 0;
	iSailM = 0;
	iSailH = 0;
	iSizeL = 0;
	iSizeM = 0;
	iSizeH = 0;

	var namePic;
	var iBOut=0;
	var iBProf=0;
	var iSOut=0;
	var iSProf=0;
	var iFOut=0;
	var iFProf=0;

	var iSelSpot=0
	
	var UseLW = false;
	var UseMW = false;
	var UseHW = false;

	var addEquip =  false;

	// delay between slides (in milliseconds)
	var ShowDelay = 10000;
	// timeout id for the current setTimeout command
	var curTimeout;


	var ArBOut = Array(1,2,3,4,5,6,7,8,9,10,11,12);
	var ArBOutDsc = Array("Formula","Free formula","Formula","Race","Slalom","Freeride","Freeride carve","Freemove","Freestyle","Freestyle wave","Wave","Wave (radical)");
	var ArFOut = Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
	var ArFOutDsc = Array("Beginner","Freeride (easy)","Freeride (light wind)","Freeride (speed)","Race","Ultra race (speed)","Slalom","Ultra slalom (speed)","Formula","Freestyle","Freestyle (wave)","Freemove (Bump&Jump)","Wave (cross off shore)", "Wave side (on shore)");
	var ArSOut = Array(1,2,3,4,5,6,7,8,9,10,11,12,13);
	var ArSOutDsc = Array("Beginner","Race (cam)","Freerace (cam)","Freerace (no cam)","Slalom","Freeride (cam)","Freeride (no cam)","Freemove","Freestyle","Freestyle extreme","Freewave","Wave","Wave (radical)");


	var  strLgn, strPsw, strName;
	



function ClickSx(i)
{
	document.FormQuery.RSex.value = i;
}


function CheckSendStep1()
{
	var i;
	
	if( document.FormQuery.RSex.value == null ) {
		alert("Choose your sex!");
		return;
	}
	if( document.FormQuery.ListAges.selectedIndex == 0 ) {
		alert("Choose your age!");
		return;
	}
	if( document.FormQuery.ListWeights.selectedIndex == 0 ) {
		alert("Choose your weight!");
		return;
	}
	if( document.FormQuery.ListReside.selectedIndex == 0 ) {
		alert("Choose your location!");
		return;
	}
	if( document.FormQuery.ListFreqs.selectedIndex == 0 ) {
		alert("Choose a frequency of your windsurfing!");
		return;
	}
	if( document.FormQuery.ListDurs.selectedIndex == 0 ) {
		alert("Choose a standing of your windsurfing!");
		return;
	}

	if( document.FormQuery.ListStyles.selectedIndex == 0 ) {
		alert("Choose your favourite style!");
		return;
	}

	if( document.FormQuery.ListSkills.selectedIndex == 0 ) {
		alert("Choose your most difficult trick!");
		return;
	}


	iSex = document.FormQuery.RSex.value;
	iCountry = document.FormQuery.ListReside.value;
	iAge = document.FormQuery.ListAges.options[document.FormQuery.ListAges.selectedIndex].value; 
	iWg  = document.FormQuery.ListWeights.options[document.FormQuery.ListWeights.selectedIndex].value; 
	iFreq = document.FormQuery.ListFreqs.selectedIndex;
	iDur = document.FormQuery.ListDurs.selectedIndex;
	iStyle = document.FormQuery.ListStyles.selectedIndex;
	iTopSkill= document.FormQuery.ListSkills.selectedIndex;
	if (iTopSkill < 9) iLevel = 1;
	else {
		if (iTopSkill < 17) iLevel = 2;
		else 		    iLevel = 3;
	}

	
//	SetCookie ('WGDuration',document.FormQuery.RDuration.value, exp);
	
//	document.FormQuery.submit();
//	alert ("iSex="+String(iSex)+" iAge="+String(iAge)+" iFreq="+String(iFreq)+" iCountry="+String(iCountry)+" iSt="+String(iSt));
//	alert ("Skills="+String(iTopSkill));
	document.location.href="PeopleWise.asp?StepPW=1&action=send&iSex="+String(iSex)+"&iAge="+String(iAge)+"&iWg="+String(iWg)+"&iBuild="+String(iBuild)+"&iCountry="+String(iCountry)+"&iFreq="+String(iFreq)+"&iDur="+String(iDur)+"&iSkill="+String(iTopSkill)+"&iLevel="+String(iLevel)+"&iStyle="+String(iStyle);
//	document.location.href="PeopleRes.asp";
}

function showSlide(nameSrc) {
	if (browserOK) {
		//alert(slideURL.length);

		switch (nameSrc) {
		case "BOut":
						document.images[nameSrc].src = "Images/Boards/BOut"+String(ArBOut[iBOut])+".gif";		
						document.FormQuery.BOutDef.value = ArBOutDsc[iBOut];
						break;
		case "SOut":
						document.images[nameSrc].src = "Images/Sails/SOut"+String(ArSOut[iSOut])+".gif";		
						document.FormQuery.SOutDef.value = ArSOutDsc[iSOut];
						break;
		case "FOut":
						document.images[nameSrc].src = "Images/Fins/FOut"+String(ArFOut[iFOut])+".gif";		
						document.FormQuery.FOutDef.value = ArFOutDsc[iFOut];
						break;
		}

		//alert(String(document.images[nameSrc].src));
		curTimeout = setTimeout("showSlide()", ShowDelay);
	} else {
		// show an error message for older browsers
		alert("This page requires Netscape 3.0+ or IE 4.0+");
	}
}

function goNext(nameSrc) {
	if (browserOK) {
		clearTimeout(curTimeout);
		switch (nameSrc) {
		case "BOut":	
						if (iBOut < ArBOut.length-1) iBOut = (iBOut + 1);// % ArBOut.length);
						//alert("iBOut = "+ String(iBOut));
						break;
		case "FOut":
						if (iFOut < ArFOut.length-1) iFOut = (iFOut + 1);// % ArFOut.length);
						break;
		case "SOut":
						if (iSOut < ArSOut.length-1) iSOut = (iSOut + 1);// % ArSOut.length);
						break;

		}
		showSlide(nameSrc);
	}
}

function goPrev(nameSrc) {
	if (browserOK) {
		clearTimeout(curTimeout);
		switch (nameSrc) {
		case "BOut":	
						if (iBOut > 0) iBOut = (iBOut - 1);// + ArBOut.length) % ArBOut.length);
						//alert("iBOut = "+ String(iBOut));
						break;
		case "FOut":
						if (iFOut > 0) iFOut = (iFOut - 1);// + ArFOut.length) % ArFOut.length);
						break;
		case "SOut":
						if (iSOut > 0) iSOut = (iSOut - 1);// + ArSOut.length) % ArSOut.length);
						break;
		}

		//curItem = (((curItem - 2) + cntItems) % cntItems);
		showSlide(nameSrc);
	}
}

function UseForLW()
{
	if(document.FormQuery.ListVolumes.selectedIndex == 0) {
		alert("Choose the volume of your board for a light wind.");
		return;
	}
	if(document.FormQuery.ListLengths.selectedIndex == 0) {
		alert("Choose the length of your fin for a light wind.");
		return;
	}
	if(document.FormQuery.ListSizes.selectedIndex == 0) {
		alert("Choose the size of your sail for a light wind.");
		return;
	}
	
	iBrdL = iBOut+1;
	iVolL = document.FormQuery.ListVolumes.selectedIndex;
	iFinL = iFOut+1;
	iLenL = document.FormQuery.ListLengths.selectedIndex;
	iSailL = iSOut+1;
	iSizeL = document.FormQuery.ListSizes.selectedIndex;

	UseLW = true;
	alert("Thank you for the answer!");
}

function UseForMW()
{
	if(document.FormQuery.ListVolumes.selectedIndex == 0) {
		alert("Choose the volume of your board for a moderate wind.");
		return;
	}
	if(document.FormQuery.ListLengths.selectedIndex == 0) {
		alert("Choose the length of your fin for a moderate wind.");
		return;
	}
	if(document.FormQuery.ListSizes.selectedIndex == 0) {
		alert("Choose the size of your sail for a moderate wind.");
		return;
	}

	iBrdM = iBOut+1;
	iVolM = document.FormQuery.ListVolumes.selectedIndex;
	iFinM = iFOut+1;
	iLenM = document.FormQuery.ListLengths.selectedIndex;
	iSailM = iSOut+1;
	iSizeM = document.FormQuery.ListSizes.selectedIndex;

	UseMW = true;
	alert("Thank you for the answer!");
}

function UseForHW()
{
	if(document.FormQuery.ListVolumes.selectedIndex == 0) {
		alert("Choose the volume of your board for a heavy wind.");
		return;
	}
	if(document.FormQuery.ListLengths.selectedIndex == 0) {
		alert("Choose the length of your fin for a heavy wind.");
		return;
	}
	if(document.FormQuery.ListSizes.selectedIndex == 0) {
		alert("Choose the size of your sail for a heavy wind.");
		return;
	}

	iBrdH = iBOut+1;
	iVolH = document.FormQuery.ListVolumes.selectedIndex;
	iFinH = iFOut+1;
	iLenH = document.FormQuery.ListLengths.selectedIndex;
	iSailH = iSOut+1;
	iSizeH = document.FormQuery.ListSizes.selectedIndex;

	UseHW = true;
	alert("Thank you for the answer!");
}

function CheckSendStep2()
{
//	var strB, strS, strF;
	
//	if(!UseLW && !UseMW && !UseHW) {
//		alert("You haven't chosen the equipment what you use !");
//		return;
//	}
//	if(!UseMW) {
//		alert("Choose your equipment for moderate wind !");
//		return;
//	}
//	if(!UseHW) {
//		alert("Choose your equipment for heavy wind !");
//		return;
//	}


//	document.location.href="PeopleWise.asp?StepPW=2&action=send&iBrdL="+String(iBrdL)+"&iBrdM="+String(iBrdM)+"&iBrdH="+String(iBrdH)+"&iVolL="+String(iVolL)+"&iVolM="+String(iVolM)+"&iVolH="+String(iVolH)+"&iFinL="+String(iFinL)+"&iFinM="+String(iFinM)+"&iFinH="+String(iFinH)+"&iLenL="+String(iLenL)+"&iLenM="+String(iLenM)+"&iLenH="+String(iLenH)+"&iSailL="+String(iSailL)+"&iSailM="+String(iSailM)+"&iSailH="+String(iSailH)+"&iSizeL="+String(iSizeL)+"&iSizeM="+String(iSizeM)+"&iSizeH="+String(iSizeH);

//	document.location.href="PeopleWise.asp?StepPW=2&action=send";

	AddEquipment();
}

function AddEquipment()
{

	if(document.FormQuery.ListVolumes.selectedIndex == 0) {
		alert("Choose the volume of your board!");
		return;
	}
	if(document.FormQuery.ListSizes.selectedIndex == 0) {
		alert("Choose the size of your sail!");
		return;
	}
	if(document.FormQuery.ListLengths.selectedIndex == 0) {
		alert("Choose the length of your fin!");
		return;
	}

	iBrd = iBOut+1;
	iVol = document.FormQuery.ListVolumes.selectedIndex;
	iFin = iFOut+1;
	iLen = document.FormQuery.ListLengths.selectedIndex;
	iSail = iSOut+1;
	iSize = document.FormQuery.ListSizes.selectedIndex;

	strB = document.FormQuery.strBoards.value;
	strS = document.FormQuery.strSails.value;
	strF = document.FormQuery.strFins.value;

	addEquip = true;

	document.location.href="PeopleWise.asp?StepPW=2&action=send&Act=add&strBoards="+String(strB)+"&strSails="+String(strS)+"&strFins="+String(strF)+"&iBrd="+String(iBrd)+"&iVol="+String(iVol)+"&iSail="+String(iSail)+"&iSize="+String(iSize)+"&iFin="+String(iFin)+"&iLen="+String(iLen);
}


	var browserName = navigator.appName;
	var browserVer = parseInt(navigator.appVersion);
	var browserOK = (((browserName == "Netscape") && (browserVer >= 3)) || 
		((browserName == "Microsoft Internet Explorer") && (browserVer >= 4)));


	var iRegion;
	var ListP = new Array(9);
	ListP[0] = 0;
	ListP[1] = 0;
	ListP[2] = 0;
	ListP[3] = 0;
	ListP[4] = 0;
	ListP[5] = 0;
	ListP[6] = 0;
	ListP[7] = 0;
	ListP[8] = 0;
	
	var  lastCountry = 0;
	


function ClickRegion(n)
{
	CheckBrowser();
	iRegion = n;
//	alert("iRegion="+String(iRegion));
	
/*	if (document.FormQuery.RRegion.value != n) {
		UpdateListView(document.FormQuery.RRegion.value, "hidden");
		document.FormQuery.RRegion.value = iRegion;
		UpdateListView(document.FormQuery.RRegion.value, "visible");
	}
*/
 document.location.href="PeopleWise.asp?StepPW=2&action=showCnt&item1="+String(iRegion);

}

function UpdateListView(n, sVis)
{
	n = n-1;

	switch (n) {

case 0:
		if (isNet4) {
			document.FormQuery.ListNorthAmerica.visibility = sVis; 
			if (sVis=="hidden") document.FormQuery.ListNorthAmericaSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListNorthAmerica').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListNorthAmericaSpots').style.visibility = sVis;
		}
		 break;

case 1:
		if (isNet4) {
			document.FormQuery.ListAtlanticOcean.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListAtlanticOceanSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListAtlanticOcean').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListAtlanticOceanSpots').style.visibility = sVis;
		}
		 break;

case 2:
		if (isNet4) {
			document.FormQuery.ListEurope.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListEuropeSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListEurope').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListEuropeSpots').style.visibility = sVis;
		}
		 break;
case 3:
		if (isNet4) {
			document.FormQuery.ListAsia.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListAsiaSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListAsia').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListAsiaSpots').style.visibility = sVis;
		}
		 break;
case 4:
		if (isNet4) {
			document.FormQuery.ListPacificOcean.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListPacificOceanSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListPacificOcean').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListPacificOceanSpots').style.visibility = sVis;
		}
		 break;

case 5:
		if (isNet4) {
			document.FormQuery.ListSouthAmerica.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListSouthAmericaSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListSouthAmerica').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListSouthAmericaSpots').style.visibility = sVis;
		}
		 break;

case 6:
		if (isNet4) {
			document.FormQuery.ListAfrica.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListAfricaSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListAfrica').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListAfricaSpots').style.visibility = sVis; 
		}
		 break;

case 7:
		if (isNet4) {
			document.FormQuery.ListIndianOcean.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListIndianOceanSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListIndianOcean').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListIndianOceanSpots').style.visibility = sVis;
		}
		 break;

case 8:
		if (isNet4) {
			document.FormQuery.ListAustralia.visibility = sVis;
			if (sVis=="hidden") document.FormQuery.ListAustraliaSpots.visibility = sVis; 
		}
		if (isIE4)  {
			document.getElementById('ListAustralia').style.visibility = sVis;
			if (sVis=="hidden") document.getElementById('ListAustraliaSpots').style.visibility = sVis; 
		}
		 break;
	}
}



// function for returning spots list for country
function getSpotsByCountry(idRegion, index)
{
    var sCountrySpots = aCountrySpots[idRegion, index];
    return sCountrySpots.split(","); // string to array
}

// function for returning countries list
function MkSpots(idRegion, index)
{
/*    var aidSpotsList = new Array("ListNorthAmerica","ListAtlanticOcean","ListEurope","ListAsia","ListPacificOcean", "ListSouthAmerica","ListAfrica", "ListIndianOcean", "ListAustralia");
    var aCurrCountrySpots = getSpotsByCountry(idRegion, index);
    var nCurrCountrySpotsCnt = aCurrCountrySpots.length;

    var oCountryList = document.forms["FormQuery"].elements[aidSpotsList[idRegion-1]];

    var oSpotsList = document.forms["FormQuery"].elements[aidSpotsList[idRegion-1]+"Spots"];
    alert(aidSpotsList[idRegion-1]+"Spots");

   oSpotsList.visibility = "visible";

    var oSpotsListOptionsCnt = oSpotsList.options.length;
    oSpotsList.length = 0; // remove allitems from list
    for (i = 0; i < nCurrCountrySpotsCnt; i++){
        // add spots to list
        if (document.createElement){
            var newSpotListOption = document.createElement("OPTION");
            newSpotListOption.text = aCurrCountrySpots[i];
            newSpotListOption.value = aCurrCountrySpots[i];
            // for add method IE, либо DOM, for , alas, not equal by parameters
            (oSpotsList.options.add) ? oSpotsList.options.add(newSpotListOption) : oSpotsList.add(newSpotListOption, null);
        }else{
            // for NN3.x-4.x
            oSpotsList.options[i] = new Option(aCurrCountrySpots[i], aCurrCountrySpots[i], false, false);
        }
    }
*/


     document.location.href="PeopleWise.asp?StepPW=2&action=showSpt&item1="+String(idRegion)+"&item2="+String(index);

	
}

function SelSpot(n)
{
	iSelSpot = n;
}

function PreferToBeHere()
{
	var i;
	var is = false;

	if( document.FormQuery.idRegion.value == 0 ) {
		alert("Choose a region!");
		return;
	}

	if( document.FormQuery.idCountry.value == 0 ) {
		alert("Choose a country!");
		return;
	}
	
	if (iSelSpot==0) {
		alert("Choose your favorite spot!");
		return;
	}
	
	iRgn = document.FormQuery.idRegion.value;
	iCountry = document.FormQuery.idCountry.value;
	strTime = "";
	for (i=0; i<document.FormQuery.CMonths.length; i++) {
		if (document.FormQuery.CMonths[i].checked) {
			if (strTime == "")	strTime = String(i+1);
			else				strTime += "_" + String(i+1);
		}
	}
	if(strTime == "") {
		alert("Mark sailing months for chosen spot!");
		return;
	}
	
	alert("Thank you for the answer!");
	
	document.location.href="PeopleWise.asp?StepPW=3&action=send&iRgn="+String(iRgn)+"&iCountry="+String(iCountry)+"&iSpot="+String(iSelSpot)+"&strTime="+String(strTime);
}

function CheckSendStep3(Step)
{
	if(Step==2) {
		alert("Add your favourite spots!");
		return;
	}

	document.location.href="PeopleWise.asp?StepPW=4&action=send&iRgn="+String(iRgn)+"&iSpot="+String(iSelSpot)+"&strTime="+String(strTime);
}

function CheckSendStep4()
{
	var strCPsw;

	if(((document.FormQuery.Lgn.value == null)&&(document.FormQuery.Psw.value == null)&&(document.FormQuery.CnfPsw.value == null)&&(document.FormQuery.Name.value == null))||
	   ((document.FormQuery.Lgn.value == 0)&&(document.FormQuery.Psw.value == 0)&&(document.FormQuery.CnfPsw.value == 0)&&(document.FormQuery.Name.value == 0)))
	{
		alert("Enter your login/password and name!");
		return;
	}
	strLgn = document.FormQuery.Lgn.value;
	strPsw = document.FormQuery.Psw.value;
	strCPsw = document.FormQuery.CnfPsw.value;
	strName = document.FormQuery.Name.value;

	if ((document.FormQuery.Lgn.value != 0)||(document.FormQuery.Psw.value != 0)||(document.FormQuery.CnfPsw.value != 0)) {
		if((strLgn.length < 5)||(strPsw.length < 5)) {
			alert("Login and password must be at least 5 chars long!");
			return;
		}
		if(strPsw != strCPsw) {
			alert("The confirm password does not match with the password!");
			return;
		}
	}
		
	document.location.href="PeopleWise.asp?StepPW=5&action=send&Lgn="+String(strLgn)+"&Psw="+String(strPsw)+"&Name="+String(strName);
}


function GetSpotsByLevelMonth(iLevel)
{
	var iMonth;
	
	if (document.FormQuery.ListMonths.value == 0) {
		alert("You don't choose a month!");
		return;
	}
	iMonth = document.FormQuery.ListMonths.value;
	
	window.open("ListItems.asp?action=select&iLevel="+String(iLevel)+"&iMonth="+String(iMonth), "Spots", "toolbar=yes, scrollbars=yes , resize=yes, status=yes, width=500, height=500");
}

function subForward(S)
{
	if (S<5) S = S+1;

	switch (S) {
	case 1:
		CheckSendStep1();
		break;
	case 2:
		CheckSendStep2(addEquip);
		break;
	case 3:
	case 4:
		CheckSendStep3(S-1);
		break;
	case 5:
		CheckSendStep4();
		break;
	}
}

function subBackward(S)
{
	if (S>0) S = S-1;
	document.location.href="PeopleWise.asp?StepPW=" + String(S) + "&action=send";
}

function CheckProblem(id)
{
	var  iStep, iProblem;

	if( document.FormProblem.RStep.value == null ) {
		alert("Choose the step where is the problem!");
		return;
	}
	if( document.FormProblem.ListProblem.selectedIndex == 0 ) {
		alert("Choose your problem!");
		return;
	}
	
	iStep = document.FormProblem.RStep.value;
	iProblem  = document.FormProblem.ListProblem.selectedIndex;

	document.location.href="DetailTrick.asp?action=send&id=" + String(id) + "&step=" + String(iStep) + "&problem=" + String(iProblem) + "&part=3";

}

function ClickStepTrick(n)
{
	document.FormProblem.RStep.value = n;
}
