function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	    }
	return request_o; //return the object
}
var http = createRequestObject(); 
/* Function called to get the product categories list */
function getCountryId(cid,stateid){
	http = createRequestObject(); 
	http.open('get', 'internal_request.php?option=getStateList&cid='+cid+'&stateid='+stateid);
	http.onreadystatechange = handleLoginResults; 
	http.send(null);
}
function handleLoginResults(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		alert(response);
		document.getElementById('div_show_state').innerHTML = response;
	}
}
//---------------------------------------------
function showCardValue(card_id){
	http = createRequestObject(); 
	http.open('get', 'internal_request.php?action=value_card&card_id='+card_id);
	http.onreadystatechange =function(){
		if(http.readyState == 4){ //Finished loading the response
			var response = http.responseText;
		//	alert(response);
			document.getElementById('div_value_card').innerHTML = response;
			document.getElementById('div_main_value_card').style.display = 'none' ;
			
		}
	}
	http.send(null);
}//function
//----------------------------------
function loadCallingCard(card_id,country_name,connection_fee,minute_cards_value1,minute_cards_value2,page){
	http = createRequestObject();
	http.open('get', 'internal_request.php?action=loadcountry&card_id='+card_id+'&country_name='+country_name+'&connection_fee='+connection_fee+'&minute_cards_value1='+minute_cards_value1+'&minute_cards_value2='+minute_cards_value2+'&page='+page);
	http.onreadystatechange =function(){
		if(http.readyState == 4){ //Finished loading the response
			var response = http.responseText;
			//alert(response);
			document.getElementById('div_load_calling_rate').innerHTML = response;
  		}
	}
	http.send(null);
}//function loadCallingCard
//-----------------------------------------------------------
function populateCardRate(card_id,country_from,country_name,connection_fee,minute_cards_value1,minute_cards_value2,page){
//alert(connection_fee);

	http = createRequestObject(); 
	http.open('get', 'internal_request.php?action=loadcountry&card_id='+card_id+'&country_from='+country_from+'&country_name='+country_name+'&connection_fee='+connection_fee+'&minute_cards_value1='+minute_cards_value1+'&minute_cards_value2='+minute_cards_value2+'&page='+page);
	http.onreadystatechange =function(){
		if(http.readyState == 4){ //Finished loading the response
			var response = http.responseText;
			//alert(response);
			document.getElementById('div_load_calling_rate').innerHTML = response;
  		}
	}
	http.send(null);
}//function