// JavaScript Document

var xmlHttp1;
var xmlHttp2;
var xmlHttp3;
var xmlHttp31;
var xmlHttp11;
var xmlHttp4;
var xmlHttp5;
var xmlHttp12;
var xmlHttp13;
var xmlHttp22;

function product_brand_search(val)
{
	var obj = document.getElementById('product_brand_all');
	if(val==1){
		obj.src=imgTrue;
		obj.onclick = new Function('product_brand_search(0)'); 
	}
	else{
		obj.src=imgFalse;
		obj.onclick = new Function('product_brand_search(1)'); 
	}

	if(document.forms['product_search'])
	{
		obj = document.forms['product_search'];
	}
	else 
	{
		if(document.forms['home_search'])
		{
			obj = document.forms['home_search'];	
		}
	}
	if(val==1)
	{
		var menufact=obj.elements['product_menufact[]'];
		var product_menufact=Array();
			for(i=0;i<menufact.length;i++)
			{
				if(menufact[i].checked==true)
				{
					menufact[i].checked=false;
				}
			}	
	}
	changeCheck();
	if(document.forms['product_search'])
	{
		product_search_result(1);
	}
	else
	{
		product_home_search_result(1);
	}
	
}

function product_rate_search(val)
{
	var obj = document.getElementById('product_brand_all');
	if(val==1){
		obj.src=imgTrue;
		obj.onclick = new Function('product_rate_search(0)'); 
	}
	else{
		obj.src=imgFalse;
		obj.onclick = new Function('product_rate_search(1)'); 
	}

	
	obj = document.forms['rating'];	
	
	if(val==1)
	{
		var menufact=obj.elements['product_menufact[]'];
		var product_menufact=Array();
			for(i=0;i<menufact.length;i++)
			{
				if(menufact[i].checked==true)
				{
					menufact[i].checked=false;
				}
			}	
	}
	changeCheck();
	product_rating_result();
}

function changeOrderRate(val)
{
	
	document.forms['rating'].elements['order'].value = val;
	
	if(document.forms['rating'].elements['type'])
	{
		if(document.forms['rating'].elements['type'].value=='ASC')
			document.forms['rating'].elements['type'].value="DESC";
		else
    		document.forms['rating'].elements['type'].value="ASC";
	}
	product_rating_result();
}

function change_orderByBrand(val)
{
	document.forms['order'].elements['order_by'].value = val;
	if(document.forms['order'].elements['order_type'])
	{
		if(document.forms['order'].elements['order_type'].value=='ASC')
			document.forms['order'].elements['order_type'].value="DESC";
		else
    		document.forms['order'].elements['order_type'].value="ASC";
	}
	product_search_result(1);
}
function deleteImage(changeMode, ID, statusPortion, type){
	if(confirm('Are you sure to delete this '+type+'?')){
		if(changeMode!="" && ID!="" && statusPortion!=""){
			document.getElementById(statusPortion).innerHTML = '<img src="admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" /> Please wait';
			deleteImageResponse('admin/admin_delete_image.php?mode='+changeMode+'&id='+ID+'&type='+type+'', changeMode, ID, statusPortion);
		}
	}
}

function deleteImageResponse(page, changeMode, ID, statusPortion) {
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	xmlHttp.open("GET", page, true);
	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			var getValue=xmlHttp.responseText;
			if (getValue=="done") {
				document.getElementById(statusPortion).innerHTML = '';
			}
		}
	}
	xmlHttp.send(null);
}

function chkurl(val,pagename) {

   
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=pagename;
	
	url=url+'?url='+val+'&mode=chk_url';
	//url=url+"&blog_id="+id;
	//alert(url);
	xmlHttp.onreadystatechange = function ()
	{
		if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
		{
			
			var returned_text = xmlHttp.responseText;
			if(returned_text!="")
			{
				document.getElementById('errval').innerHTML=returned_text;
			}
			else
			{
				document.getElementById('errval').innerHTML='';
			}
			
			//document.getElementById(popup).style.display='block';
			//document.getElementById('contactPop').style.display='none';
			//document.location.reload();
		
		}
	}
	
	xmlHttp.open('GET',url,true);
	//setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
	xmlHttp.send(null);
	//send('usermail='+usermail+'&title_id='+title_id+'&email='+email+'&to='+to+'&subject='+subject+'&to='+to+'&content='+content);
	// document.getElementById('blogPop').innerHTML='I am here';
	
}

function contactPopup(popup,title_id,email,title,channel_id,postedby)
{

	var obj = document.getElementById("disp_"+title_id);
	var y = parseInt(findPosY(obj));
	document.forms['contactPop'].elements['title_id'].value=title_id;
	document.forms['contactPop'].elements['usermail'].value=email;
	document.forms['contactPop'].elements['mkchannel_id'].value=channel_id;
	document.forms['contactPop'].elements['to'].value=postedby;
	document.getElementById('val').innerHTML=postedby;
	document.forms['contactPop'].elements['subject'].value='re:'+title;
	
	var obj = document.forms['contactPop'];
	obj.elements['name'].value = '';
	obj.elements['email'].value = '';
	obj.elements['content'].value = '';
	
	document.getElementById('errval').innerHTML = "";
	document.getElementById(popup).style.visibility='visible';
	document.getElementById(popup).style.left = '300px';
	document.getElementById(popup).style.top = (y-100)+'px';
}

function contactPopHide(popup)
{
	document.getElementById(popup).style.display='none';
	
}


////////////////////////////////////////////////////////////////////////////////////////////////////////


