// JavaScript Document
function create_object(){
	if(window.XMLHttpRequest){
		var obj	=	new XMLHttpRequest();
	}else if(window.ActiveXObject){
		var obj	=	new ActiveXObject("Microsoft.XMLHTTP");
	}
	return obj;
}
function  send_request_tocheck(prod_id){
	htp21	=	create_object();
	var color_id	=	document.getElementById('color_id').value;
	var size_id	=	document.getElementById('size_id').value;
	var qty		=	document.getElementById('qty').value;
	url		=	"ajax-response.php?prod_id="+prod_id+"&qty="+qty+"&color_id="+color_id+"&size_id="+size_id;
	htp21.open('get',url,true);
	htp21.onreadystatechange	=	function handle_response(){
										if(htp21.readyState==4){
											txt			=	htp21.responseText;
											if(txt!=""){
												alert(txt);
												//document.getElementById('delete_make').innerHTML	=	"";
											}else{
												if(validate(document.formx)){ 
													document.formx.submit(); 
												}else{
													return false;
												}				
											}
										}
									};
	htp21.send(null);	
}

function  send_request_to_check(prod_id,color_id,size_id,qty){
	htp22	=	create_object();
	url		=	"ajax-response.php?prod_id="+prod_id+"&qty="+qty+"&color_id="+color_id+"&size_id="+size_id;
	htp22.open('get',url,true);
	htp22.onreadystatechange	=	function handle_response1(){
									if(htp22.readyState==4){
										txt			=	htp22.responseText;
										if(txt!=""){
											alert(txt);
											document.getElementById('flag').value	=	"0";							
										}else{
											document.getElementById('flag').value	=	"1";
										}
									}
								};
	htp22.send(null);	
}


function send_request(id,t,sid){
	var x=t;
	if(sid=='' || sid==0){
		url	=	"ajax-response.php?action=state&id="+id+"&t="+t;	
	}else{
		url	=	"ajax-response.php?action=state&id="+id+"&sid="+sid+"&t="+t;	
	}
	htp23	=	create_object();
	htp23.open('get',url,false);
	htp23.onreadystatechange	=	function handle_response(){
										if(htp23.readyState==4){
											var txt	=	htp23.responseText;
											if(txt!=""){
												document.getElementById('div_state'+x).innerHTML	=	txt;
											}
										}
									};
	htp23.send(null);
}


function getSwatchPrice(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp3	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp3	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t3=type;
		url3	=	"ajax-response.php?swatch="+t3+"&pid="+pid+"&did="+cid;	
		htp3.open('get',url3,true);
		htp3.onreadystatechange	=	function handle_response3(){
										if(htp3.readyState==4){
											var txt3	=	htp3.responseText.split("^~^");
											if(txt3[0]!=" "){
												//document.getElementById('div_'+t3).innerHTML	=	txt3[0];
											}
											document.getElementById('tb_'+t3.toLowerCase()+'_image').innerHTML=txt3[1];
										}
									};
		htp3.send(null);
	}
}

function getSwatchPrice23(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp4	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp4	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t4=type;
		url4	=	"ajax-response.php?swatch="+t4+"&pid="+pid+"&cid="+cid;
		htp4.open('get',url4,true);
		htp4.onreadystatechange	=	function handle_response4(){
										if(htp4.readyState==4){
											var txt4	=	htp4.responseText.split("^~^");
											if(txt4[0]!=" "){
												//document.getElementById('div_'+t4).innerHTML	=	txt4[0];
											}
											document.getElementById('tb_'+t4.toLowerCase()+'_image').innerHTML=txt4[1];
										}
									};
		htp4.send(null);
	}
}
function getBoleroPrice(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp5	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp5	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t5=type;
		url5	=	"ajax-response.php?swatch="+t5+"&pid="+pid+"&bid="+cid;
		htp5.open('get',url5,true);
		htp5.onreadystatechange	=	function handle_response5(){
										if(htp5.readyState==4){
											var txt5	=	htp5.responseText.split("^~^");
											if(txt5[0]!=" "){
												//document.getElementById('div_'+t5).innerHTML	=	txt5[0];
											}
											document.getElementById('tb_'+t5.toLowerCase()+'_image').innerHTML=txt5[1];
										}
									};
		htp5.send(null);
	}
}
function getCravatPrice(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp6	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp6	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t6=type;
		url6	=	"ajax-response.php?swatch="+t6+"&pid="+pid+"&ctid="+cid;
		htp6.open('get',url6,true);
		htp6.onreadystatechange	=	function handle_response6(){
										if(htp6.readyState==4){
											var txt6	=	htp6.responseText.split("^~^");
											if(txt6[0]!=" "){
												//document.getElementById('div_'+t6).innerHTML	=	txt6[0];
											}
											document.getElementById('tb_'+t6.toLowerCase()+'_image').innerHTML=txt6[1];
										}
									};
		htp6.send(null);
	}
}
function getHchiefPrice(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp7	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp7	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t7=type;
		url7	=	"ajax-response.php?swatch="+t7+"&pid="+pid+"&hid="+cid;
		htp7.open('get',url7,true);
		htp7.onreadystatechange	=	function handle_response7(){
										if(htp7.readyState==4){
											var txt7	=	htp7.responseText.split("^~^");
											if(txt7[0]!=" "){
												//document.getElementById('div_'+t7).innerHTML	=	txt7[0];
											}
											document.getElementById('tb_'+t7.toLowerCase()+'_image').innerHTML=txt7[1];
										}
									};
		htp7.send(null);
	}
}
function changeImageZoom(imgOb){
	if(window.XMLHttpRequest){
		var ihtp4	=	new XMLHttpRequest();
	}else if(window.ActiveXObject){
		var ihtp4	=	new ActiveXObject("Microsoft.XMLHTTP");
	}
	iurl4	=	"ajax-response.php?chimg="+imgOb;
	ihtp4.open('get',iurl4,true);
	ihtp4.onreadystatechange	=	function ihandle_response4(){
										if(ihtp4.readyState==4){
											var itxt4	=	ihtp4.responseText.split("^~^");;
											document.getElementById('prod_bimg').innerHTML=itxt4[0];
											document.getElementById('productImage22').value=itxt4[1];
										}
									};
	ihtp4.send(null);
}

