

var testFun = function(){alert('What?');};

function alert_ua(browser){
    var ua = navigator.userAgent;
    if(ua.match('iPhone')){
//        alert("Its an iPhone: "+ua);
        alert("php has found: "+browser);
    }
    
}


function displayContent(params){
var conspot = document.getElementById('con_spot');
//var params="cat_id="+cat_id+"&nav_tree="+cat_id;
doPostAJAX(params,conspot);
if(params == 'cat_id=0'){
setTimeout("pushTweet('http://twitter.com/statuses/user_timeline/117259502.rss')", 1000);
}


}



function doPostAJAX(params,obj){

if(window.XMLHttpRequest){
obj.innerHTML="<div style='text-align:center'><img src='images/loading.gif'/></div>";
var http = new XMLHttpRequest();
}else{
var http = new ActiveXObject("Microsoft.XMLHTTP");
}

var url='con_fetch.php';
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		obj.innerHTML=http.responseText;
	}
}
http.send(params);
}

function addToCart(itm){
var grindSelIndx = document.forms[0].grind.selectedIndex;
var grind = document.forms[0].grind.options[grindSelIndx].value;
var quantity = document.forms[0].quantity.value;
var cart_add = document.forms[0].cart_add.value;
var content_id = document.forms[0].content_id.value;
var decaf_reg_sel = document.forms[0].decaf_reg;
var decaf_reg = decaf_reg_sel.options[decaf_reg_sel.selectedIndex].value;
var product = document.forms[0].product.value;
//alert(document.forms[0].quantity.value+", grind:"+grind);
//alert("grind="+grind+"&quantity="+quantity+"&cart_add="+cart_add);
displayContent("grind="+grind+"&quantity="+quantity+"&cart_add="+cart_add+"&content_id="+content_id+"&decaf_reg="+decaf_reg+"&product="+product);
}

function noThanks(){
var offerObj = document.getElementById('extraPound');
offerObj.style.display='none';
}

function checkForHash()
{
    var hashCatId=location.hash.split("=")[1];
    var queryCatId=location.search.split("=")[1];
    if(hashCatId || queryCatId)
    {
        //layoutManip();
        if(hashCatId)
        {
            displayContent('cat_id='+hashCatId);
        }else if(queryCatId){
            displayContent('cat_id='+queryCatId);
        }
    }
}