function selectdiv(val,page_name,div_id,div,type,category_id)
{ 
  
	document.getElementById(div).innerHTML = "<img src=\"images/search_loader.gif\" border=\"0\" />";
	//alert(div_id)
	xmlHttp13=GetXmlHttpObject();
	if (xmlHttp13==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url=page_name;
	url=url+"?mode=fetchCat";
	url=url+"&id="+val+"&typeval="+type+"&category_id="+category_id;
	//alert(url);
	xmlHttp13.onreadystatechange = function ()
	{
		if (xmlHttp13.readyState == 4 || xmlHttp13.readyState=="complete")
		{
			var returned_text = xmlHttp13.responseText;
			if(returned_text!="")
			{ 
				document.getElementById(div).innerHTML=returned_text;
				document.getElementById('job_view').style.display='none';
				if(document.getElementById('job_view1'))
					document.getElementById('job_view1').innerHTML='';
				document.register.type.value='';
			}
		if(type!='')
		{
			func(type);
		}
		
		}
	}
    xmlHttp13.open('GET',url,true);
//setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

	xmlHttp13.send(null);

};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function product_rating_result()
{
	var str="?mode=showlist&";
	var warning=0;
	var menufact=document.forms['rating'].elements['product_menufact[]'];
	//changeCheck();
	var flag_brand=0;
	var product_menufact=Array();
	for(i=0;i<menufact.length;i++)
	{
		if(menufact[i].checked==true){
			flag_brand=1;
			product_menufact+=menufact[i].value+",";
			document.getElementById('product_brand_all').src = imgFalse;
			document.getElementById('product_brand_all').onclick = new Function('product_rate_search(1)'); 
		}
	}

	
	str+="product_menufact="+product_menufact+"&";
	var brandAll = document.getElementById('product_brand_all').src;
	
	if(flag_brand==0 && brandAll.search(imgFalse)!=-1)
	{
		warning=1;
	}
	
	
	if(document.forms['rating'].elements['att_category[]'])
	{
		var category=document.forms['rating'].elements['att_category[]'];
		var att_category=Array();
		for(i=0;i<category.length;i++)
		{
			if(category[i].checked==true)
			att_category+=category[i].value+",";
		}
		str+="att_category="+att_category+"&";
	}
	if(document.forms['rating'])
		{
			if(document.forms['rating'].elements['order'])
			{
				if(document.forms['rating'].elements['order'].value!='')
					str+="order_by="+document.forms['rating'].elements['order'].value+"&";
			}
			if(document.forms['rating'].elements['type'])
			{
				if(document.forms['rating'].elements['type'].value!='')
					str+="order_type="+document.forms['rating'].elements['type'].value+"&";
			}
		}
	
	if(warning==1)
	{
		/////////////////////////////////////////////////////////////////////////////////////////
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		if(document.getElementById('searchLoader'))
		{
			document.getElementById('searchLoader').style.display = "none";
		}
		
		
		document.getElementById("ratingDetails").innerHTML = '<div class="vendorPageList"><span class="breadcomLeft">Sorry! no result found</span><span class="breadcomRight"></span></div>';
		//alert ("Please select atleast one brand");
		//return;
	}
	else
	{
		xmlHttp6=GetXmlHttpObject()
		if (xmlHttp6==null)
		  {
			  alert ("Your browser does not support AJAX!");
			  return;
		  } 
		var url="rating.php";
		
		url=url+str;
		//alert(url);
		xmlHttp6.onreadystatechange=ratingproduct_stateChanged;
		xmlHttp6.open("GET",url,true);
		xmlHttp6.send(null);
	}
}
function ratingproduct_stateChanged() 
{ 
	if (xmlHttp6.readyState==4)
	{ 
		document.getElementById("ratingDetails").innerHTML=xmlHttp6.responseText;
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		setTimeout("leftBannerHeight()", 50);
	}
	else
	{
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "";
		}
	}
}


