function display_max_price(){
	document.getElementById('max_price_display').innerHTML = document.segmentation.max_price.value;
}
function display_min_price(){
	document.getElementById('min_price_display').innerHTML = document.segmentation.min_price.value;
}
function update_match_count(count){
	document.getElementById('match_count').innerHTML = count;	
}

//script for reloading results

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}





//pass this the id u want it to load results in
//make sure its a string
function change_results(){
	
	var elem = document.getElementById('segmentation').elements;
	get = "";
	for(var i = 0; i < elem.length; i++){
		//alert(elem[i].name + "=" + elem[i].value + "  " + elem[i].type+ " checked?" +elem[i].checked+'\n');
		if( (elem[i].type == 'radio' || elem[i].type == 'checkbox') && elem[i].checked == true){
			get = get + elem[i].name + "=" + elem[i].value + "&";
		}
		else if(elem[i].type != 'radio' && elem[i].type != 'checkbox'){
			get = get + elem[i].name + "=" + elem[i].value + "&";
		}
	}  

	product_container = document.getElementById('seg_result_list');
	
    file = "/inc/loaders/segmentation_list_loader.php?"+get;
	xmlhttp.open("GET", file,true);
	 xmlhttp.onreadystatechange=function() {
	  if (xmlhttp.readyState==2) {
	  	product_container.innerHTML = '<br><br><center><h2>Loading Results...</h2></center><br><br>';
	  }
	  if (xmlhttp.readyState==4) {
	   var new_div = document.createElement('div');
	   new_div.innerHTML = xmlhttp.responseText;
	   
	   product_container.innerHTML = '';
	   product_container.appendChild(new_div);
	  }
	 }
	 xmlhttp.send(null)	
	setTimeout("update_match_count(document.getElementById('match_count_holder').innerHTML);",500);
	//reinit thickbox
	//setTimeout("start_thickbox()",500); 
}
function open_print_window(){
	var elem = document.getElementById('segmentation').elements;
	get = "";
	for(var i = 0; i < elem.length; i++){
		//alert(elem[i].name + "=" + elem[i].value + "  " + elem[i].type+ " checked?" +elem[i].checked+'\n');
		if( (elem[i].type == 'radio' || elem[i].type == 'checkbox') && elem[i].checked == true){
			get = get + elem[i].name + "=" + elem[i].value + "&";
		}
		else if(elem[i].type != 'radio' && elem[i].type != 'checkbox'){
			get = get + elem[i].name + "=" + elem[i].value + "&";
		}
	}  

    file = "/inc/loaders/segmentation_list_loader.php?print=1&"+get;	
	window.open(file,'print_window','width=700,height=700,scrollbars=1')
}

function start_thickbox(){
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage; 	
}