<!--
if(navigator.appName=="Netscape") var set1 = "2";
if(navigator.appName=="Microsoft Internet Explorer") var set1 = "1";
if((navigator.appName!="Netscape")&&(navigator.appName!="Microsoft Internet Explorer")) var set1 = "3";

		function httpReturn(getURLstr, snd1, sendData1){
if(set1=="1") var xmlHTTP= new ActiveXObject("Microsoft.XMLHTTP");
if(set1!="1") var xmlHTTP= new XMLHttpRequest();
if((snd1=="P")||(snd1=="p")) xmlHTTP.open("POST", getURLstr, false);
if((snd1=="P")||(snd1=="p")) xmlHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
if((snd1!="P")&&(snd1!="p"))  xmlHTTP.open("GET",getURLstr,false);	
xmlHTTP.send(sendData1);if(snd1=="x") dataSend1 = xmlHTTP.responseXML;
if(snd1!="x") dataSend1 = xmlHTTP.responseText;xmlHTTP = "";return dataSend1;
		}	
		
	function DateGetter(tag, DateVal){
if(DateVal=="0") DateVar = new Date();if(DateVal!="0") DateVar = new Date(DateVal);
nd = new Number(24 * 60 * 60 * 1000);if(tag=="1") rdt = (DateVar.getMonth() + 1) + "/" + DateVar.getDate() + "/" + DateVar.getFullYear();
if(tag=="4") rdt =  (DateVar.getMonth() + 1) + "/" + DateVar.getDate() + "/" + DateVar.getFullYear();
if(tag=="S") rdt = DateVar.getDate() + "" + DateVar.getMonth() + "" + DateVar.getFullYear() + "" + DateVar.getHours();
if(tag=="3") rdt = DateVar;if(tag=="10") rdt = Date.parse(DateVar);
if(tag=="11") rdt = new Number(Date.parse(DateVar)) + nd;if(tag=="7") rdt = WeekDayName(DateVar.getDay());
if(tag=="8") rdt = MonthNameVal(DateVar.getMonth());return rdt;	
			}
	function MonthNameVal(MonthVar){
monthStr = new String(month_string());monthArr = monthStr.split(",");return monthArr[MonthVar];
	}
	
	function month_string(){
mstr = "January,February,March,April,May,June,July,August,September,October,November,December";
return mstr;
	}
			
	function WeekDayName(WeekdayVar){
weekDayStr = new String("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); weekDayArr = weekDayStr.split(",");return weekDayArr[WeekdayVar];		
	}
			
	function SetCookieVar(cookieData, cookieName, expireDays){
		try{
var expireDate = new Date ();expireDate.setTime(expireDate.getTime() + expireDays * (24 * 60 * 60 * 1000)); 
document.cookie = cookieName + "=" + escape(cookieData) + "; expires=" + expireDate.toGMTString();	
		}
		catch(er){}
	}			
	function GetCookie(name) {
		try{
cv = new String(document.cookie.toString());car = cv.split(name + "=");cv = new String(car[1]);car = cv.split(";");return (car[0]);
		}
		catch(er){
return "";
		}
	
	}
			function BuildID(TypeID){
DateStr = new Date();DateParse = Date.parse(DateStr);return TypeID + "_" + DateParse
		}


	function GetCookieVal (offset) {
        try{
var endstr = document.cookie.indexOf (";", offset);if (endstr == -1) endstr = document.cookie.length; 
return unescape(document.cookie.substring(offset, endstr));
        }
        catch(er){
return null;        
        }
			}
	function CompareTest(strVar, CompareVar){
rExpVar = new RegExp(strVar);return rExpVar.test(CompareVar);
	}

	function cta(strVar, CompareVar){
rExpVar = new RegExp(CompareVar, "gi");return rExpVar.test(strVar);
		}

	function cte(strVar, CompareVar){
sv1 = (new String(unescape(strVar)));rExp = new RegExp("\\r","gi");rExp3 = new RegExp("\\n","gi");
sv1 = new String(sv1.replace(rExp, ""));sv1 = new String(sv1.replace(rExp3, " "));
cv1 = (new String(unescape(CompareVar)));if(sv1.toLowerCase() == cv1.toLowerCase()) return "1";
if(sv1.toLowerCase() != cv1.toLowerCase()) return "0";
		}
		
		function SQLready(fieldVar){
rExp1 = /'/gi;fieldVal = new String(fieldVar.toString().replace(rExp1, "&#39;"));return fieldVal.slice(0, 1500)
		}	

	function request(queryVar){
	    try{
ls = window.top.location.search;
	    }
	    catch(Error){
ls = location.search;	    	    
	    }
		switch(cta(ls, queryVar)){
		case true :
nsv = new String(ls);qvs = new RegExp(queryVar + "=");
var strArr1 = nsv.split(qvs);strMain = new String(strArr1[1]);
var strArr2 = strMain.split("&");returnVar = unescape(strArr2[0]);	
		break;
		default :
returnVar = "";
		}	
if(returnVar=="undefined") returnVar = "";return returnVar;
	}
		
		
	function setArr(v,n,sv){
arr = v.toString().split(sv);return arr[n];	
	}	

    function pa_page(){
 
pns = new String(location.pathname);
ps = pns.indexOf("checkout/onepage");
sts = pns.indexOf("checkout/go");
if(ps>0) pa_cart();  
	try{

//frs = "<span style=\"display:none;\"><iframe id=\"stfrm\" src=\"" + stat_lnk() + "\" width=\"50\" height=\"50\" border=\"0\" scrolling=\"no\" ></iframe></span>";
//if((request("tv")=="1")&&(sts<1)) alert(sts + "  .." + pns + stat_lnk());
//if(sts<1) document.write("." + frs);
//document.getElementById("stfrm").setAttribute("src","http://www.chocmilkdiet.com/checkout/onepage/go"):
	}
	catch(Error){
 
	}
    }

    function stat_lnk(){
lh= window.location.host;
ls= window.location.protocol + "//";
lnk = ls + lh + "/checkout/go";
return lnk;
    }
    

    function pa_cart(){
		try{
document.getElementById("login:guest").checked = true; 
document.getElementById("opc-login").style.display = "none";
document.getElementById("billing:use_for_shipping_yes").checked = true; 

document.getElementById("pa_l2").innerHTML = "1";
document.getElementById("pa_l3").innerHTML = "2";
//if(request("tv")=="1") alert("boop");
document.getElementById("pa_l4").innerHTML = "3";
document.getElementById("pa_l5").innerHTML = "4";
document.getElementById("pa_l6").innerHTML = "5";
document.getElementById("onepage-checkout-shipping-method-additional-load").style.display = "none";


checkout.setMethod();
document.getElementById("billing:is_subscribed").checked=true;

		}

	catch(Error){}  
    }
    
    function pa_pay(){
sv = new String(gspu("pors"));
gv = (sv.length==0) ? pa_payMethod() : sppl();
    }

    function pa_shipMethod(){
        try{
cartCkg();
document.getElementById("onepage-checkout-shipping-method-additional-load").style.display = "none";
        }
        catch(Error){
        }
        
        try{
fsc = new String(document.getElementById("s_method_freeshipping_freeshipping").checked); 
document.getElementById("s_method_freeshipping_freeshipping").checked = true;
        }
        catch(Error){
fsc = "0";
            try{
document.getElementById("s_method_productmatrix_standard").checked = true; 
            }
            catch(Error){}      
        }
//frs = document.getElementById("s_method_flatrate_flatrate").checked;
window.setTimeout('shippingMethod.save()', 500) 
    }

    function pa_payMethod(){
//if(request("tv")=="1") alert("go3");  
        try{
fsc = new String(document.getElementById("p_method_free").checked); 
document.getElementById("p_method_free").checked = true;
pmt = "0";
        }
        catch(Error){
pmt = "1";
        }
        
if(pmt=="0") window.setTimeout('payment.save()', 500) 
    }
    
  function StartClock() {
ReportInterval = window.setInterval('RunClock()', 100)
}
function StopClock() {
window.clearInterval(ReportInterval)
}  


    function bldBlk(idv) {
    //strs = new String(document.getElementById(idv).xml:lang);
    //    alert(strs + " " + idv);
    }

    function rev_d(idv,tv){
document.getElementById("md_" + idv).style.display = (tv==1) ? "inline" : "none";
document.getElementById("sd_" + idv).style.display = (tv==1) ? "none" : "inline";

    }

    function revStart(){
rl = new String(document.getElementById("rvids").innerHTML);  
arr = rl.split(",");
rb="";
   i = 0;
    while (i < arr.length) {
    try{
   rb = rb + rdWrap(document.getElementById("rm_" + arr[i]).innerHTML); 
    }
    catch(Error){
    }
        i++;
    }  
document.getElementById("rev_ctn").innerHTML = rb;    
    }
    
    function rdWrap(str){
rt = "<div class=\"box base-miniQ\">" + str + "</div>"   
return rt;    
    }
    
    function hlEng(tp,ct,url,ttl){
 document.getElementById(tp).innerHTML = document.getElementById(ct).innerHTML; 
 document.getElementById(tp + "_hdl").innerHTML = ttl;
 document.getElementById(tp + "_lnk").href = url;
    }
    
     function hlEng2(tp,ct,url,ttl){
         try{
document.getElementById(tp).innerHTML = document.getElementById(ct).innerHTML; 
 document.getElementById(tp + "_hdl").innerHTML = ttl;
 document.getElementById(tp + "_lnk").src = url;
 ht1 = (ct=="ht_5") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_5_t").setAttribute("class","");
 ht1 = (ct=="ht_7") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_7_t").setAttribute("class","");
 ht1 = (ct=="ht_8") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_8_t").setAttribute("class","");
  ht1 = (ct=="ht_9") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_9_t").setAttribute("class","");
ht1 = (ct=="ht_10") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_10_t").setAttribute("class","");
 ht1 = (ct=="ht_11") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_11_t").setAttribute("class","");
 ht1 = (ct=="ht_12") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_12_t").setAttribute("class","");
 ht1 = (ct=="ht_13") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_13_t").setAttribute("class","");
 ht1 = (ct=="ht_14") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_14_t").setAttribute("class","");
 ht1 = (ct=="ht_15") ? document.getElementById(ct + "_t").setAttribute("class","active") : document.getElementById("ht_15_t").setAttribute("class","");
       }
        catch(er){}
    }   
    

    	function stmain(){
    	    try{	
cst = new String(GetCookie("crt"));
lnc = new String(document.getElementById("billing:lastname").value);
sta = new String(document.getElementById("billing:street1").value);
if((cst.length>10)&&(lnc.length<2)&&(sta.length<2)) sbsf(cst);
//if(request("tv")=="1") alert(cst.length);
document.getElementById("billing:is_subscribed").checked=true;
// if(request("tv")=="1") alert(unescape(GetCookie("crt"))); 
            }
            catch(Error){}
    }
    
    function sbsf(str){
    str=new String(unescape(str));
    arv = str.split("|");
 try{
        document.getElementById("billing:lastname").value = arv[0]
        document.getElementById("billing:firstname").value = arv[1]
        document.getElementById("billing:street1").value =arv[2]
        document.getElementById("billing:street2").value =arv[3]
        document.getElementById("billing:city").value =arv[4]
        document.getElementById("billing:region_id").value =arv[5]
        document.getElementById("billing:postcode").value =arv[6]
        document.getElementById("billing:telephone").value =arv[7]
        document.getElementById("billing:country_id").value =arv[8]
        document.getElementById("billing:company").value =arv[9]
        document.getElementById("shipping:lastname").value = arv[10];
        document.getElementById("shipping:firstname").value = arv[11];
        document.getElementById("shipping:street1").value = arv[12];
        document.getElementById("shipping:street2").value = arv[13];
        document.getElementById("shipping:city").value = arv[14];
        document.getElementById("shipping:region_id").value = arv[15];
        document.getElementById("shipping:postcode").value = arv[16];
 	 document.getElementById("shipping:telephone").value = arv[17];
 	 document.getElementById("shipping:country_id").value = arv[18];
 	 document.getElementById("shipping:company").value = arv[19];
 	 document.getElementById("billing:email").value = arv[20];
  }
 catch(Error){}
   }
   
        function cartCkg(){
cvr = SetCookieVar(sbld(), "crt", 365);  
if(request("tv")=="1") alert(unescape(GetCookie("crt"))); 
//if(request("tv")=="1") alert("go2");  

        }
    
        function sbld(){
        arv = new Array
  try{

        DateVar = new Date()
        arv[0]= document.getElementById("billing:lastname").value;
        arv[1]= document.getElementById("billing:firstname").value;
        arv[2]= document.getElementById("billing:street1").value;
        arv[3]= document.getElementById("billing:street2").value;
        arv[4]= document.getElementById("billing:city").value;
        arv[5]= document.getElementById("billing:region_id").value;
        arv[6]= document.getElementById("billing:postcode").value;
        arv[7]= document.getElementById("billing:telephone").value;
        arv[8]= document.getElementById("billing:country_id").value;
        arv[9]= document.getElementById("billing:company").value;
        arv[10]= document.getElementById("shipping:lastname").value;
        arv[11]= document.getElementById("shipping:firstname").value;
        arv[12]= document.getElementById("shipping:street1").value;
        arv[13]= document.getElementById("shipping:street2").value;
        arv[14]= document.getElementById("shipping:city").value;
        arv[15]= document.getElementById("shipping:region_id").value;
        arv[16]= document.getElementById("shipping:postcode").value;
 	 arv[17]= document.getElementById("shipping:telephone").value;
 	 arv[18]= document.getElementById("shipping:country_id").value;
 	 arv[19]= document.getElementById("shipping:company").value;
 	 arv[20]= document.getElementById("billing:email").value;
	 arv[21]= "";
	 arv[22]="i";
	 arv[23]=DateGetter(10, "0");
	 arv[24]="";
	 arv[25]=gspu("crts");
	 arv[26]=gspu("subs");
	 cv = arv.join("|");
 }
 catch(Error){
 cv="0";
 }
		return cv;
   
    }

	function gspu(idv){
		try{
	cv = document.getElementById(idv).innerHTML;
		}
 		catch(Error){
 	cv="";
 		}
//if(request("tv")=="1") alert(cv);
return cv;
	}


	function udpu(idv,udv){
		try{
	cv = 1;
       document.getElementById(idv).innerHTML = udv;
		}
 		catch(Error){
 	cv="0";
 		}
//if(request("tv")=="1") alert(cv);
return cv;
	}
    
       function cucn(){
        arv = new Array
  try{

        arv[0]= DateGetter(10, "0"); // user id based on parsed date
        arv[1]= window.top.location.pathname; // current landing page
        arv[2]= window.top.request("tag"); // current ad code
        arv[3]= pgCode(); // current page code
        arv[4]= window.top.location.pathname; // initial landing page
        arv[5]= window.top.request("tag"); // initial ad code
        arv[6]= ""; // special order item ids
        arv[7]= ""; // customer condition
        arv[8]= ""; // orders numbers
        arv[9]= ""; // subscription order item ids
        arv[10]= ""; // last order number
        arv[11]= window.top.request("aid"); // current affiliate code
        arv[12]= window.top.request("aid"); // initial affiliate code
	 arv[13]= DateGetter(4, "0"); // current date
	 arv[14]= ""; // subscription placeholder 2
	 cv = arv.join("|");
 }
 catch(Error){
 cv="0";
 }
		return cv;
    }




   function prtdp(ct){
str = "ct0,ct1,ct2,ct3,ct4";
arr = str.split(",");
rb="";
   i = 0;
    while (i < arr.length) {
    try{
   rb = rb + hdWrap(arr[i],ct); 
    }
    catch(Error){
    }
        i++;
    }  

document.getElementById("header_tabs_ba").innerHTML = "<ul>" + rb + "</ul>";
	}
	

    function hdWrap(sv,ct,tp){
cls = (sv==ct) ? "class=\"selected2\"" : "class=\"ddlpo\"" ;
ttl= new String(document.getElementById(sv + "_ttl").innerHTML);
ta = ttl.split(">");
tas = new String(ta[1]);
ta = tas.split("</");
ttl = ta[0]; 
rst = "<li id=\"" + sv + "_ttl\" " + cls + "\"><a style=\"cursor: pointer;\" onclick=\"prtdp('" + sv + "')\">" + ttl + "</a></li>";
document.getElementById(sv).style.display = (ct==sv) ? "inline" : "none";
//alert(ttl);
return rst;
    }

    function phdWrap(sv,ct,tp){
cls = (sv==ct) ? "class=\"selected2\"" : "class=\"ddlpo\"" ;
ttl= new String(document.getElementById(sv + "_ttl").innerHTML);
ta = ttl.split(">");
tas = new String(ta[1]);
ta = tas.split("</");
ttl = ta[0]; 
rst = "<li id=\"" + sv + "_ttl\" " + cls + "\"><a style=\"cursor: pointer;\" onclick=\"prtd('" + sv + "')\">" + ttl + "</a></li>";
document.getElementById(sv).style.display = (ct==sv) ? "inline" : "none";
//alert(ttl);
return rst;
    }


      function prtd(ct){

str = "desc,t1c,t2c,ht_9,add";
arr = str.split(",");
rb="";
   i = 0;
    while (i < arr.length) {
    try{
   rb = rb + phdWrap(arr[i],ct); 
    }
    catch(Error){
    }
        i++;
    }  

document.getElementById("header_tabs_ba").innerHTML = "<ul>" + rb + "</ul>";
    }  

 
      
//-->
