// JavaScript Document
var http = createRequestObject(); 

var now = new Date();

var hour        = now.getHours();

var minute      = now.getMinutes();

var second      = now.getSeconds();

var monthnumber = now.getMonth();

var monthday    = now.getDate();

var year        = now.getYear();

var zips="";

// Functions Start  //

function show_image(image_id){
	http.open('get', 'get_image.php?image_id='+image_id+'&unique='+now+hour+minute+second);
	http.onreadystatechange =  image_display; 
	http.send(null);
}

function image_display(){
	if(http.readyState == 4){ 
	   var response = http.responseText;
 	   document.getElementById('show_img').innerHTML = response;
	  /// document.getElementById("vlist").innerHTML=unescape(xmlhttp.responseText);
         // load();
	}
}



function remove_item(pro_id){
	http.open('get', 'get_remove_items.php?pro_id='+pro_id+'&unique='+now+hour+minute+second);
	http.onreadystatechange =  itms_details; 
	http.send(null);
}

function itms_details(){
	if(http.readyState == 4){ 
	   var response = http.responseText;
 	   document.getElementById('show_header_cart').innerHTML = response;
	  /// document.getElementById("vlist").innerHTML=unescape(xmlhttp.responseText);
         // load();
	}
}

function remove_item_qty(pro_id,qty){
	if(qty==""){
	alert("Alstublieft Vul AANTAL");
	return false;
	}
	http.open('get', 'get_remove_items.php?pro_id='+pro_id+'&qty='+qty+'&unique='+now+hour+minute+second);
	http.onreadystatechange =  itms_details; 
	http.send(null);
}

function itms_details(){
	if(http.readyState == 4){ 
	   var response = http.responseText;
 	   document.getElementById('show_header_cart').innerHTML = response;
	  /// document.getElementById("vlist").innerHTML=unescape(xmlhttp.responseText);
         // load();
	}
}


function show_shipping(tweight,ship_location,packing){
	http.open('get', 'get_shipping.php?ship_location='+ship_location+'&tweight='+tweight+'&packing='+packing+'&unique='+now+hour+minute+second);
	http.onreadystatechange =  ship_details; 
	http.send(null);
}

function ship_details(){
	if(http.readyState == 4){ 
	   var response = http.responseText;
 	   document.getElementById('shipping_price').innerHTML = response;
        
			  show_totalprice();
	}
}






// End of Functions  //

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"){
  
		request_o = new ActiveXObject("Microsoft.XMLHTTP");

	}else{

		request_o = new XMLHttpRequest();

	}

	return request_o; //return the object

}