function review_submit()
{
	
	if(document.forms['review'].elements['name'].value=='')
	{
		alert("Please enter your name!");
		document.forms['review'].elements['name'].focus();
	}
	else if(document.forms['review'].elements['email'].value=='')
	{
		alert("Please enter your email!");	
		document.forms['review'].elements['email'].focus();
	}
	else if(document.forms['review'].elements['rating'].value<='0')
	{
		alert("Please select a rate for this product!");	
	}
	else if(document.forms['review'].elements['rating1'].value<='0')
	{
		alert("Please select a rate for this brand!");	
	}
	else
	{
	var str="?mode=review_save&";
	str+="product_id="+document.forms['review'].elements['product_id'].value+"&";
	str+="name="+document.forms['review'].elements['name'].value+"&";
	str+="email="+document.forms['review'].elements['email'].value+"&";
	str+="rating="+document.forms['review'].elements['rating'].value+"&";
	str+="rating1="+document.forms['review'].elements['rating1'].value+"&";
	str+="positive="+document.forms['review'].elements['positive'].value+"&";
	str+="negative="+document.forms['review'].elements['negative'].value+"";
	
	xmlHttp12=GetXmlHttpObject()
	if (xmlHttp12==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var url="product_details.php";
	
	url=url+str;
	//alert(url);
	xmlHttp12.onreadystatechange=review_submit_stateChanged;
	xmlHttp12.open("GET",url,true);
	xmlHttp12.send(null);
	}
	return false;
}
function review_submit_stateChanged() 
{ 
	if (xmlHttp12.readyState==4)
	{ 
		document.getElementById("review_msg").innerHTML=xmlHttp12.responseText;
		document.forms['review'].elements['rating'].value='0';
		document.forms['review'].elements['rating1'].value='0';
		document.forms['review'].elements['name'].value='';
		document.forms['review'].elements['email'].value='';
		document.forms['review'].elements['positive'].value='';
		document.forms['review'].elements['negative'].value='';
	}
	else
	{
		document.getElementById("review_msg").innerHTML='Please wait ....'
	}
}
function feedback_submit()
{
	var typeId_obj = document.forms['feedbackForm'].elements['typeId[]'];
	var flagId = 0;
	for(i=0;i<typeId_obj.length;i++)
	{
		if(typeId_obj[i].checked==true)
		flagId = 1;
	}
	
	if(flagId==0)
	{
		alert("Please select feedback type.");
		//typeId_obj.focus();
		return false;
	}
	else if(document.forms['feedbackForm'].elements['name'].value=='')
	{
		alert("Please enter your name.");
		document.forms['feedbackForm'].elements['name'].focus();
		return false;
	}
	else if(document.forms['feedbackForm'].elements['email'].value=='')
	{
		alert("Please enter your email.");	
		document.forms['feedbackForm'].elements['email'].focus();
		return false;
	}
	var str=document.forms['feedbackForm'].elements['email'].value;
	var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|tv|biz))$/
	if(!emailRe.test(str)) {
	alert("Please enter valid email id.");
	document.forms['feedbackForm'].elements['email'].focus();
	return false;
	}
	else if(document.forms['feedbackForm'].elements['feedback'].value=='')
	{
		alert("Please type your feedback.");	
		document.forms['feedbackForm'].elements['feedback'].focus();
		return false;
	}
	else
	{
	var str="?";
	var typeIdVal ='';
	for(i=0;i<typeId_obj.length;i++)
	{
		if(typeId_obj[i].checked==true)
		typeIdVal += typeId_obj[i].value+',';
	}
	str+="typeId="+typeIdVal+"&";
	str+="name="+document.forms['feedbackForm'].elements['name'].value+"&";
	str+="email="+document.forms['feedbackForm'].elements['email'].value+"&";
	str+="feedback="+document.forms['feedbackForm'].elements['feedback'].value;
	
	
	xmlHttp12=GetXmlHttpObject()
	if (xmlHttp12==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var url="feedback.php";
	
	url=url+str;
	//alert(url);
	xmlHttp12.onreadystatechange=feedback_submit_stateChanged;
	xmlHttp12.open("GET",url,true);
	xmlHttp12.send(null);
	}
	return false;
}
function feedback_submit_stateChanged() 
{ 
	if (xmlHttp12.readyState==4)
	{ 
		document.getElementById("feedback_msg").innerHTML=xmlHttp12.responseText;
		var typeId_obj = document.forms['feedbackForm'].elements['typeId[]'];
		for(i=0;i<typeId_obj.length;i++)
		{
			if(typeId_obj[i].checked==true)
			typeId_obj[i].checked=false;
		}
		changeCheck();
		document.forms['feedbackForm'].elements['name'].value='';
		document.forms['feedbackForm'].elements['email'].value='';
		document.forms['feedbackForm'].elements['feedback'].value='';
		document.getElementById('FeedbackSubmit').style.visibility='visible';
	}
	else
	{
		document.getElementById("feedback_msg").innerHTML='<span class="blue">Please wait ....</span>';
		document.getElementById('FeedbackSubmit').style.visibility='hidden';
	}
}
function check_askus(){
	var typeId_obj = document.forms['askus_form'].elements['typeAsk[]'];
	var flagId = 0;
	var flagMendatary = 0;
	for(i=0;i<typeId_obj.length;i++)
	{
		if(typeId_obj[i].checked==true){
			if(typeId_obj[i].value=='street price')
			{
			flagMendatary =1;	
			}
			flagId = 1;
		}
	}
	
	if(flagId==0)
	{
		alert("Please select type.");
		//typeId_obj.focus();
		return false;
	}
	else if(document.forms['askus_form'].elements['brand'].value=='' && flagMendatary == 1)
	{
		alert("Please select a brand.");
		document.forms['askus_form'].elements['brand'].focus();
		return false;
	}
	else if(document.forms['askus_form'].elements['model'].value=='' && flagMendatary == 1)
	{
		alert("Please enter model.");
		document.forms['askus_form'].elements['model'].focus();
		return false;
	}
	else if(document.forms['askus_form'].elements['name'].value=='')
	{
		alert("Please enter your name.");
		document.forms['askus_form'].elements['name'].focus();
		return false;
	}
	else if(document.forms['askus_form'].elements['city'].value=='')
	{
		alert("Please select city.");
		document.forms['askus_form'].elements['city'].focus();
		return false;
	}
	else if(document.forms['askus_form'].elements['email'].value=='')
	{
		alert("Please enter your email.");	
		document.forms['askus_form'].elements['email'].focus();
		return false;
	}
	var str=document.forms['askus_form'].elements['email'].value;
	var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|tv|biz))$/
	if(!emailRe.test(str)) {
	alert("Please enter valid email id.");
	document.forms['askus_form'].elements['email'].focus();
	return false;
	}
	else if(document.forms['askus_form'].elements['mobile'].value=='')
	{
		alert("Please enter your mobile.");	
		document.forms['askus_form'].elements['mobile'].focus();
		return false;
	}
	else
	{
	var str="?mode=ask_qs&";
	var typeIdVal ='';
	for(i=0;i<typeId_obj.length;i++)
	{
		if(typeId_obj[i].checked==true)
		typeIdVal += typeId_obj[i].value+',';
	}
	str+="type="+typeIdVal+"&";
	str+="brand="+document.forms['askus_form'].elements['brand'].value+"&";
	str+="model="+document.forms['askus_form'].elements['model'].value+"&";
	str+="name="+document.forms['askus_form'].elements['name'].value+"&";
	str+="city="+document.forms['askus_form'].elements['city'].value+"&";
	str+="email="+document.forms['askus_form'].elements['email'].value+"&";
	str+="mobile="+document.forms['askus_form'].elements['mobile'].value;
	
	
	xmlHttp12=GetXmlHttpObject()
	if (xmlHttp12==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var url="experts.php";
	
	url=url+str;
	//alert(url);
	xmlHttp12.onreadystatechange=check_askus_stateChanged;
	xmlHttp12.open("GET",url,true);
	xmlHttp12.send(null);
	}
	return false;
}

function check_askus_stateChanged() { 
	if (xmlHttp12.readyState==4)
	{ 
		document.getElementById("askus_msg").innerHTML=xmlHttp12.responseText;
		document.forms['askus_form'].reset();
		changeCheck();
		document.getElementById('askus_submit').style.visibility='';
	}
	else
	{
		document.getElementById("askus_msg").innerHTML='Please wait ....';
		document.getElementById('askus_submit').style.visibility='hidden';
	}
}

