// JavaScript Document
var xmlhttp;

function get_check_value(csection)
{
var c_value = "";
var total = 0;
for (var i=0; i < document.spec_form.com_spec.length; i++)
   {
   if (document.spec_form.com_spec[i].checked)
      {
      c_value = c_value + document.spec_form.com_spec[i].value + ",";
	  total=total+1;
      }
   }
//c_value = "You selected the following:\n" + c_value + total;
//c_value = "You selected the following:\n" + c_value;

//alert(c_value);

// AJAX
	document.getElementById('product_box_com').innerHTML='<div style="position:absolute; width:557px; height:100%; background:#FFFFFF;" class="transparent"><img src="/images/load.gif" style="margin:auto; position:absolute; left:50%; margin-left:-16px; top:50%; margin-top:-100px;" width="32" height="32" /></div>';
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){alert ("Browser does not support HTTP Request");return;}
	var url="/headline/act_compare_product.cfm";
	url=url+"?compare="+c_value;
	url=url+"&total="+total;
	url=url+"&csection="+csection;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged(){
	if (xmlhttp.readyState==4){
		document.getElementById('product_box').innerHTML=xmlhttp.responseText;
		document.getElementById('product_box_com').innerHTML='';
		}}
	
	function GetXmlHttpObject(){
	if (window.XMLHttpRequest)
	  {return new XMLHttpRequest();}
	if (window.ActiveXObject){
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
	}
}

// AJAX RECORD COOKIE --->
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function compare(product_id){
	
	//document.getElementById('item_compare').innerHTML='loading...';
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){alert ("Browser does not support HTTP Request");return;}
	var url="/headline/act_save_compare.cfm";
	url=url+"?prod_id="+product_id;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged(){
	if (xmlhttp.readyState==4){
		document.getElementById('item_compare').innerHTML=xmlhttp.responseText;
		document.getElementById(product_id+'-'+product_id).className ='transparent';
		document.getElementById(product_id+'-h').style.display='block';
		document.getElementById(product_id+'-n').style.display='none';

		}}
	
	function GetXmlHttpObject(){
	if (window.XMLHttpRequest)
	  {return new XMLHttpRequest();}
	if (window.ActiveXObject){
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
	}
}

function del_compare(product_id){
	
	//document.getElementById('item_compare').innerHTML='loading...';
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){alert ("Browser does not support HTTP Request");return;}
	var url="/headline/act_clear_compare.cfm";
	url=url+"?prod_id="+product_id;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged(){
	if (xmlhttp.readyState==4){
		if (product_id==0){
		}else{
		document.getElementById('th-'+product_id).innerHTML='';
		document.getElementById(product_id+'-'+product_id).className ='';
		document.getElementById(product_id+'-n').style.display='block';
		document.getElementById(product_id+'-h').style.display='none';
		}
		document.getElementById('item_compare').innerHTML=xmlhttp.responseText;
		}}
	
	function GetXmlHttpObject(){
	if (window.XMLHttpRequest)
	  {return new XMLHttpRequest();}
	if (window.ActiveXObject){
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
	}
}

function reset_product(csection){
	xmlhttp1=GetXmlHttpObject();
	if (xmlhttp1==null){alert ("Browser does not support HTTP Request");return;}
	var url="/headline/act_all_product.cfm";
	url=url+"?compare=";
	url=url+"&total=";
	url=url+"&csection="+csection;
	xmlhttp1.onreadystatechange=stateChanged;
	xmlhttp1.open("GET",url,true);
	xmlhttp1.send(null);
	
	function stateChanged(){
	if (xmlhttp1.readyState==4){
		document.getElementById('product_box').innerHTML=xmlhttp1.responseText;
		document.getElementById('product_box_com').innerHTML='';
		}}
	
	function GetXmlHttpObject(){
	if (window.XMLHttpRequest)
	  {return new XMLHttpRequest();}
	if (window.ActiveXObject){
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
	}
}

