var xmlhttp
var any_function;
/**
* Get our XML object so we can do some AJAX magic!
*/
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

/**
 * Called to show comment box.
 */ 
function show_product_comment_box(product_id, box_number)
{
    //Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	//Build URL to send to server
	var url=domain+"/ajax.php?do=show_product_comment_box&pid="+product_id;
    
	//Link to function that receives response
	if(box_number == 1)
	{
		xmlhttp.onreadystatechange=show_product_comment_box_response;
	}
	else
	{
		xmlhttp.onreadystatechange=show_product_comment_box_response2;
	}
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
/**
* Handle server reponse from show_product_comment_box
*/
function show_product_comment_box_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_comment_box").innerHTML=xmlhttp.responseText;
	}

}
/**
* Handle server reponse from show_product_comment_box
*/
function show_product_comment_box_response2()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_comment_box2").innerHTML=xmlhttp.responseText;
	}

}
/**
 * Called to show comment box.
 */ 
function add_comment(product_id, recommended)
{
    //Get our XML Object
    xmlhttp=GetXmlHttpObject();
    
    
    //Make sure we have javascript enabled.
    if (xmlhttp==null)
    {
		alert (no_ajax_message);
		return;
    }
    
    var errorExists = false;
    
    //Check message
    var text = document.getElementById("text").value;
    
    if(text == "")
    {
        document.getElementById("text_error").innerHTML = "Can't be empty";
	errorExists = true;
    }
    else
    {
        document.getElementById("text_error").innerHTML = "";
    }
    var userid = document.getElementById("userid").value;

    var email = "";
    var name = "";
    if(userid == "-1")
    {
	email = document.getElementById("email").value;
	if(email == "")
	{
	    document.getElementById("email_error").innerHTML = "Can't be empty";
	    errorExists = true;
	}
	else if(email_check(email) == false)
	{
	    document.getElementById("email_error").innerHTML = "Not a valid email address.";
	    errorExists = true;
	}
	else
	{
	    document.getElementById("email_error").innerHTML = "";
	}
	
	name = document.getElementById("name").value;
	if(email == "")
	{
	    document.getElementById("name_error").innerHTML = "Can't be empty";
	    
	    errorExists = true;
	}
	else
	{
	    document.getElementById("name_error").innerHTML = "";
	}
	
    }
    if(errorExists == true)
    {
	return;
    }
    
    var url=domain+"/ajax.php?do=add_product_comment";
    var params = 'userid=' + userid;
    var params = params + '&email=' + email;
    var params = params + '&name=' + name;
    var params = params + '&text=' + text;
    var params = params + '&product_id=' + product_id;
	var params = params + '&recommended=' + recommended;
    
    xmlhttp.open("POST",url,true);
    
    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
    
    //Link to function that receives response
    xmlhttp.onreadystatechange=add_comment_response;
    
    //Open and Send AJAX request
    xmlhttp.send(params);

}
/**
* Handle server reponse from show_product_comment_box
*/
function add_comment_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		var response = xmlhttp.responseText.split("|");
		if(response[0] == "FAILURE")
		{
			document.getElementById("product_comment_error").innerHTML=response[1];
		}
		else
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
	}

}
function hide_review_box()
{
	document.getElementById("product_comment_box").innerHTML="";
	document.getElementById("product_comment_box2").innerHTML="";
}
/**
 * Called to refresh comment table only now the comment_Id will be shown as editable.
 */ 
function edit_product_comment(comment_id)
{
    //Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	//Build URL to send to server
	var url=domain+"/ajax.php?do=edit_product_comment&cid="+comment_id;
    
	//Link to function that receives response
	xmlhttp.onreadystatechange=edit_product_comment_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
/**
* Handle server reponse from show_product_comment_box
*/
function edit_product_comment_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("comment_box").innerHTML=xmlhttp.responseText;
	}

}
/**
 * Called when submitting changes to a comment.
 **/
function edit_product_comment_submit(comment_id)
{
    //Get our XML Object
    xmlhttp=GetXmlHttpObject();
    
    
    //Make sure we have javascript enabled.
    if (xmlhttp==null)
    {
	alert (no_ajax_message);
	return;
    }
    
    var errorExists = false;
    
    //Check message
    var text = document.getElementById("text_"+comment_id).value;
    
    if(text == "")
    {
        document.getElementById("text_error").innerHTML = "Can't be empty";
	errorExists = true;
    }
    else
    {
        document.getElementById("text_error").innerHTML = "";
    }
    
    if(errorExists)
    {
	return;
    }
    
    var url=domain+"/ajax.php?do=edit_product_comment_submit";
    var params = 'comment_id=' + comment_id;
    var params = params + '&text=' + text;
    
    xmlhttp.open("POST",url,true);
    
    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
    
    //Link to function that receives response
    xmlhttp.onreadystatechange=edit_product_comment_submit_response;
    
    //Open and Send AJAX request
    xmlhttp.send(params);
}
function edit_product_comment_submit_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		var response = xmlhttp.responseText.split("|");
		
		if(response[0] == "FAILURE")
		{
			document.getElementById("text_error").innerHTML=response[1];
		}
		else
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
	}

}
/**
 * Called to refresh comment table only now the comment_Id will be shown as editable.
 */ 