function expert_submit(){
	
	if(document.forms['expertForm'].elements['name'].value=='')
	{
		alert("Please enter your name.");
		document.forms['expertForm'].elements['name'].focus();
		return false;
	}
	else if(document.forms['expertForm'].elements['city'].value=='')
	{
		alert("Please select your city.");
		document.forms['expertForm'].elements['city'].focus();
		return false;
	}
	else if(document.forms['expertForm'].elements['email'].value=='')
	{
		alert("Please enter your email.");	
		document.forms['expertForm'].elements['email'].focus();
		return false;
	}
	var str=document.forms['expertForm'].elements['email'].value;
	var emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|tv|biz))$/
	if(!emailRe.test(str)) {
	alert("Please enter valid email id.");
	document.forms['expertForm'].elements['email'].focus();
	return false;
	}
	else if(document.forms['expertForm'].elements['mobile'].value=='')
	{
		alert("Please enter your mobile.");
		document.forms['expertForm'].elements['city'].focus();
		return false;
	}
	else if(document.forms['expertForm'].elements['feedback'].value=='')
	{
		alert("Please type your Question.");	
		document.forms['expertForm'].elements['feedback'].focus();
		return false;
	}
	else
	{
	var str="?mode=ask_qs&";
	str+="name="+document.forms['expertForm'].elements['name'].value+"&";
	str+="city="+document.forms['expertForm'].elements['city'].value+"&";
	str+="email="+document.forms['expertForm'].elements['email'].value+"&";
	str+="mobile="+document.forms['expertForm'].elements['mobile'].value+"&";
	str+="feedback="+document.forms['expertForm'].elements['feedback'].value;
	
	
	xmlHttp12=GetXmlHttpObject()
	if (xmlHttp12==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var url="experts.php";
	
	url=url+str;
	//alert(url);
	xmlHttp12.onreadystatechange=expert_submit_stateChanged;
	xmlHttp12.open("GET",url,true);
	xmlHttp12.send(null);
	}
	return false;
}
function expert_submit_stateChanged() { 
	if (xmlHttp12.readyState==4)
	{ 
		document.getElementById("expert_msg").innerHTML=xmlHttp12.responseText;
		document.forms['expertForm'].reset();
		document.getElementById('ExpertSubmit').style.visibility='visible';
	}
	else
	{
		document.getElementById("expert_msg").innerHTML='<span class="blue">Please wait ....</span>';
		document.getElementById('ExpertSubmit').style.visibility='hidden';
	}
}

function product_new_result(page_id)
{
	
	
	var str="?page_id="+page_id+"&mode=showlist&";
	str+="channelName="+document.forms['article'].elements['channelName'].value+"&";
	str+="key_words="+document.forms['article'].elements['key_words'].value+"&";
	/*
	alert(document.forms['product_search'].elements['budget'].value);
	alert(document.forms['product_search'].elements['new'].checked);
	alert(document.forms['product_search'].elements['tested'].checked);
	*/
	var product_menufact=document.forms['article'].elements['brand'].value;
	
	//changeCheck();
	/*
	var flag_brand=0;
	var product_menufact=Array();
	for(i=0;i<menufact.length;i++)
	{
		if(menufact[i].checked==true){
			flag_brand=1;
			product_menufact+=menufact[i].value+",";
			document.getElementById('product_brand_all').src = imgFalse;
			document.getElementById('product_brand_all').onclick = new Function('article_brand_search(1)'); 
		}
	}
	*/
	str+="brand="+product_menufact+"&";
	xmlHttp11=GetXmlHttpObject()
	if (xmlHttp11==null)
	  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  } 
	var url="article.php";
	
	url=url+str;
	//alert(url);
	xmlHttp11.onreadystatechange=newproduct_stateChanged;
	xmlHttp11.open("GET",url,true);
	xmlHttp11.send(null);
}
function newproduct_stateChanged() 
{ 
	if (xmlHttp11.readyState==4)
	{ 
		document.getElementById("articleList").innerHTML=xmlHttp11.responseText;
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		setTimeout("leftBannerHeight()", 50);
	}
	else
	{
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "";
		}
		
	}
}




function product_price_alert_save()
{
	
	var str="?mode=saveAlert&";
	str+="category_id="+document.forms['product_price_alert'].elements['category_id'].value+"&";
	var menufact=document.forms['product_price_alert'].elements['product_menufact[]'];
		
	var product_menufact=Array();
	for(i=0;i<menufact.length;i++)
	{
		if(menufact[i].checked==true)
		product_menufact+=menufact[i].value+",";
	}
	str+="product_menufact="+product_menufact+"&";
	
	
	var id=document.forms['product_price_alert'].elements['concat_id'].value;

	var my_array=id.split(",");
	var variable=''; 
	for(j=0;j<my_array.length;j++)
	{
		var product_att='';
		var flag=0;
		var all_at=document.forms['product_price_alert'].elements['all_'+my_array[j]];
		
		if(all_at)
		{
			if(all_at.checked==true)
			{
				flag=1;	
			}
		}
			if(flag==0)
			{
				var at=document.forms['product_price_alert'].elements['att_value_'+my_array[j]+'[]'];
				if(at)
				{
					var product_att=Array();
					for(i=0;i<at.length;i++)
					{
						
						if((at[i].checked==true || at[i].selected==true) && at[i].value!='')
							product_att+=at[i].value+",";
					}
					if(product_att!='')
						variable+=my_array[j]+":"+product_att+"||";
				}
			}
				
	}
	
	str+="product_att="+variable+"&";
	var id=document.forms['product_price_alert'].elements['concat_id_range'].value;
	//alert(id);
	var product_att_rang='';
	var range_array=id.split(",");
	var variable=''; 
	for(j=0;j<range_array.length;j++)
	{
		var all_at=document.forms['product_price_alert'].elements['all_'+range_array[j]];
		if(all_at)
		{
			if(all_at.checked!=true)
			{
				var atr_min=document.forms['product_price_alert'].elements['min_range_'+range_array[j]];
				var atr_max=document.forms['product_price_alert'].elements['max_range_'+range_array[j]];
				product_att_rang+=range_array[j]+":"+atr_min.value+":"+atr_max.value+",";
			}
		}
	}
	str+="product_att_rang="+product_att_rang;
} 






