var host="http://www.poppydog.com";
//var host="http://localhost:8080";


function pd_isPP(hid,pid) {
	var theCookie = pd_getCookie("pp_"+hid);
	if (theCookie!=null && theCookie.indexOf("|"+pid+"|")>-1){
		return true;
	}else{			
		return false;
	}
		
}


function pd_showLoggedOn(hid,msg){
	var usern = pd_getUsername(hid);
	if (usern!=null)
		document.write(msg+usern);
	
}

function pd_showUpgrade(hid,msg){
	if (pd_isLoggedOn(hid)&&!pd_isFullMember(hid))
		document.write("<a href="+host+"/reg/payment/member.do?action=upgrade&hid="+hid+">"+msg+"</a>");
	
}


function pd_isFullMember (hid) {
	if (document.cookie.indexOf(hid+"_FULL")>-1)
		return true;
	else
		return false;
}



function pd_getUsername(hid){
	if (pd_isLoggedOn(hid))
		return pd_getCookie(hid+"_USERN");	
}



function pd_isLoggedOn (hid) {
	if (document.cookie.indexOf("poppydogl_"+hid)>-1)
		return true;
	else
		return false;
}

function pd_isSubscribed (hid,cid) {
var theCookie = pd_getCookie(hid+"_CID");
if (theCookie!=null && theCookie.indexOf(":"+cid+":")>-1)
		return true;
	else
		return false;
}

function pd_getCookie (name) {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) {
        var j = i + alen; 
        if (document.cookie.substring(i, j) == arg)
          return pd_getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }
      return null;
    }

function pd_getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
 endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}




function getObject(id){
var obj1;

if (document.all) 
	obj1= document.all[id];
else if (document.getElementById)
	obj1 =document.getElementById(id);
else
	obj1=eval("document."+id);

if (document.layers)
	return obj1;
else
	return obj1.style;
	

}


function pd_hide(id){
	var theObj =getObject(id);
	theObj.visibility="hidden";
}


function pd_show(id){
	var theObj =getObject(id);
	theObj.visibility="visible";
}

document.write("<br><hr><br>")
