var pagePath = 'http://192.168.1.15/emo/';

var gid = 0;

function showOption(){
	
	if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete"){   

		document.getElementById("prdoptions_"+gid).innerHTML = xmlhttp.responseText;
		
	}
	
}


function changeOptionSpill(id){
		gid = id;
		vid = document.getElementById('prodid_'+id).value;
		
		var url = pagePath + "ajax/change_spill_option.php?id=" + id + "&vid=" + vid;
		
		run_ajax(showOption,url);
}

//
// Main Ajax Function
//
function run_ajax(state_changed_function,url)
{

	xmlhttp = null
	// code for Mozilla, opera, netscape etc.
	if (window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest()
	 }
	// code for IE
	else if (window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
	 }
	if (xmlhttp != null){
		xmlhttp.onreadystatechange=state_changed_function
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
	 }
	else{
		alert("Your browser does not support Ajax.")
	 }
}


/*
function showOption(){
	
	if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete"){   

		document.getElementById("prdoptions").innerHTML = xmlhttp.responseText;
	}
	
}


function changeOptionSpill(id){
		
		vid = document.getElementById('prodid_'+id).value;
		
		var url = pagePath + "ajax/change_spill_option.php?id=" + id + "&vid=" + vid;
		
		run_ajax(showOption,url);
}

//
// Main Ajax Function
//
function run_ajax(state_changed_function,url)
{
	xmlhttp = null
	// code for Mozilla, opera, netscape etc.
	if (window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest()
	 }
	// code for IE
	else if (window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
	 }
	if (xmlhttp != null){
		xmlhttp.onreadystatechange=state_changed_function
		xmlhttp.open("GET",url,true)
		xmlhttp.send(null)
	 }
	else{
		alert("Your browser does not support Ajax.")
	 }
}*/
