function Setzipcode(zipcode)
{
 	 if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChangeSetzipcode;

        req.open('GET', zipcode, true);

		//alert(url4);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(zipcode);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChangeSetzipcode;

            req.open('GET', zipcode, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(zipcode);

        }

    }

	

}

function DoCallback(data)
{
   // branch for native XMLHttpRequest object
   if (window.XMLHttpRequest) {
       req = new XMLHttpRequest();
       req.onreadystatechange = processReqChange;
       req.open('GET', url, true);
       //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
       req.send(data);
      // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject('Microsoft.XMLHTTP')
        if (req) {
            req.onreadystatechange = processReqChange;
            //alert('DoCallback() called');
            req.open('GET', url, true);
            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            req.send(data);
            //alert('Request sent');
        }
    }
}

function DoCallback2(data)

{

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChangeA;

        req.open('GET', 'emptyCart.php', true);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(data);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChangeA;

            req.open('GET', 'emptyCart.php', true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(data);

        }

    }

}



function DoCallback3(data)

{

    //alert('DoCallback() called');

	// branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange2;

        req.open('GET', 'addToCart.php', true);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

		//alert('DoCallback() called');

        req.send(data);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange2;

            req.open('GET', 'addToCart.php', true);

			//alert('DoCallback() called');

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(data);

        }

    }

}









function DoCallback4(url4)

{   //alert(url4);

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange4;

        req.open('GET', url4, true);

		//alert(url4);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url4);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange4;

            req.open('GET', url4, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url4);

        }

    }

}





function DoCallback_all(url)

{   //alert(url4);

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange_all;

        req.open('GET', url, true);

		//alert(url4);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange_all;

            req.open('GET', url, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url);

        }

    }

}







function DoCallback5(url5)

{   //alert(url5);

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange5;

        req.open('GET', url5, true);

		//alert(url5);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url5);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange5;

            req.open('GET', url5, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url5);

        }

    }

}



function DoCallback6(url6)

{   //alert(url6);

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange6;

        req.open('GET', url6, true);

		//alert(url6);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url6);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange6;

            req.open('GET', url6, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url6);

        }

    }

}



function DoCallback_subcat(url)

{

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange_subcat;

        req.open('GET', url, true);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange_subcat;

            //alert('DoCallback() called');

            req.open('GET', url, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url);

            //alert('Request sent');

        }

    }

}



function DoCallback_subcat_1(url)

{

    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {

        req = new XMLHttpRequest();

        req.onreadystatechange = processReqChange_subcat_1;

        req.open('GET', url, true);

        //req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

        req.send(url);

    // branch for IE/Windows ActiveX version

    } else if (window.ActiveXObject) {

        req = new ActiveXObject('Microsoft.XMLHTTP')

        if (req) {

            req.onreadystatechange = processReqChange_subcat_1;

            //alert('DoCallback() called');

            req.open('GET', url, true);

            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

            req.send(url);

            //alert('Request sent');

        }

    }

}







