
function init_onup() {

   var ajaxRequest;  // The variable that makes Ajax possible!
	
	try {
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	
	catch (e) {
		// Internet Explorer Browsers
		try {
		
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		
		catch (e)  {
		
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			
			catch (e) {
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
	return ajaxRequest;
}


function ticker3() {	
	//alert(id);

	var ajaxRequest;
	ajaxRequest=init_onup();
	resTextFlag = 0;	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			
				resText=ajaxRequest.responseText;
				
				
				//alert(resText);
				document.getElementById("dC").innerHTML=resText;				
			
		}					
	} //call back function			
	
				
		//alert(filename);		
		ajaxRequest.open("GET", "/includes/toprating.php?sid=" + Math.random(), true);
		ajaxRequest.send(null);
}

function ticker() {	
	//alert(id);	
	
	varind = document.getElementById("cmb_all_share_menu").selectedIndex;
	id = document.getElementById("cmb_all_share_menu").options[varind].value;
	//alert(id);
	
	var ajaxRequest;
	ajaxRequest=init_onup();
	resTextFlag = 0;	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4) {
			
				resText=ajaxRequest.responseText;
				
				
				//alert(resText);
				
				document.getElementById("dC1").innerHTML=resText;				
				document.getElementById("mymarquee").start();
				//document.getElementById("ticker_content").innerHTML=resText;				
				
				//alert(document.getElementById("dC1").innerHTML);
			
		}					
	} //call back function			
	
	//alert(id);
	//var rate_file = "";
	
	switch(id) {
		
		case "1":
			rate_file = "kse100_toprating.php";
		break;
		case "2":
			rate_file = "kse30_toprating.php";
		break;
		case "3":
			rate_file = "kmi30_toprating.php";
		break;
		case "4":
			rate_file = "all_share_toprating.php";
		break;
		
	} //switch
		
		//alert(rate_file);		
		ajaxRequest.open("GET", "/includes/"+rate_file+"?sid=" + Math.random(), true);
		ajaxRequest.send(null);
}
