var browserName=navigator.appName;
if (browserName=="Netscape" || browserName=="Opera")
{
document.write("<STYLE>.button {}</STYLE>");
}else
{
document.write("<STYLE>.button {	vertical-align:middle;	FONT-WEIGHT: bold;	FONT-SIZE: 14px;	CURSOR: hand;	COLOR: white;	FONT-FAMILY: tahoma;	border-top-width: 2px;	border-right-width: 2px;	border-bottom-width: 2px;	border-left-width: 2px;	border-top-style: solid;	border-right-style: solid;	border-bottom-style: solid;	border-left-style: solid;	filter:progid:DXImageTransform.Microsoft.Gradient(GradientType:0,StartColorStr:'#FE9200',EndColorStr:'#F40014');}</STYLE>");
}

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 subwishlist() {
	document.productform.wishlistadd.value="true";
	document.productform.submit();
}

function buynow() {
	 document.productform.wishlistadd.value="false";
	document.productform.submit();
}
function textKey() {
	supportsKeys = true
	calcCharLeft()
}
function calcCharLeft() {
	clipped = false
	lenUSig = 0
	maxLength = 600
        if (document.questionform.question.value.length > maxLength) { 
	        document.questionform.question.value = document.questionform.question.value.substring(0,maxLength)
		charleft = 0
		clipped = true
        } else {
		charleft = maxLength - document.questionform.question.value.length
	}
		document.getElementById("msgCL").innerHTML = charleft
        return clipped
}
function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

function validate1(frm)
{
	var ch;
	var flag=true;
	var error="";

	if(trim(frm.question.value)=="")
	{
		flag=false;
		error=error+"Please enter a question\n";
		  if(focus==false){
			frm.question.focus();
			focus=true;
		  }
	}
	if(frm.catid.value=="")
	{
		flag=false;
		error=error+"Please select a category\n";
		  if(focus==false){
			frm.catid.focus();
			focus=true;
		  }
	}

	if(flag==false)
	{
		alert(error);
		return false;
	}
	else{

		return true;

	}
}
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=I found this interesting and want 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 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 setCookie1(name_cookie,value,expiredays)
{
	var exdate=new Date()
	if(value=='null'||value==null||value=='undefined') value="NA";
	exdate.setDate(expiredays)
		if(getCookie1(name_cookie)==null || getCookie1(name_cookie)=='null') {
			document.cookie=name_cookie+ "="+escape(value)+((expiredays==null) ? "" : "; expires="+exdate +"; path=/; domain =books.rediff.com");
		}else {
			document.cookie=name_cookie+ "="+escape(getCookie1(name_cookie))+"|" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate +"; path=/; domain =books.rediff.com");
		}
}
function checkCookie(){
	if(getCookie1('bkprrfnbr')!=null) {
	if(getCookie1('bkprrfnbr').indexOf(document.productform.prrfnbr.value)==-1) {
	bkprrfnbr=getCookie1('bkprrfnbr')
	if (bkprrfnbr==null)
	{
			setCookie1('bkprrfnbr',document.productform.prrfnbr.value+"+++"+document.productform.prtitle.value+"+++"+document.productform.prauthor.value,365);

	}
	else
	{
			setCookie1('bkprrfnbr',document.productform.prrfnbr.value+"+++"+document.productform.prtitle.value+"+++"+document.productform.prauthor.value,365);
	}
	}
	}else {
			setCookie1('bkprrfnbr',document.productform.prrfnbr.value+"+++"+document.productform.prtitle.value+"+++"+document.productform.prauthor.value,365);
	}
}