function InitB()
{
	Scroll2 = document.getElementById("ScrollRamaB");
	Scroll3 = document.getElementById("ScrollRamaC");
	
	Scroll2.options.length=0;
	document.getElementById("ScrollRamaC").options.length=0;

	if (document.getElementById("ScrollRamaA").value > 0) {
	    Scroll2.disabled = false;
	    //Scroll3.disabled = false;
	}
	else {
	    Scroll2.disabled = true;
	    Scroll3.disabled = true;	
	}
	
	if(document.getElementById("ScrollRamaA").value != 0)
	{
		var url = "http://www.tostudy.co.il/services/ScrollSevice.asp?refa=" + document.getElementById("ScrollRamaA").value;
		var xmlhttp;
		var txt,x,xx1,xx2,i;
		if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}

		xmlhttp.onreadystatechange = function() {
		    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		        x = xmlhttp.responseXML.documentElement.getElementsByTagName("myoption");
		        for (i = 0; i < x.length; i++) {
		            xx1 = x[i].getElementsByTagName("optionvalue");
		            {
		                try { }
		                catch (er) { }
		            }
		            xx2 = x[i].getElementsByTagName("optioname");
		            {
		                try {
		                    //alert(xx2[0].firstChild.nodeValue);
		                }
		                catch (er) {
		                    //nada
		                }
		            }
		            //alert(xx1[0].firstChild.nodeValue);
		            //alert(xx2[0].firstChild.nodeValue);

		            Scroll2.options[Scroll2.length] = new Option(xx2[0].firstChild.nodeValue, xx1[0].firstChild.nodeValue)
		        }
		    }
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send();

		//document.getElementById("ScrollRamaB").selectedIndex = 5;
	}
}



function InitC()
{
	Scroll3 = document.getElementById("ScrollRamaC");
	
	Scroll3.options.length=0;

	if (document.getElementById("ScrollRamaB").value > 0) {
	    Scroll3.disabled = false;
	}
	else {
	    Scroll3.disabled = true;
	}
	
		
	var urlc = "http://www.tostudy.co.il/services/ScrollSevice.asp?refB=" + document.getElementById("ScrollRamaB").value;
	var xmlhttp1;
	var txt,y,yy1,yy2,i;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp1=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp1.onreadystatechange=function()
	{
		if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
	    {
	    	y=xmlhttp1.responseXML.documentElement.getElementsByTagName("myoption");
	    	for (i=0;i<y.length;i++)
	      	{
	      		yy1=y[i].getElementsByTagName("optionvalue");
	        	{
	        		try{  }
	        		catch (er) { }
	        	}
	     		 yy2=y[i].getElementsByTagName("optioname");
	        	{
	        		try
	          		{
	          			//alert(xx2[0].firstChild.nodeValue);
	          		}
	        		catch (er)
	          		{
						//nada
	          		}
	        	}
		      	//alert(yy1[0].firstChild.nodeValue);
		      	//alert(yy2[0].firstChild.nodeValue);
		      	
		      	Scroll3.options[Scroll3.length]=new Option(yy2[0].firstChild.nodeValue, yy1[0].firstChild.nodeValue)
	      	}
	    }
	}
	xmlhttp1.open("GET",urlc,true);
	xmlhttp1.send();
	
	//alert(document.getElementById("ScrollRamaC").length)
}



function GoToPage()
{

	var example=document.getElementById('ScrollRamaA').value;
	var stage2=document.getElementById('ScrollRamaB').value;
	var stage3=document.getElementById('ScrollRamaC').value;
	var ezor=0;
	//var ezor=document.testform.ezor.value;
	//var mylength=document.testform.stage3.length;
	
	if(example==0)
		{ 
			document.getElementById('1stage').style.visibility='visible'; 
		}
	else
		{ 
			if(stage2==0)
				{
					top.location.href = "http://www.tostudy.co.il/categorypage.asp?id="+example;
				}
			else
				{
					if(document.getElementById('ScrollRamaC').length==0)
						{
							top.location.href = "http://www.tostudy.co.il/findlimudim.asp?example="+example+"&stage2="+stage2+"&stage3=0&ezor="+ezor;
						}
					else
						{
							if(stage3==0)
								{
									if(example==5 || example==1 || example==2)
									{
										if(stage2==14 || stage2==803)
										{
											window.location = "rama2.asp?id="+stage2;
										}
										else
										{
											top.location.href = "http://www.tostudy.co.il/findlimudim.asp?example="+example+"&stage2="+stage2+"&stage3=0&ezor="+ezor;
										}
									}
									else
									{
										top.location.href = "http://www.tostudy.co.il/rama2.asp?id="+stage2;
									}
									
								}
							else
								{
									top.location.href = "http://www.tostudy.co.il/findlimudim.asp?example="+example+"&stage2="+stage2+"&stage3="+stage3+"&ezor="+ezor;
								}
						
						}
				}

		}
		

	
	//alert(Rama1+Rama2+Rama3)
	
	//document.location='http://www.tostudy.co.il/findlimudim.asp?example=' + Rama1 + '&stage2=' + Rama2 + '&stage3=' + Rama3 + '&ezor=0';
}