function delete_product_comment(comment_id)
{
	var result = confirm("Are you sure you want to delete this comment? This action cannot be undone.");
	if(result)
	{
		//Get our XML Object
		xmlhttp=GetXmlHttpObject();
		//Make sure we have javascript enabled.
		if (xmlhttp==null)
		{
			alert (no_ajax_message);
			return;
		}
		
		//Build URL to send to server
		var url=domain+"/ajax.php?do=delete_product_comment&comment_id="+comment_id;
	    
		//Link to function that receives response
		xmlhttp.onreadystatechange=delete_product_comment_response;
		//Open and Send AJAX request
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
}
/**
* Handle server reponse from show_product_comment_box
*/
function delete_product_comment_response()
{

		//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		var response = xmlhttp.responseText.split("|");
		
		if(response[0] == "FAILURE")
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
		else
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
	}
	

}
/**
 * Called to report a user comment/review
 */ 
function report_product_comment(comment_id)
{

	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	
	//Build URL to send to server
	var url=domain+"/ajax.php?do=report_product_comment&comment_id="+comment_id;
	    
	//Link to function that receives response
	xmlhttp.onreadystatechange=report_product_comment_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_comment_box
*/
function report_product_comment_response()
{

		//We are ready to change page html
	if (xmlhttp.readyState==4)
	{

		var response = xmlhttp.responseText.split("|");
		
		if(response[0] == "FAILURE")
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
		else
		{
			document.getElementById("comment_box").innerHTML=response[1];
		}
	}
}
function report_product_comment_submit(comment_id)
{
    //Get our XML Object
    xmlhttp=GetXmlHttpObject();
    
    
    //Make sure we have javascript enabled.
    if (xmlhttp==null)
    {
	alert (no_ajax_message);
	return;
    }
    
    var errorExists = false;
    
    //Check message
    var text = document.getElementById("report_text_"+comment_id).value;
    
    if(text == "")
    {
        document.getElementById("report_text_error_"+comment_id).innerHTML = "Can't be empty";
	errorExists = true;
    }
    else
    {
        document.getElementById("report_text_error_"+comment_id).innerHTML = "";
    }
    
    if(errorExists)
    {
	return;
    }
    
    var url=domain+"/ajax.php?do=report_product_comment_submit";
    var params = 'comment_id=' + comment_id;
    var params = params + '&text=' + text;
    
    xmlhttp.open("POST",url,true);
    
    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
    
    //Link to function that receives response
    xmlhttp.onreadystatechange=report_product_comment_submit_response;
    
    //Open and Send AJAX request
    xmlhttp.send(params);
}
function report_product_comment_submit_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		var response = xmlhttp.responseText.split("|");
		
		if(response[0] == "FAILURE")
		{
			document.getElementById("product_report_box_"+response[1]).innerHTML=response[2];
		}
		else
		{
			document.getElementById("product_report_box_"+response[1]).innerHTML=response[2];
		}
	}

}
function add_comment_rating(comment_id, value, redirect)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	
	//Build URL to send to server
	var url=domain+"/ajax.php?do=add_comment_rating&cid="+comment_id+"&value="+value+"&r="+redirect;
    
	//Link to function that receives response
	xmlhttp.onreadystatechange=add_comment_rating_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function add_comment_rating_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("comment_box").innerHTML=xmlhttp.responseText;
	}

}
function email_check(str)
{

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	{
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
	   return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
	    return false;
	}
	if (str.indexOf(at,(lat+1))!=-1)
	{
	    return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1)
	{
	   return false;
	}
	
	if (str.indexOf(" ")!=-1)
	{
		return false;
	}
 	return true;			
}
/*****************************
 *    ADMIN FUNCTIONS        *
 *****************************/
