var url="/shop/topcartprod.jsp";var ran=Math.random();
function gettopcart(){url="/shop/topcartprod.jsp";url=url+"?"+ran;var data="";getData(url,data);}
function getData(url,data){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=stateHandler1;req.open("POST",url,true);req.setRequestHeader('Content-type','application/x-www-form-urlencoded');req.send(data);}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=stateHandler1;req.open("POST",url,true);req.setRequestHeader('Content-type','application/x-www-form-urlencoded');req.send(data);}}}
function stateHandler1(){if(req.readyState==4){if(req.status==200){var val=req.responseText;document.getElementById("topcart").innerHTML=val;}
else{}}
return true;}
function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else
begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}
function setCookie(name,value){var cookname=name;if(cookname=="no_of_items"){num_item=value;num_item=parseInt(num_item)+1;var curCookie=name+"="+escape(num_item);}
grtot=getCookie('total_value');if(grtot==null){grtot=0;}
if(cookname=="total_value"){tot_val=value;grtot=parseInt(grtot)+tot_val;var curCookie=name+"="+escape(grtot);}
document.cookie=curCookie;}
function deleteCookie(name){if(getCookie(name)){document.cookie=name+"="+"; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=.rediff.com";}}
function deleteCookie1(name){alert(name)
if(getCookie(name)){alert("inside");document.cookie=name+"="+"; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=.rediff.com";alert(name+"="+"; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=.rediff.com");}}
function gotest()
{version=parseFloat(navigator.appVersion);if(navigator.appName.indexOf("Netscape")!=-1&&version<=4.05)
{AppWnd=window.open("/shopping/browserupgrade.htm","win1","toolbar=no,directories=no, resize=no,menubar=no,location=no,scrollbars=yes,width=500,height=350,maximize=null");}}
function popupmenu(choice,wt,ht)
{var winOpts="toolbars=no,maximize=no,resize=no,width="+wt+",height="+ht+",location=no,scrollbars=yes, directories=no";confirmWin=window.open(choice,'theconfirmWin',winOpts);}
function tr_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 tr_getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)
break;}
return null;}
function tr_getCookieVal(offset)
{var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function tr_SetCookie(name,value,expires,path,domain)
{document.cookie=name+"="+escape(value)+
((expires==null)?"":("; expires="+expires))+
((path==null)?"":("; path="+path))+
((domain==null)?"":("; domain="+domain));}
function DoCookies()
{var RetSessionStr;var RetUserStr;var value;RetUserStr=tr_GetCookie('RuW');RetSessionStr=tr_GetCookie('RsW');if(RetUserStr==null)
{curdate=new Date();curtime=curdate.getTime();value=(curtime*1000)+Math.round(Math.random()*1000);tr_SetCookie("RuW",value,"Mon, 31-Dec-2001 23:59:59 GMT","/",".rediff.com");tr_SetCookie("af","","Mon, 31-Dec-2001 23:59:59 GMT","/",".rediff.com");}
if(RetSessionStr==null)
{curdate=new Date();curtime=curdate.getTime();value=(curtime*1000)+Math.round(Math.random()*1000);tr_SetCookie("RsW",value,"","/",".rediff.com");}
return;}
DoCookies();function getCookieRBT(name)
{var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1)
{begin=dc.indexOf(prefix);if(begin!=0)return null;}
else
begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)
end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}
function setCookieRBT(cookieName,cookieValue,nDays){var today=new Date();var expire=new Date();if(nDays==null||nDays==0)nDays=1;expire.setTime(today.getTime()+3600000*24*nDays);document.cookie=cookieName+"="+escape(cookieValue)
+";expires="+expire.toGMTString()+";domain=.rediff.com;path=/";}
var rbtval=getCookieRBT('RBT');if((rbtval)){var rbtpos=rbtval.indexOf('shopping');if(rbtpos<0){var newval=rbtval+','+'shopping'
setCookieRBT('RBT',newval,'45');}}else{setCookieRBT('RBT','shopping','45');}
function checkCookie(){var strBuffprrfnbr=getCookie1('prrfnbr');var exdate=new Date();expiredays=30;exdate.setDate(exdate.getDate()+expiredays)
if(strBuffprrfnbr!=null){var myarr=strBuffprrfnbr.split("|");if(strBuffprrfnbr.indexOf(document.productform.prrfnbr.value)==-1){var newprrfnbr=document.productform.prrfnbr.value+"~~~"+document.productform.prtitle.value+"~~~"+document.productform.primg.value+"~~~"+document.productform.pvrfnbr.value+"~~~"+document.productform.menbr.value;if(myarr.length==1){newprrfnbr=newprrfnbr+"|"+myarr[0];}else{for(i=0;i<2;i++){newprrfnbr=newprrfnbr+"|"+myarr[i];}}
document.cookie="prrfnbr="+escape(newprrfnbr)+"; expires="+exdate.toGMTString()+"; path=/; domain=.rediff.com";}}else{var name="prrfnbr";document.cookie="prrfnbr="+escape(document.productform.prrfnbr.value+"~~~"+document.productform.prtitle.value+"~~~"+document.productform.primg.value+"~~~"+document.productform.pvrfnbr.value+"~~~"+document.productform.menbr.value)+"; expires="+exdate.toGMTString()+"; path=/; domain=.rediff.com";}}
function getCookie1(name_cookie)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(name_cookie+"=")
if(c_start!=-1)
{c_start=c_start+name_cookie.length+1
c_end=document.cookie.indexOf(";",c_start)
if(c_end==-1)
c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))}}
return null}
function delproductCookie(prrfnbrid){var strprrfnbr=getCookie1('prrfnbr');alert(strprrfnbr);var delarray=strprrfnbr.split("|");var prrstr="";var exdate=new Date();expiredays=30;exdate.setDate(exdate.getDate()+expiredays)
if(strprrfnbr!=null){if(strprrfnbr.indexOf(prrfnbrid)!=-1){alert("delarray"+delarray.length);for(var j=0;j<delarray.length;j++){alert("prr == "+delarray[j]);if(delarray[j].indexOf(prrfnbrid)==-1){prrstr=prrstr+delarray[j]+"|";}}
prrstr=prrstr.substring(0,prrstr.length);document.cookie="prrfnbr="+escape(prrstr)+"; expires="+exdate.toGMTString()+"; path=/; domain=.rediff.com";}}}
function check()
{var col=document.frmSearch.catid.value;var cat=col.indexOf("|");var catid1=col.substring(0,cat);var lvl=col.substring(cat+1);if(document.frmSearch.catid.value=='1')
{var lookfor=document.frmSearch.Query.value;document.frmSearch.action="http://shop.rediff.com/bookstore/buyersearch.jsp?lookfor="+escape(lookfor)+"&search="+escape(lvl);return true;}
else
{document.frmSearch.action="http://shop.rediff.com/shop/searchv3_gall.jsp?Query="+escape(document.frmSearch.Query.value)+"&level="+escape(lvl)+"&catid="+catid1;return true;}}
function popupmenu2(choice,wt,ht)
{var
winOpts="toolbar=no,location=no,directories=no,status=no,scrolling=auto,scrollbars=yes,menubar=no,width="+wt+",height="+ht;confirmWin=window.open(choice,'theconfirmWin',winOpts);window.open(choice,'theconfirmWin',winOpts);}
function mail()
{var w=window.location.href
w=w.replace("=","%3D");w=w.replace("&amp;","%26");window.location.href="mailto:?subject=Check this out&amp;body=Your friend found this interesting and wants you to check it out. %0A Please click on the link below or copy and paste it in the address bar on your web browser. %0A"+w;}
function subwishlist(){document.productform.wishlistadd.value="true";document.productform.submit();}
function buynow(){var w=window.location.href;document.productform.wishlistadd.value="false";document.productform.action="http://commerce.rediff.com/commerce/v3/newaddcart.jsp";
document.productform.submit();}
function validate()
{if((document.productform.Name.value!="")&&(document.productform.Name!="null"))
{buynow();}
else
{alert("Enter Your Name / Message");}}
function hidepopup(){document.productform.showpopup.value="false";}