function processReqChange_subcat() {

	 if(req.readyState == 1)

		{

		document.getElementById("sub_cat").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(Subcatdiv(req.responseText)); 

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}





function processReqChange_subcat_1() {

	 if(req.readyState == 1)

		{

		document.getElementById("sub_cat_1").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(Subcatdiv_1(req.responseText)); 

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}

function processReqChange() {

	 if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'images/loadinged'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           if (what)

            eval(what);

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}



function processReqChangeA() {

	 if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(updateShoppingCartDiv2('')); 

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}

function processReqChange4() {

	 if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

			//alert(req.responseText);

           eval(updateShoppingCartDiv2(req.responseText)); 

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}









function processReqChangeSetzipcode() {

    if (req.readyState == 4) {
 
         if (req.status == 200) {
			   //alert(req.responseText);
		 	   eval(updatezip(req.responseText)); 
		       //alert("ok");
            } else {
            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}





function processReqChange5() {

	 if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(updateShoppingCartDiv2(req.responseText)); 

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}

function processReqChange6() {

	 if(req.readyState == 1)

		{

		document.getElementById("pricelist").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(getupdateprice_zip(req.responseText)); 

		   //readxml();

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}





function processReqChange_all() {

    if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}



    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

           eval(updateShoppingCartDiv2(req.responseText)); 

		   //readxml();

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}



function processReqChange2() {

	 if(req.readyState == 1)

		{

		document.getElementById("shoppingCartDiv").innerHTML = '<img src="images/loading.gif" border=0>';

		}

    // only if req shows 'loaded'

    if (req.readyState == 4) {

        // only if 'OK'

        if (req.status == 200) {

            eval(updateShoppingCartDiv2(req.responseText));

        } else {

            //alert('There was a problem retrieving the XML data: ' + req.responseText);

        }

    }

}

// for reset session
  var xmlHttp
  var prn
  var ad_id1
function reset_session1(val)
{ 
       prn = val 
       xmlHttp=GetXmlHttpObject()

		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		xmlHttp.onreadystatechange=reset_session2
		xmlHttp.open("GET",'Thankyou1.php',true)
		xmlHttp.send(null)
} 

function reset_session2()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	   //location.href="store_specials.html";
	   document.getElementById('thank').innerHTML = xmlHttp.responseText ;
	   document.getElementById('site_logo').innerHTML = '';
	   document.getElementById('print').innerHTML = '';
	   if( prn == 1 )
	   {
		   // alert(prn); 
		    document.getElementById('prn').value = '1';
	   }
      // document.getElementById('print').innerHTML = '<b>Do you want to leave the feedback <a href="#1" onclick="scroll(0,10);">YES</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="self.close();">NO</a></b>';
	} 
						
}
function get_specials()
{ 
     xmlHttp=GetXmlHttpObject()

	 if (xmlHttp==null)
	 {
		alert ("Browser does not support HTTP Request")
		return
	 } 
	 var store = document.getElementById('store').value
	 var url = 'store_specials_ajax.php?store='+store
	 document.getElementById('specials').innerHTML = '<h3><b>We are searching for your specials,Please wait....</b></h3>'	 
	 xmlHttp.onreadystatechange=get_specials_resp
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
} 

function get_specials_resp()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	   document.getElementById('specials').innerHTML = xmlHttp.responseText ;
    } 
						
}

function GetSubCats(cat)
{ 
     xmlHttp=GetXmlHttpObject()
	 if (xmlHttp==null)
	 {
		alert ("Browser does not support HTTP Request")
		return
	 } 
	 var url = 'subcategory.html?cat='+cat
	 document.getElementById('wrapper1').innerHTML = '<h3><b>Please wait....</b></h3>'	 
	 xmlHttp.onreadystatechange=get_cat_resp
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
} 

function get_cat_resp()
{
	
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	   document.getElementById('wrapper1').innerHTML = xmlHttp.responseText;
    } 
						
}


// get period

function get_period(ar_id)
{
	 xmlHttp=GetXmlHttpObject()
     if (xmlHttp==null)
	 {
		alert ("Browser does not support HTTP Request")
		return
	 } 
	 var url = 'getPeriod.php?ar_id='+ar_id;
	//document.getElementById('wrapper1').innerHTML = '<h3><b>Please wait....</b></h3>'	 
	// xmlHttp.onreadystatechange=get_perd
	xmlHttp.onreadystatechange=function () {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			   document.getElementById('pdiv').innerHTML = xmlHttp.responseText 
		}
	 };	
	 xmlHttp.open("GET",url,true)
	 xmlHttp.send(null)
	
}

function get_perd()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	    document.getElementById('pdiv').innerHTML = xmlHttp.responseText ;
    } 
						
}

//View the product detail
function view_detail(id)
{
	//window.scroll(0,-550);
	var url = 'store_listing.php';
	var data = 'pid='+id;
	Popup.showModal("div_id_pop_up",null,null,"{'screenColor':'#000000','screenOpacity':.90}",600);
	document.getElementById('div_id_pop_up').innerHTML = '<div align="center"><img style="margin-top:20px;" src="images/ajax_loader.gif" align="center" alt="loader-image" style="text-align:center; opacity:0.7; z-index:10; position:absolute; top:50%; width:100%; height:100%;"/></div>';
	/*var myAjax = new Ajax.Updater(
	'div_id_pop_up', 
	url, 
	{
		method: 'get', 
		evalScripts:true,
		parameters: data
	});
	*/
	var myAjax = new Ajax.Request(
		url, 
		{
			method:'get', 
			parameters:data,
			onSuccess: addSuccess
		});	
	//window.location.hash = 'summary';
	//window.scroll(800,0);
}
function addSuccess( originalRequest )
{
	var result = originalRequest.responseText;
	$('div_id_pop_up').innerHTML = result;
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
