// Ajax javascript for buycard page loaderObj = new Image(); loaderObj.src='images/loader.gif'; // ajax var urlgetcard = "ajaxactions/getcards.php"; function handleHttpResponse() { if (http.readyState == 4) { if(http.status == 200) { var results = http.responseText; document.getElementById('searchresult').innerHTML = results; document.getElementById('dispbutton').innerHTML = ''; } } } function handleHttpResponse3() { if (http.readyState == 4) { if(http.status == 200) { var results = http.responseText; document.getElementById('searchresult').innerHTML = results; document.getElementById('contentpart').style.display = 'none'; } } } function search_cards( search_txt ) { var para='?search_txt='+search_txt; http.open("GET", urlgetcard+para, true); http.onreadystatechange = handleHttpResponse3; http.send(null); } function browse_cards( browse_id ) { var para='?browse_id='+browse_id; http.open("GET", urlgetcard+para, true); http.onreadystatechange = handleHttpResponse3; http.send(null); } function request_cards() { document.getElementById('dispbutton').innerHTML = ''; document.getElementById('searchresult').innerHTML = ''; var merchant = document.getElementById('merchant').value; var cardworth = document.getElementById('cardworth').value; var para='?merchant='+merchant+'&cardworth='+cardworth; http.open("GET", urlgetcard+para, true); http.onreadystatechange = handleHttpResponse; http.send(null); } function getHTTPObject() { var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlhttp){ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlhttp; } var http = getHTTPObject(); ////////////////////////////////////////////////////// var cgid; var urladcart = "ajaxactions/addtocart.php"; function handleHttpResponse1() { if (http1.readyState == 4) { if(http1.status == 200) { var results = http1.responseText; if(results == 'added') { document.getElementById('carddescr' + cgid).style.width = '275px'; document.getElementById('cardactbut' + cgid).style.width = '110px'; document.getElementById('cardactbut' + cgid).style.paddingTop = '33px'; document.getElementById('tocartbuttons' + cgid).innerHTML = '
'; document.getElementById('cartprop').innerHTML = 'View Shopping Cart'; } } } } function addtocart(gid) { cgid = gid; document.getElementById('tocartbuttons' + cgid).innerHTML = ''; var para='?gid='+gid; http1.open("GET", urladcart+para, true); http1.onreadystatechange = handleHttpResponse1; http1.send(null); } var http1 = getHTTPObject(); //////////////////////////////////////////////////////// var urlremcart = "ajaxactions/removefromcart.php"; function handleHttpResponse2() { if (http2.readyState == 4) { if(http2.status == 200) { var results = http2.responseText; document.getElementById('cardactbut' + cgid).style.width = '80px'; document.getElementById('carddescr' + cgid).style.width = '300px'; document.getElementById('cardactbut' + cgid).style.paddingTop = '5px'; document.getElementById('tocartbuttons' + cgid).innerHTML = ''; if(results == 'empty') { document.getElementById('cartprop').innerHTML = 'Your Shopping Cart is Empty'; } } } } function removefromcart(gid) { cgid = gid; document.getElementById('tocartbuttons' + cgid).innerHTML = ''; var para='?gid='+gid; http2.open("GET", urlremcart+para, true); http2.onreadystatechange = handleHttpResponse2; http2.send(null); } var http2 = getHTTPObject();