function disable_product(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	
	var result = confirm("Are you sure you want to disable this product?");
	
	if(result)
	{
		
		//Build URL to send to server
		var url=domain+"/admin_ajax.php?do=enable_disable_product&pid="+product_id;
		
		//Link to function that receives response
		xmlhttp.onreadystatechange=disable_product_response;
		//Open and Send AJAX request
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function disable_product_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function enable_product(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=enable_disable_product&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=enable_product_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function enable_product_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function show_edit_product(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_edit_product&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_edit_product_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_edit_product_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
/**
 * Called to show comment box.
 */ 
function edit_product(product_id)
{
    //Get our XML Object
    xmlhttp=GetXmlHttpObject();
    
    
    //Make sure we have javascript enabled.
    if (xmlhttp==null)
    {
		alert (no_ajax_message);
		return;
    }
    
    var errorExists = false;
    
    //Check message
    var description = document.getElementById("product_description").value;
    
    
    var url=domain+"/admin_ajax.php?do=edit_product";
    var params = 'pid=' + product_id;
    var params = params + '&description=' + escape(description);
	
    xmlhttp.open("POST",url,true);
    
    //Send the proper header information along with the request
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
    
    //Link to function that receives response
    xmlhttp.onreadystatechange=edit_product_response;
    
    //Open and Send AJAX request
    xmlhttp.send(params);

}
function edit_product_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function show_edit_product_image(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_edit_product_image&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_edit_product_image_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_edit_product_image_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function edit_product_image(product_id, image_url)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=edit_product_image&pid="+product_id+"&img="+image_url;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=edit_product_image_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function edit_product_image_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function show_link_product(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_link_product&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_link_product_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_link_product_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function link_product_and_remove(product_id,link_product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=link_product_and_remove&pid="+product_id+"&lpid="+link_product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=link_product_and_remove_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
/**
* Handle server reponse from show_product_advanced_options
*/
function link_product_and_remove_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_page").innerHTML=xmlhttp.responseText;
	}

}
function show_edit_product_title(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_edit_product_title&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_edit_product_title_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function show_edit_product_title_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("title_box").innerHTML=xmlhttp.responseText;
	}

}
function edit_product_title(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

	var title = document.getElementById("product_title").value;
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=edit_product_title&pid="+product_id+"&title="+title;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=edit_product_title_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function edit_product_title_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("title_box").innerHTML=xmlhttp.responseText;
	}

}
function update_product_results(category_id_or_keywords, is_search, sort)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}
	
	var brand_array = document.getElementById("advanced_brands").getElementsByTagName("input");
	
	var brand_string = "";
	
	for(i = 0; i < brand_array.length; i++)
	{
		var brand_input = brand_array[i];
		if(brand_input.checked)
		{
			var id_array =  brand_input.id.split("_");
			if(brand_string != "")
			{
				brand_string = brand_string + ",";
			}
			brand_string = brand_string + id_array[2];
		}
	}
	if(brand_string != "")
	{
		//brand_string = "(" + brand_string + ")";
	}
	if(!is_search)
	{
		window.location = domain + "/products.php?adv=true&cid="+category_id_or_keywords+"&brands="+brand_string+"&page=1&sort="+sort;
	}
	else
	{
		window.location = domain + "/search.php?adv=true&keywords="+category_id_or_keywords+"&page=1&brands="+brand_string;
	}
	
}
function show_product_category_edit(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_product_category_edit&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_product_category_edit_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_product_category_edit_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_category_string").innerHTML=xmlhttp.responseText;
	}

}
function product_category_edit(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

	var category_id = document.getElementById("product_category_id").value;
	
	if(category_id < 1)
	{
		alert("Must enter a category");
		return;
	}
	
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=product_category_edit&pid="+product_id+"&cid="+category_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=product_category_edit_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function product_category_edit_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_category_string").innerHTML=xmlhttp.responseText;
	}

}
function show_linked_products(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=show_linked_products&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_linked_products_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_linked_products_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("linked_products_box").innerHTML=xmlhttp.responseText;
	}

}
function show_all_prices(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/ajax.php?do=show_all_prices&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_all_prices_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_all_prices_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_description_box").innerHTML=xmlhttp.responseText;
	}

}
function show_product_description(product_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/ajax.php?do=show_product_description&pid="+product_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=show_product_description_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function show_product_description_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("product_description_box").innerHTML=xmlhttp.responseText;
	}

}
function undo_product_link(product_url_join_id)
{
	//Get our XML Object
	xmlhttp=GetXmlHttpObject();
	//Make sure we have javascript enabled.
	if (xmlhttp==null)
	{
		alert (no_ajax_message);
		return;
	}

		
	//Build URL to send to server
	var url=domain+"/admin_ajax.php?do=undo_product_link&pujid="+product_url_join_id;
	
	//Link to function that receives response
	xmlhttp.onreadystatechange=undo_product_link_response;
	//Open and Send AJAX request
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}
/**
* Handle server reponse from show_product_advanced_options
*/
function undo_product_link_response()
{
	//We are ready to change page html
	if (xmlhttp.readyState==4)
	{
		document.getElementById("linked_products_box").innerHTML=xmlhttp.responseText;
	}

}