﻿function createRequestObject()
{
	var request_o;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_o = new XMLHttpRequest();
	}
	return request_o;
}

var http = createRequestObject(); 

//t_functions.php?do=addToCart&pid='+id+'&qty='+qty+'&price='+price

function get_picture(file,name,width,height)
{
	document.getElementById("image_display").innerHTML = "<img src='./images/ajax-loader.gif'></img>";	
	http.open('get', 'request.php?action=get_picture&file='
	+file+'&name='+name+'&width='+width+'&height='+height);
	http.onreadystatechange = handle_picture; 
	http.send(null);
}

function handle_picture()
{
	if(http.readyState == 4)
	{
		var response = http.responseText;
		var update = new Array();
    
        if(response.indexOf('||' != -1))
        {
        update = response.split('||');
        document.getElementById("image_display").innerHTML = update[0];
        document.getElementById("image_description").innerHTML = update[1];
       	}
	}
}