// JavaScript Document
function couponpop(cid){
	dealpop = window.open('http://www.freeonlinecouponcode.com/displaycoupon.php?&cid='+cid,"dealpop","height=480,width=800,scrollbars,resizable");
	document.location = 'http://www.freeonlinecouponcode.com/redirect.php?cid='+cid;
}
function couponpopbyname(sname){
	dealpop = window.open('http://www.freeonlinecouponcode.com/displaycoupon.php?&name='+sname,"dealpop","height=480,width=800,scrollbars,resizable");
	document.location = 'http://www.freeonlinecouponcode.com/gostore.php?name='+sname;
}

function couponpopbyprod(prodid){
	dealpop = window.open('http://www.freeonlinecouponcode.com/displaycoupon.php?&prodid='+prodid,"dealpop","height=480,width=800,scrollbars,resizable");
	document.location = 'http://www.freeonlinecouponcode.com/gostore.php?prodid='+prodid;
}

var request;
var dest;

function processStateChange(){
    if (request.readyState == 4){
        contentDiv = document.getElementById(dest);
        if (request.status == 200){
            response = request.responseText;
            contentDiv.innerHTML = response;
        } else {
            contentDiv.innerHTML = "Error: Status "+request.status;
        }
    }
}

function loadHTML(url, destination){
    dest = destination;
    if (window.XMLHttpRequest){
        request = new XMLHttpRequest();
        request.onreadystatechange = processStateChange;
        request.open("GET", url, true);
        request.send(null);
    } else if (window.ActiveXObject) {
        request = new ActiveXObject("Microsoft.XMLHTTP");
        if (request) {
            request.onreadystatechange = processStateChange;
            request.open("GET", url, true); 
            request.send();
        }
    }
}

function setSearch(id){
	document.search.SearchTerms.value = id;
	panel = document.getElementById('disppanel');
	panel.style.display = 'none';
}

function setSearch2(id){
	document.smallsearch.SearchTerms.value = id;
	panel = document.getElementById('disppanel2');
	panel.style.display = 'none';
}

function goto(loc){
	newwin2 = window.open(loc,'newwin','menubar,resizable,height=640,width=480,left=400,top=0,scrollbars=yes,location=yes,toolbar=yes');
	if(newwin2.closed){
		newwin2 = window.open(loc,'newwin','menubar,resizable,height=640,width=480,left=400,top=0,scrollbars=yes,location=yes,toolbar=yes');
	}else{
		newwin2.location = loc;
		newwin2.focus();
	}

}