function alterImageColor(clid,pid){
	if(window.XMLHttpRequest){
		var ihtp5	=	new XMLHttpRequest();
	}else if(window.ActiveXObject){
		var ihtp5	=	new ActiveXObject("Microsoft.XMLHTTP");
	}
	iurl5	=	"ajax-response.php?pid2="+pid+"&clid2="+clid;
	ihtp5.open('get',iurl5,true);
	ihtp5.onreadystatechange	=	function ihandle_response5(){
										if(ihtp5.readyState==4){
											var itxt5	=	ihtp5.responseText.split("^~^");
											document.getElementById('prod_bimg').innerHTML=itxt5[0];
											document.getElementById('myeximages').innerHTML=itxt5[1];
											document.getElementById('productImage22').value=itxt5[4];
											if(location.toString().indexOf("wholesale-product.php")==-1){
												document.getElementById('act_st_price').innerHTML=itxt5[2];
												document.getElementById('act_disc_price').innerHTML=itxt5[3];
											}
										}
									};
	ihtp5.send(null);	
}

/* Added on 30th Aug 2010 */
function getSwatchPriceWS(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp3	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp3	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t3=type;
		url3	=	"ajax-wresponse.php?swatch="+t3+"&pid="+pid+"&did="+cid;	
		htp3.open('get',url3,true);
		htp3.onreadystatechange	=	function handle_response3(){
										if(htp3.readyState==4){
											
											var txt3	=	htp3.responseText.split("^~^");
											if(txt3[0]!=" "){
												//document.getElementById('div_'+t3).innerHTML	=	txt3[0];
											}
											document.getElementById('tb_'+t3.toLowerCase()+'_image').innerHTML=txt3[1];
										}
									};
		htp3.send(null);
	}
}

function getSwatchPriceWS23(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp4	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp4	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t4=type;
		url4	=	"ajax-wresponse.php?swatch="+t4+"&pid="+pid+"&cid="+cid;
		htp4.open('get',url4,true);
		htp4.onreadystatechange	=	function handle_response4(){
										if(htp4.readyState==4){
											var txt4	=	htp4.responseText.split("^~^");
											if(txt4[0]!=" "){
												//document.getElementById('div_'+t4).innerHTML	=	txt4[0];
											}
											document.getElementById('tb_'+t4.toLowerCase()+'_image').innerHTML=txt4[1];
										}
									};
		htp4.send(null);
	}
}
function getBoleroPriceWS(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp5	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp5	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t5=type;
		url5	=	"ajax-wresponse.php?swatch="+t5+"&pid="+pid+"&bid="+cid;
		htp5.open('get',url5,true);
		htp5.onreadystatechange	=	function handle_response5(){
										if(htp5.readyState==4){
											var txt5	=	htp5.responseText.split("^~^");
											if(txt5[0]!=" "){
												//document.getElementById('div_'+t5).innerHTML	=	txt5[0];
											}
											document.getElementById('tb_'+t5.toLowerCase()+'_image').innerHTML=txt5[1];
										}
									};
		htp5.send(null);
	}
}
function getCravatPriceWS(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp6	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp6	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t6=type;
		url6	=	"ajax-wresponse.php?swatch="+t6+"&pid="+pid+"&ctid="+cid;
		htp6.open('get',url6,true);
		htp6.onreadystatechange	=	function handle_response6(){
										if(htp6.readyState==4){
											var txt6	=	htp6.responseText.split("^~^");
											if(txt6[0]!=" "){
												//document.getElementById('div_'+t6).innerHTML	=	txt6[0];
											}
											document.getElementById('tb_'+t6.toLowerCase()+'_image').innerHTML=txt6[1];
										}
									};
		htp6.send(null);
	}
}
function getHchiefPriceWS(pid,cid,type){
	if(cid!='' && pid!=''){
		if(window.XMLHttpRequest){
			var htp7	=	new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var htp7	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		var t7=type;
		url7	=	"ajax-wresponse.php?swatch="+t7+"&pid="+pid+"&hid="+cid;
		htp7.open('get',url7,true);
		htp7.onreadystatechange	=	function handle_response7(){
										if(htp7.readyState==4){
											var txt7	=	htp7.responseText.split("^~^");
											if(txt7[0]!=" "){
												//document.getElementById('div_'+t7).innerHTML	=	txt7[0];
											}
											document.getElementById('tb_'+t7.toLowerCase()+'_image').innerHTML=txt7[1];
										}
									};
		htp7.send(null);
	}
}