function product_search_result(page_id)
{
	var warning=0;
	if(document.forms['compare_list_count'])
	{
		if(document.forms['compare_list_count'].elements['My_product_status'])
		{
			if(document.forms['compare_list_count'].elements['My_product_status'].value==1)
			{
				document.getElementById('comparisonList2').style.display='';
				MycompareListLoad();
			}
		}
	}
	
	var user_unique_code=document.forms['product_search'].elements['user_unique_code'].value;
	if(document.getElementById('searchBottomLoader'))
	{
		document.getElementById('searchBottomLoader').style.display = "";
	}
	var listing_nav =document.forms['product_search'].elements['listing_nav'].value;
	
	if(listing_nav==1)
	{
		var str="?page_id="+page_id+"&mode=listing&";
		if(document.forms['order'])
			{
			if(document.forms['order'].elements['order_by'])
				{
					if(document.forms['order'].elements['order_by'].value!='')
						str+="order_by="+document.forms['order'].elements['order_by'].value+"&";
				}
				if(document.forms['order'].elements['order_by2'])
				{	
					if(document.forms['order'].elements['order_by2'].value!='')
						str+="order_by2="+document.forms['order'].elements['order_by2'].value+"&";
				}
				if(document.forms['order'].elements['order_type'])
				{
					if(document.forms['order'].elements['order_type'].value!='')
						str+="order_type="+document.forms['order'].elements['order_type'].value+"&";
				}
			}
			var menufact=document.forms['product_search'].elements['product_menufact[]'];
			var flag_brand=0;
			var product_menufact=Array();
			for(i=0;i<menufact.length;i++)
			{
				if(menufact[i].checked==true){
					flag_brand=1;
					document.getElementById('product_brand_all').src = imgFalse;
					document.getElementById('product_brand_all').onclick = new Function('product_brand_search(1)'); 
				}
			}
			var brandAll = document.getElementById('product_brand_all').src;
			if(flag_brand==0 && brandAll.search(imgFalse)!=-1)
			{
				warning=1;
			}
	}
	else
	{
		if(user_unique_code=='')
		{
			var str="?page_id="+page_id+"&mode=showAjax&";
			
			str+="category_id="+document.forms['product_search'].elements['category_id'].value+"&";
			
			/*
			alert(document.forms['product_search'].elements['budget'].value);
			alert(document.forms['product_search'].elements['new'].checked);
			alert(document.forms['product_search'].elements['tested'].checked);
			*/
			var menufact=document.forms['product_search'].elements['product_menufact[]'];
			
	
			if(document.forms['order'])
			{
				if(document.forms['order'].elements['order_by'])
				{
					if(document.forms['order'].elements['order_by'].value!='')
						str+="order_by="+document.forms['order'].elements['order_by'].value+"&";
				}
				if(document.forms['order'].elements['order_by2'])
				{	
					if(document.forms['order'].elements['order_by2'].value!='')
						str+="order_by2="+document.forms['order'].elements['order_by2'].value+"&";
				}
				if(document.forms['order'].elements['order_type'])
				{
					if(document.forms['order'].elements['order_type'].value!='')
						str+="order_type="+document.forms['order'].elements['order_type'].value+"&";
				}
			}
			//changeCheck();
			var flag_brand=0;
			var product_menufact=Array();
			for(i=0;i<menufact.length;i++)
			{
				if(menufact[i].checked==true){
					flag_brand=1;
					product_menufact+=menufact[i].value+",";
					document.getElementById('product_brand_all').src = imgFalse;
					document.getElementById('product_brand_all').onclick = new Function('product_brand_search(1)'); 
				}
			}
		
			
			str+="product_menufact="+product_menufact+"&";
			var brandAll = document.getElementById('product_brand_all').src;
			
			if(flag_brand==0 && brandAll.search(imgFalse)!=-1)
			{
				warning=1;
			}
			var id=document.forms['product_search'].elements['concat_id'].value;
		
			var my_array=id.split(",");
			var variable=''; 
			for(j=0;j<my_array.length;j++)
			{
				var product_att='';
				var flag=0;
				var all_at=document.forms['product_search'].elements['all_'+my_array[j]];
				
				if(all_at)
				{
					if(all_at.checked==true)
					{
						flag=1;	
					}
				}
				if(flag==0)
				{
					var at=document.forms['product_search'].elements['att_value_'+my_array[j]+'[]'];
					if(at)
					{
						var product_att=Array();
						for(i=0;i<at.length;i++)
						{
							
							if((at[i].checked==true || at[i].selected==true) && at[i].value!='')
								product_att+=at[i].value+",";
						}
						if(product_att!='')
							variable+=my_array[j]+":"+product_att+"||";
					}
				}
					
		}
		
		if(document.getElementById('adv_search').style.display=="")
		{
			
			var id=document.forms['product_search'].elements['adv_concat_id'].value;
		
			var my_array=id.split(",");
			for(j=0;j<my_array.length;j++)
			{
				//var product_att='';
				var flag=0;
				var all_at=document.forms['product_search'].elements['all_'+my_array[j]];
				
				if(all_at)
				{
					if(all_at.checked==true)
					{
						flag=1;	
					}
				}
					if(flag==0)
					{
						var at=document.forms['product_search'].elements['att_value_'+my_array[j]+'[]'];
						if(at)
						{
							var product_att=Array();
							for(i=0;i<at.length;i++)
							{
								
								if((at[i].checked==true || at[i].selected==true) && at[i].value!='')
									product_att+=at[i].value+",";
							}
							if(product_att!='')
								variable+=my_array[j]+":"+product_att+"||";
						}
					}
						
			}
		}
		///////////////////////////////////////////////////////////////////////////////////////
	
		str+="product_att="+variable+"&";
		
		if(document.getElementById('adv_search').style.display=="")
		{
			var modelName=document.forms['product_search'].elements['modelName'].value;
			str+="modelName="+modelName+"&";
		}
		
		
		var id=document.forms['product_search'].elements['concat_id_range'].value;
		//alert(id);
		var product_att_rang='';
		var range_array=id.split(",");
		var variable=''; 
		for(j=0;j<range_array.length;j++)
		{
			var all_at=document.forms['product_search'].elements['all_'+range_array[j]];
			if(all_at)
			{
				if(all_at.checked!=true)
				{
					var atr_min=document.forms['product_search'].elements['min_range_'+range_array[j]];
					var atr_max=document.forms['product_search'].elements['max_range_'+range_array[j]];
					product_att_rang+=range_array[j]+":"+atr_min.value+":"+atr_max.value+",";
				}
			}
		}
		
		if(document.getElementById('adv_search').style.display=="")
		{
			var id=document.forms['product_search'].elements['adv_concat_id_range'].value;
			//alert(id);
			//var product_att_rang='';
			var range_array=id.split(",");
			//var variable=''; 
			for(j=0;j<range_array.length;j++)
			{
				var all_at=document.forms['product_search'].elements['all_'+range_array[j]];
				if(all_at)
				{
					if(all_at.checked!=true)
					{
						var atr_min=document.forms['product_search'].elements['min_range_'+range_array[j]];
						var atr_max=document.forms['product_search'].elements['max_range_'+range_array[j]];
						product_att_rang+=range_array[j]+":"+atr_min.value+":"+atr_max.value+",";
					}
				}
			}
		}
		
		str+="product_att_rang="+product_att_rang;
		}
		else
		{	
			
			var str="?page_id="+page_id+"&mode=showSearchguruResult&";
			
			if(document.forms['product_search'].elements['nav'])
				{
					if(document.forms['product_search'].elements['nav'].value!='')
					str+="nav="+document.forms['product_search'].elements['nav'].value+"&";
				}
			
			
			if(document.forms['order'])
			{
			if(document.forms['order'].elements['order_by'])
				{
					if(document.forms['order'].elements['order_by'].value!='')
						str+="order_by="+document.forms['order'].elements['order_by'].value+"&";
				}
				if(document.forms['order'].elements['order_by2'])
				{	
					if(document.forms['order'].elements['order_by2'].value!='')
						str+="order_by2="+document.forms['order'].elements['order_by2'].value+"&";
				}
				if(document.forms['order'].elements['order_type'])
				{
					if(document.forms['order'].elements['order_type'].value!='')
						str+="order_type="+document.forms['order'].elements['order_type'].value+"&";
				}
			}
			str+="user_unique_code="+user_unique_code;
		}
	}
	//alert(str);
	
	
	if(warning==1)
	{
		/////////////////////////////////////////////////////////////////////////////////////////
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		if(document.getElementById('searchLoader'))
		{
			document.getElementById('searchLoader').style.display = "none";
		}
		if(document.getElementById('comparisonList').style.display == "none" && document.getElementById('comparisonList2').style.display != "none")
		{
			document.getElementById('comparisonList').style.display = "";
		}
		
		document.getElementById("searchProductList").innerHTML = '<div class="vendorPageList"><span class="breadcomLeft">Sorry! No product(s) found</span><span class="breadcomRight"></span></div>';
		if(document.getElementById("countProductSearch"))
		{
			document.getElementById("countProductSearch").style.display='';
			document.getElementById("countProductSearch").innerHTML="<strong>No</strong>"+document.forms['product_search'].elements['categoryNameFetch'].value+"(s) Found";
			document.getElementById("instProductSearch").innerHTML = "";
		}
		setTimeout("leftBannerHeight()", 10);
		//alert ("Please select atleast one brand");
		//return;
	}
	else
	{
		xmlHttp1=GetXmlHttpObject();
		if (xmlHttp1==null)
		{
			  alert ("Your browser does not support AJAX!");
			  return;
		} 
		var url="product_search.php";
		url=url+str;
		//alert(url);
		xmlHttp1.onreadystatechange=autocheck_stateChanged;
		xmlHttp1.open("GET",url,true);
		xmlHttp1.send(null);
	}

} 
function autocheck_stateChanged() 
{ 
	
	if (xmlHttp1.readyState==4)
	{ 
		
		index_chg();
		/////////////////////////////////////////////////////////////////////////////////////////
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		if(document.getElementById('searchLoader'))
		{
			document.getElementById('searchLoader').style.display = "none";
		}
		if(document.getElementById('comparisonList').style.display == "none" && document.getElementById('comparisonList2').style.display != "none")
		{
			document.getElementById('comparisonList').style.display = "";
		}
		document.getElementById("searchProductList").innerHTML=xmlHttp1.responseText;
		
		//alert(document.getElementById("searchProductList").innerHTML);
		if(document.getElementById("countProductSearch"))
		{
			document.getElementById("countProductSearch").style.display='';
			document.getElementById("countProductSearch").innerHTML="<strong>"+document.forms['product_search_results'].elements['total_product'].value+"</strong>"+document.forms['product_search'].elements['categoryNameFetch'].value+"(s) Found";
			if(document.forms['product_search_results'].elements['total_product'].value>0)
			document.getElementById("instProductSearch").innerHTML="Scroll down to view results";
			else
			document.getElementById("instProductSearch").innerHTML="";
		}
		/////////////////////////////////////////////////////////////////////////////////////////
		setTimeout("leftBannerHeight()", 50);
		
	}
	else
	{
		if(document.getElementById('searchLoader'))
		{
			/*if(document.getElementById('adv_search'))
			{						   
				if(document.getElementById('adv_search').style.display != "none")
				{
					document.getElementById('searchLoader').style.height = "528px";	
				}
				else
				{
					document.getElementById('searchLoader').style.height = "310px";	
				}
			}
			else
			{
				if(document.getElementById('searchLoader'))
					document.getElementById('searchLoader').style.height = "310px";	
			}*/
			
			if(document.getElementById('searchLoader') && document.getElementById('leftPanel_innerSerach'))
			{
				
				document.getElementById('searchLoader').style.height = document.getElementById('leftPanel_innerSerach').offsetHeight-10 +"px";
			}
			
			
			if(document.getElementById('leftPanel_innerSerach'))
			{
				var obj = document.getElementById('leftPanel_innerSerach');
				var posX = parseInt(findPositionX(obj));
				document.getElementById('searchLoader').style.left = (posX)+ "px";
				document.getElementById('searchLoader').style.display = "";
				
			}
			
		}
		//document.getElementById("searchProductList").innerHTML='<img src="admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait"/>';	
	}
}

function product_home_search_result(page_id)
{
	var warning=0;
	var user_unique_code=document.forms['home_search'].elements['user_unique_code'].value;
	if(document.getElementById('searchBottomLoader'))
	{
		document.getElementById('searchBottomLoader').style.display = "";
	}
	var listing_nav =document.forms['home_search'].elements['listing_nav'].value;
	
	var str="?page_id="+page_id+"&mode=showAjax&";
	
	str+="category_id="+document.forms['home_search'].elements['category_id'].value+"&";
	
	/*
	alert(document.forms['home_search'].elements['budget'].value);
	alert(document.forms['home_search'].elements['new'].checked);
	alert(document.forms['home_search'].elements['tested'].checked);
	*/
	var menufact=document.forms['home_search'].elements['product_menufact[]'];
	

	//changeCheck();
	var flag_brand=0;
	var product_menufact=Array();
	for(i=0;i<menufact.length;i++)
	{
		if(menufact[i].checked==true){
			flag_brand=1;
			product_menufact+=menufact[i].value+",";
			document.getElementById('product_brand_all').src = imgFalse;
			document.getElementById('product_brand_all').onclick = new Function('product_brand_search(1)'); 
		}
	}

	
	str+="product_menufact="+product_menufact+"&";
	var brandAll = document.getElementById('product_brand_all').src;
	
	if(flag_brand==0 && brandAll.search(imgFalse)!=-1)
	{
		warning=1;
	}
	var id=document.forms['home_search'].elements['concat_id'].value;

	var my_array=id.split(",");
	var variable=''; 
	for(j=0;j<my_array.length;j++)
	{
		var product_att='';
		var flag=0;
		var all_at=document.forms['home_search'].elements['all_'+my_array[j]];
		
		if(all_at)
		{
			if(all_at.checked==true)
			{
				flag=1;	
			}
		}
		if(flag==0)
		{
			var at=document.forms['home_search'].elements['att_value_'+my_array[j]+'[]'];
			if(at)
			{
				var product_att=Array();
				for(i=0;i<at.length;i++)
				{
					
					if((at[i].checked==true || at[i].selected==true) && at[i].value!='')
						product_att+=at[i].value+",";
				}
				if(product_att!='')
					variable+=my_array[j]+":"+product_att+"||";
			}
		}
					
	}
		
		
	///////////////////////////////////////////////////////////////////////////////////////

	str+="product_att="+variable+"&";
	
	
	
	
	var id=document.forms['home_search'].elements['concat_id_range'].value;
	//alert(id);
	var product_att_rang='';
	var range_array=id.split(",");
	var variable=''; 
	for(j=0;j<range_array.length;j++)
	{
		var all_at=document.forms['home_search'].elements['all_'+range_array[j]];
		if(all_at)
		{
			if(all_at.checked!=true)
			{
				var atr_min=document.forms['home_search'].elements['min_range_'+range_array[j]];
				var atr_max=document.forms['home_search'].elements['max_range_'+range_array[j]];
				product_att_rang+=range_array[j]+":"+atr_min.value+":"+atr_max.value+",";
			}
		}
	}
	
	str+="product_att_rang="+product_att_rang;
	//alert(str);
	
	if(warning==1)
	{
		/////////////////////////////////////////////////////////////////////////////////////////
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		if(document.getElementById('searchLoader'))
		{
			document.getElementById('searchLoader').style.display = "none";
		}
		
		
		document.getElementById("searchProductList").innerHTML = '<span id="searchProductList"><span class="peel"><a href="survey.php?mode=survey" title="Use '+document.forms['home_search'].elements['categoryNameFetch'].value+' guru to find '+document.forms['home_search'].elements['categoryNameFetch'].value+' you need">Use <strong>'+document.forms['home_search'].elements['categoryNameFetch'].value+' guru</strong> <br />to find '+document.forms['home_search'].elements['categoryNameFetch'].value+' <br />you need</a></span> <span class="badge"><strong>0</strong> Result Found<br>Try Again</span>';
		//alert ("Please select atleast one brand");
		//return;
	}
	else
	{
		xmlHttp1=GetXmlHttpObject();
		if (xmlHttp1==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		} 
		var url="index.php";
		url=url+str;
		//alert(url);
		xmlHttp1.onreadystatechange=homeSearch_stateChanged;
		xmlHttp1.open("GET",url,true);
		xmlHttp1.send(null);
	}
	

} 
function homeSearch_stateChanged() 
{
	if (xmlHttp1.readyState==4)
	{ 
		index_chg();
		/////////////////////////////////////////////////////////////////////////////////////////
		if(document.getElementById('searchBottomLoader'))
		{
			document.getElementById('searchBottomLoader').style.display = "none";
		}
		if(document.getElementById('searchLoader1'))
		{
			document.getElementById('searchLoader1').style.display = "none";
		}
		document.getElementById("searchProductList").innerHTML=xmlHttp1.responseText;
		
		/////////////////////////////////////////////////////////////////////////////////////////
	}
	else
	{
		if(document.getElementById('searchLoader1'))
		{
			document.getElementById('searchLoader1').style.display = "";
		}
	
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function compare_list(obj_name,category,id,status)
{
	if(document.getElementById('searchBottomLoader'))
	{
		document.getElementById('searchBottomLoader').style.display = "";
	}
	if(status=='')
	{
		var obj=document.forms['product_search_results'].elements[obj_name];
		if(obj.checked==true){
			var mode='delete_compare'; 
			 obj.checked = ''; 
        	 document.getElementById('myImage_'+obj_name).src=imgFalse; 
			 /////////////////////////////for compare list//////////////////////////////
			 var val=document.forms['compare_list_count'].elements['my_compare_list'].value;
				var my_array=val.split(",");
				var variable=''; 
				document.forms['compare_list_count'].elements['my_compare_list'].value='';
				for(j=0;j<my_array.length;j++)
					{
						if(my_array[j]!='')
						{
							if(my_array[j]!=id)
							{
								document.forms['compare_list_count'].elements['my_compare_list'].value += my_array[j]+',';
							}
						}
					}
			 
			 
			 /////////////////////////////for compare list//////////////////////////////
		}
		else{
			////////////////////////////////for compare list////////////////////////////
			var val=document.forms['compare_list_count'].elements['my_compare_list'].value;
			var my_array=val.split(",");
			var flag=0; 
			for(j=0;j<my_array.length;j++)
				{
					if(my_array[j]!='')
					{
						if(my_array[j]==id)
						{
							flag=1;
						}
					}
				}
	
			if(flag==0)
				document.forms['compare_list_count'].elements['my_compare_list'].value += id+',';
			///////////////////////////////////for compare list/////////////////////////
			var mode='add_compare'; 
			obj.checked = true; 
        	document.getElementById('myImage_'+obj_name).src=imgTrue; 
		}
	}
	else
	{
		///////////////////////////////////for compare list/////////////////////////
		 var val=document.forms['compare_list_count'].elements['my_compare_list'].value;
				var my_array=val.split(",");
				var variable=''; 
				document.forms['compare_list_count'].elements['my_compare_list'].value='';
				for(j=0;j<my_array.length;j++)
					{
						if(my_array[j]!='')
						{
							if(my_array[j]!=id)
							{
								document.forms['compare_list_count'].elements['my_compare_list'].value += my_array[j]+',';
							}
						}
					}
			 
		///////////////////////////////////for compare list/////////////////////////
		var mode='delete_compare'; 
		if(document.forms['product_search_results'])
		{
			if(document.forms['product_search_results'].elements['chk'+id])
			{
				document.forms['product_search_results'].elements['chk'+id].checked=false;
				document.getElementById('myImage_'+document.forms['product_search_results'].elements['chk'+id].name).src=imgFalse; 
				
			}
		}
	}
compare_list_1(mode,category,id,status,mode);
}

function compare_list_1(mode,category,id,status,mode)
{
	
	xmlHttp3=GetXmlHttpObject()
	if (xmlHttp3==null)
	  {
		 alert ("Your browser does not support AJAX!");
	 	 return;
	  } 
	var url="product_search.php?mode="+mode+"&category="+category+"&product_id="+id+"&name=1";
	//alert(url);
	xmlHttp3.onreadystatechange=compare_list_stateChanged;
	xmlHttp3.open("GET",url,true);
	xmlHttp3.send(null);

	compare_list_2(mode,category,id,status,mode);

} 
function compare_list_stateChanged() 
{ 
	if (xmlHttp3.readyState==4)
	{ 
		if(xmlHttp3.responseText!='')
		{
			//alert(xmlHttp3.responseText);
			if(xmlHttp3.responseText == 'none')
			{
				document.getElementById('comparisonList').style.display = "none";
			}
			else
			{
				if(document.forms['product_search_results'])
					{
						if(document.forms['product_search_results'].elements['page_id'])
						{
							if(document.getElementById('comparisonList').style.display == "none")
							{
								document.getElementById('comparisonList').style.display = "";
								
							}
							
						}
					}
				document.getElementById("comparisonProducts").innerHTML=xmlHttp3.responseText;
				MycompareListLoad();
				
			}
		 }
	}
	else
	{
		//document.getElementById("searchProductList").innerHTML='<img src="admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait"/>';	
	}
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



function compare_list_2(mode,category,id,status,mode)
{
	xmlHttp31=GetXmlHttpObject()
	if (xmlHttp31==null)
	  {
		  alert ("Your browser does not support AJAX!");
	 	 return;
	  } 
	var url="product_search.php?mode="+mode+"&category="+category+"&product_id="+id+"&name=2";
	//alert(url);
	xmlHttp31.onreadystatechange=compare_list_stateChanged2;
	xmlHttp31.open("GET",url,true);
	xmlHttp31.send(null);
	
/*if(document.forms['product_search_results'].elements['page_id'])
	{
		page_id = document.forms['product_search_results'].elements['page_id'].value;
		if(mode=='delete_compare')
		{product_search_result(page_id);}	
	}*/
} 



function compare_list_stateChanged2() 
{ 
	if (xmlHttp31.readyState==4)
	{ 
		if(xmlHttp31.responseText!='')
		{
			if(document.getElementById('searchBottomLoader'))
			{
				document.getElementById('searchBottomLoader').style.display = "none";
			}
			if(xmlHttp31.responseText == 'none')
			{
				document.getElementById('comparisonList2').style.display = "none";
			}
			else
			{
				if(document.forms['product_search_results'])
				{
					if(document.forms['product_search_results'].elements['page_id'])
					{
						if(document.getElementById('comparisonList2').style.display == "none")
						{
							document.getElementById('comparisonList2').style.display = "";
						}
						
					}
				}
				document.getElementById("comparisonProducts2").innerHTML=xmlHttp31.responseText;
				MycompareListLoad();
			}
		}
	}
	else
	{
		//document.getElementById("searchProductList").innerHTML='<img src="admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait"/>';	
	}
}




////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



function delete_compare_Details(category,id,my_compare_list)
	{
	 var mode='delete_compare_details'; 

		var val=my_compare_list;
		var my_array=val.split(",");
		if(my_array.length==3)
		{
			alert("Sorry!! You can not see the compare list less than 2 products at a time.");
		}
		else{
			
			my_compare_list ='';
			for(j=0;j<my_array.length;j++)
				{
					if(my_array[j]!='')
					{
						if(my_array[j]!=id)
						{
							my_compare_list += my_array[j]+',';
						}
					}
				}
	
		
	
		xmlHttp4=GetXmlHttpObject()
		if (xmlHttp4==null)
		  {
			  alert ("Your browser does not support AJAX!");
			 return;
		  } 
		var url="product_search.php?mode="+mode+"&category_id="+category+"&product_id="+id+"&my_compare_list="+my_compare_list;
		
		xmlHttp4.onreadystatechange=delete_compare_Details_stateChanged;
		xmlHttp4.open("GET",url,true);
		xmlHttp4.send(null);
		//compare_Details(category,my_compare_list);	
		}
} 
function delete_compare_Details_stateChanged() 
{ 
	if (xmlHttp4.readyState==4)
	{ 
		if(xmlHttp4.responseText=='false')
			alert("Sorry!! You can not see the compare list less than 2 products at a time.");
		else
			{
				document.getElementById("compare_details_list").innerHTML=xmlHttp4.responseText;
				init();
				document.getElementById('rightPannel').style.height = (parseInt(document.getElementById('leftPannel').offsetHeight) +20) + 'px';
				CSBfleXcroll('rightPannel');
			}
	}
	else
	{
		//document.getElementById("searchProductList").innerHTML='<img src="admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait"/>';	
	}
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
 
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function findPositionX(obj){
	var curleft = 0;
	if(obj.offsetParent)
		while(1){
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

