var isProcessComplete=true;
var renewalIndex = '1';
var prevRow ;
var prevRowClassName;
var lastfocus;
var subWindow;
var tblcon="";
function resetProcessComplete()
{
     isProcessComplete=false;
     window.setTimeout("isProcessComplete=true",5000);
}

function MM_AnchorClick(url)
{
    if(isProcessComplete)
    {
        resetProcessComplete();

        if(url.indexOf("fullTextSearch")>=0)
        {

            var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
            var options ='width=600,height=500,resizable=yes';

            var obj_winDC = window.open(url,"LSDigital",options);


            obj_winDC.opener = window;
            obj_winDC.focus();
        }
        else
            window.location= url;
     }
}
/***** Code modified on 20Oct05.prash ****/
var radioyearopt="0",andopt1="1",andopt2="1",sortopt="U" ;

function MM_Close()
{
	top.window.close();
}

function MM_goToURL()
{
    if(isProcessComplete)
    {
    resetProcessComplete();
	var i, args=MM_goToURL.arguments;

	document.MM_returnValue = false;

	for (i=0; i<(args.length-1); i+=2)
		eval(args[i]+".window.location='"+args[i+1]+"'");
    }
}
function MM_onBTN_JABack_Click()
{
    if(isProcessComplete)
    {
        resetProcessComplete();
        window.location="journal";
    }
}
function MM_PRList()
{
     if(isProcessComplete)
    {
     resetProcessComplete();
    showpopupFrame('./purchaselist');
    }
}
//for  current/all journal radio event
function MM_rdoJournal(par)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    //alert('journal clicked');
    window.location="journal?isAll="+par;
    }
}
// for  new arrival book/journal radio event
function MM_RadioNewArrChange(form)
{
   if(isProcessComplete)
    {
   resetProcessComplete();
   callSubmit(form);
   }
}
function focusDefaultFieldxx(str)
{
	var cmd="document.sform."+str+".focus()";
	//eval(cmd);
	alert('ss'+cmd)
}
function rowclickedJA(offset)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    //alert('offset....');
    window.location="journaldtl?offset="+offset;
    }
}
function rowclickedJAHistory(offset)
{
    //alert('offset....');
    //var bars='scrollbars=yes,directories=no,location=yes,menubar=no,status=no,titlebar=yes,toolbar=no,';
    //var options ='width=600,height=500,resizable=yes,left=100,top=200;
    //var title= 'Journal History Details';

    //var url="journaldtl?offset="+offset+"&type=h";

    //var obj_winDC = window.open(url,title,bars+options);

	//obj_winDC.opener = window;
	//window.close();
	//obj_winDC.focus();
    if(isProcessComplete)
    {
	resetProcessComplete();
	self.moveTo(100,100);
    self.resizeTo(700,400);
    window.location="journaldtl?offset="+offset+"&type=h";
    }
}
///********** Prash [03-09-05] *****/
function MM_radioClickedSort(idr)
{
	var a=MM_radioClickedSort.arguments;
	sortopt=a[0].value;

	if(idr.id.search("rdosortids")==0)
		document.getElementById("cmbsortcatid").disabled=false;
	else if(idr.id.search("rdosortidu")==0)
		document.getElementById("cmbsortcatid").disabled=true;

}

///********** Prash [03-09-05] *****/
function MM_radioClicked(idb)
{
	    var i=0,a=MM_radioClicked.arguments;
	    radioyearopt=a[0].value

		document.getElementById("txtyear0").disabled=true;
		document.getElementById("txtyear1").disabled=true;
		document.getElementById("txtyear2").disabled=true;
		document.getElementById("txtyear3").disabled=true;
		document.getElementById("txtyear4").disabled=true;

		document.getElementById("txtyear0").value="";
		document.getElementById("txtyear1").value="";
		document.getElementById("txtyear2").value="";
		document.getElementById("txtyear3").value="";
		document.getElementById("txtyear4").value="";

		if(idb.id.search("rdoyearid0")==0)
		{

		}
		else if(idb.id.search("rdoyearid1")==0)
		{
			document.getElementById("txtyear0").disabled=false;
			document.getElementById("txtyear1").disabled=false;
		//	document.getElementById("MMr1").bgColor="#FF9900";
		}

		else if(idb.id.search("rdoyearid2")==0)
			document.getElementById("txtyear2").disabled=false;

		else if(idb.id.search("rdoyearid3")==0)
			document.getElementById("txtyear3").disabled=false;

		else if(idb.id.search("rdoyearid4")==0)
			document.getElementById("txtyear4").disabled=false;
///////////////////////////////////////////////////////////////////
		else if(document.getElementById("rdosortids").checked==true)
			{
				document.getElementById("cmbsortcatid").disabled=true;
				document.getElementById("rdosortidu").checked=true;
				document.getElementById("rdosortids").checked=false;
			}
		else if(document.getElementById("rdosortidu").checked==true)
			{
				document.getElementById("cmbsortcatid").disabled=true;
				document.getElementById("rdosortids").checked=false;
			}
//////////////////////////////////////////////////////////////////
}

function MM_radioClickedA1()
{
    var i=0,a=MM_radioClickedA1.arguments;
    andopt1=a[0].value
//alert("radi a1"+andopt1)
}

function MM_radioClickedA2()
{
	var i=0,a=MM_radioClickedA2.arguments;
	andopt2=a[0].value
//alert("radi a2"+andopt2)
}
/////////////////
function MM_setConnect()
{
    if(isProcessComplete)
    {
	    resetProcessComplete();
	    eval("parent.connect.location='connect.jsp?mod=F7BF88'");
	}
}

function MM_OnLogin()
{
    if(isProcessComplete)
    {
    resetProcessComplete();
	eval("parent.login.location='newlogin.jsp'");
	}
}

function MM_LoginRefresh()
{

}

function rowclicked(str)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    eval("window.location='detail$"+str+"'");
    }
}

function rowclickedBRW(str)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    eval("window.location='detailbrw?offset="+str+"'");
    }
}
function rowclickedBRWSPP(str)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    eval("window.location='detailsppbrw?offset="+str+"'");
    }
}

function rowclickedSPP(str)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    eval("window.location='briefSPPATCClicked?offset="+str+"'");
    }
}

/*********************************************/
function showPopupFull(url)
{
    var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
    var options ='width=600,height=500,resizable=yes';
    var title= 'DetailCard';



    var obj_winDC = window.open(url,title,bars+options);
	obj_winDC.opener = window;
	obj_winDC.focus();

}

function showWindow(url)
{

    var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
    var options ='width=600,height=500,resizable=yes';
    var title= 'DetailCard';

    //if(url.indexOf("http://")<0)
    //url="http://"+url;

    var obj_winDC = window.open(url,title,bars+options);
	//obj_winDC.location.replace=url;
	obj_winDC.opener = window;
	obj_winDC.focus();
    //showPopupFull(url)

}

function showWindowDigital(url)
{
var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
var options ='width=600,height=500,resizable=yes';
var title= 'DetailCard';


    var obj_winDC = window.open(url,title,bars+options);
	//obj_winDC.location.replace=url;
	obj_winDC.opener = window;
	obj_winDC.focus();
    //showPopupFull(url)

}
/****/
function homeClick()
{
  if(isProcessComplete)
  {
	  resetProcessComplete();
	  window.location="SearchForm";
  }
}

/****/
function changeClass(classNameOfElem , elementRef)
{
    
    elementRef.className = classNameOfElem;
}


function showPopup(url)
{
var left= screen.availWidth/2;
var top= screen.availHeight/2;

var wid= screen.availWidth/2.5;
var hght= screen.availHeight/3;

var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
var options ='width='+wid+',height='+hght+',resizable=yes,left='+left+',top='+top;
var title= 'Copies';

if(url.indexOf('digsimple')>=0)
{
	left=100;
 	top= 13;

    options ='width='+(wid*1.4)+',height='+(hght/2.8)+',resizable=yes,left='+left+',top='+top;
    title= 'TextSearch';
    //url='index.html';
}

	if(url.indexOf('eresource')>=0)
	{
		left=10;
		top= 10;

		hght+=100;
		options ='resizable=yes,left='+left+',top='+top;
		title= 'ER';
	}
	else if(url.indexOf('bulletin')>=0)
	{
		left=10;
		top= 10;
		 //alert("notice...");
		options ='resizable=yes,left='+left+',top='+top;
		title= 'Notice';
	}
	else if(url.indexOf('detail')>=0)
	{
		left=100;
		top= 100;

		options ='resizable=yes,left='+left+',top='+top;
		title= 'DetailCard';
	}


    var obj_winDC = window.open(url,title,bars+options);
	obj_winDC.opener = window;
	obj_winDC.focus();

}


function setRenewalIndex(checkout , index)
{

	renewalIndex = index;
	if(prevRow!=null)
	{
		prevRow.className = prevRowClassName;
	}

	prevRow = checkout;
	prevRowClassName = checkout.className;
	checkout.className = "briefListRowSel";

}


function showpopupFrame(url , location)
{
   var wid= screen.availWidth/2.5;
	var hght= screen.availHeight/3;
    var title='';

    if(url.indexOf('renew')>=0)
    {
     	wid=300;
     	hght=50;
        //alert('renew '+url)

        title= 'Renewal';
        url = url+"?offset="+renewalIndex;
    }
    else if(url.indexOf('copies')>=0)
    {
        if(url.indexOf("?")<0)
            url = url+"?location="+location
        else
            url = url + "&location="+ location

    }


    else if(url.indexOf('dDetailCardACCR')>=0 || url.indexOf('dDetailCardATCR')>=0 || url.indexOf('dDetailCardSPPR')>=0 || url.indexOf('dR')>=0)
    {

     	wid=400;
     	hght=150;
//        alert('reserve '+url)

        title= 'ReserveRequest';
    }

    else if(url.indexOf('purchaselist')>=0)
    {

        wid+=50;
        //alert('purchase '+url)

        title= 'PurchaseList';
    }


	var popup = document.getElementById("popupFrame");

	popup.style.visibility="visible";
	popup.width=wid;
	popup.height=hght;

	
	popup.src=url;

}

/********************************************/
//for FULL SCREEN DETAILCARD ..for Increasing and decreasing Font Size*/
baseFont=10;
function fontResize(offset)
{
	var temp=baseFont+parseInt(offset);
	if(temp>5 && temp<30)
		{
			baseFont=temp;
			for(var i=0;i< document.getElementsByTagName("table").length;i++)
				document.getElementsByTagName("table")[i].style.fontSize=baseFont;
			for(var i=0;i< document.getElementsByTagName("a").length;i++)
				document.getElementsByTagName("a")[i].style.fontSize=baseFont;
		}
}
/*****************************************/
////////////////browse combo event///////////////
function MM_BRCataChange(form)
{

    if(isProcessComplete)
    {

    resetProcessComplete();
    callSubmit(form);
    }
}
function MM_BRDbChange(form)
{
    if(isProcessComplete)
    {
    resetProcessComplete();
    callSubmit(form);    
    }
}
//////////////////////end browse combo event/////////////////////////////
/*****************************************/
////////////ONCHANGE////////////(18-10-05 pra)

function callSubmit(form)
{   //alert('call submit');
    //if(isProcessComplete)
    {
    //resetProcessComplete();
	form.submit();
	}
}

function callFormSubmit(frmthis)
{   //alert('call submit..'+frmthis.form);
	//frmthis.form.submit();
}
function MM_getSearchForm()
{
//    alert("in MM_getSearchForm")
    if(isProcessComplete)
    {
    resetProcessComplete();
    var args=MM_getSearchForm.arguments;
    //alert('===='+args[1]);
    window.location="SearchForm?databaseidx="+args[0]+"&id="+args[1];
    }
}
function MS_getSearchForm()
{
    var dbSelectObj = document.getElementsByName("cmbDB")[0];
    var selectedIndex = dbSelectObj.selectedIndex;
    var selectedText = dbSelectObj.options[selectedIndex].text;
//    alert("select ind===>"+selectedIndex+"===selected text====>"+selectedText);
    if(selectedText.toLocaleUpperCase() == "COMBINED DB")
    {
       document.getElementsByName("cmblanguage")[0].disabled = false;
    }
    else
    {
        var langObj =  document.getElementsByName("cmblanguage")[0];
        var lastLangIndex = langObj.options.length;
        for(var i=0; i<lastLangIndex; i++)
        {
            if(langObj.options[i].text.toLocaleUpperCase() == "ALL")
            {
                langObj.selectedIndex = lastLangIndex -1;
                break;
             }
        }
        document.getElementsByName("cmblanguage")[0].selectedIndex = document.getElementsByName("cmblanguage")[0].options.length-1;
        document.getElementsByName("cmblanguage")[0].disabled = true;
    }

}

function MM_FirstFocus()
{
    //if(document.getElementById('txtsearch0').type != "hidden")
        //document.getElementById('txtsearch0').focus()
}
/////// CLEARS THE TEXTBOX VALUEUS/////////////
/////////////////////
function clearForm(form){

	var arr=form.elements;
	for(var i=0;i<arr.length;i++)
	{ //alert('clearform...'+arr[i].tagName);
		if(arr[i].type=='text')
		{
			arr[i].value='';
		}
	}

}

/******************************************/
function clearText(who)
{
    // global
	radioyearopt=(who.value)?parseInt(who.value):parseInt(who);

	var txtY="txtyear";
	var radY="rdoyearid";

	var start=(radioyearopt==1)?2:0;

	document.getElementById(radY+radioyearopt).checked=true;

	if(radioyearopt>1)
		document.getElementById(txtY+radioyearopt).focus();

	for(var i=start;i<5;i++)
		document.getElementById(txtY+i).value="";
}
/////////////ONRESIZE & OnLOAD/////////////////(19-10-05 pra)
function divSizeChange(e)
{

if(!document.getElementById('divTblScroll')) //Layout 1
	{
		var allTbl= document.getElementsByTagName('table');
		for(i=0;i<2;i++)
		{
		    if(allTbl[i]!=null)
			allTbl[i].width="100%";
		}
		return;
	}
else
{
	var allTbl= document.getElementsByTagName('table');

	for(i=0;i<2;i++)
		allTbl[i].width="10%";
/*****************************************/
//var toe=(document.all)? event.type : e.type;

var divTbl=  document.getElementById('divTblScroll');
var dtlCrd=  document.getElementById('dc');
var divTblSmall= document.getElementById('divTblScrollSmall');


var cWidth=(document.body.clientWidth<screen.availWidth-20)?
			screen.availWidth-150:document.body.clientWidth-130;

var	rwx=0.97;		//Layout 2

	if(divTblSmall) //Layout 4
		 {
		 	rwx=0.48;
		 	divTblSmall.style.width =Math.floor(cWidth*0.20);
		 	divTblSmall.style.height=document.body.clientHeight-195;

		 	dtlCrd.style.width =Math.floor(cWidth*0.32);
		 	dtlCrd.style.height=document.body.clientHeight-195;
		 }

	else if(dtlCrd) //Layout 3
		 {
		 	rwx=0.68;
		 	dtlCrd.style.width =Math.floor(cWidth*0.32);
		 	dtlCrd.style.height=document.body.clientHeight-195;
		 }


	divTbl.style.width =Math.floor(cWidth*rwx);
	divTbl.style.height=document.body.clientHeight-195;
}
}

function loaded()
{
 var smallBL_rowSel= document.getElementById("rowSelectedBLSmall");
 var bL_rowSel= document.getElementById("rowSelectedBL");

 if(bL_rowSel)
    bL_rowSel.scrollIntoView(false);

 if(smallBL_rowSel)
    smallBL_rowSel.scrollIntoView(false);

    divSizeChange();
}

var displayflag = false;

function MM_ShowMore(obj)
{

   var displayTbl =  document.getElementById('tblMore');
   displayflag = !displayflag;
   displayTbl.style.display = (displayflag? 'block':'none');
   obj.value = (displayflag? 'Hide...':'More...');

}

function closeOPACClient()
{
    window.location="./closeclient";
}
function transferObj(){
    var table = document.getElementById("marctable");
    var transArr = new Array();
    var key = new String();
    var val = new String();
    for(var i=0; i < table.rows.length; i++){
        var rowObj = table.rows[i] ;
        key = rowObj.getAttribute("dir");
        val = rowObj.getAttribute("lang");

        if(key.length == 4)
        {
            if(key.substr(0,3).valueOf() <= 9 && key.charAt(4) == " ")
                key = key.substr(0,3) + "a";
        }
        transArr[key] = val;
         //alert(key +  ">>>" +val);
    }

    if(window.opener)
    {
        try
        {
            opener.frames["form_display"].frames["case38M"].transfer_data(transArr);
        }
        catch(ex)
        {
            alert(ex.message);
        }
    }

}
/********************/
window.onresize=divSizeChange;
window.onload= loaded;
window.offscreenBuffering=true;
/*******************/
/*******************/


/******Corresponding to keyboard******/
function displayKeyBoard()
{
    var language = document.getElementsByName("cmblanguage")[0].value;
//    alert("in display keyboard==>"+language);
    var top = screen.availHeight * 2/3;
    var left = screen.availWidth * 1/5;
    var width = 650;
    var height = 190;
    if(language == "Hindi" && lastfocus != null)
    {
        if(subWindow != null)
       {
           subWindow.close()
       }
        subWindow = window.open("../CharacterSet.jsp?lang=1&name="+lastfocus.name,"def","height="+height+",width="+width+",top="+top+",left="+left+",scrollbars=no,location=no,resizable","win1");
        subWindow.focus();
    }
    else if(language == "Tamil" && lastfocus != null)
    {
        if(subWindow != null)
       {
           subWindow.close()
       }
        subWindow = window.open("../CharacterSet.jsp?lang=2&name="+lastfocus.name,"def","height=114,width="+width+",top="+(top+76)+",left="+left+",scrollbars=no,location=no,resizable","win1");
        subWindow.focus();
    }
    else if(language == "Telugu" && lastfocus != null)
    {
        if(subWindow != null)
       {
           subWindow.close()
       }
        subWindow = window.open("../CharacterSet.jsp?lang=3&name="+lastfocus.name,"def","height=152,width="+width+",top="+(top+38)+",left="+left+",scrollbars=no,location=no,resizable","win1");
        subWindow.focus();
    }
    else if(language == "Urdu")
    {
        if(subWindow != null)
       {
           subWindow.close()
       }
        subWindow = window.open("../CharacterSet.jsp?lang=4&name="+lastfocus.name,"def","height=266,width="+width+",top="+(top-76)+",left="+left+",scrollbars=no,location=no,resizable","win1");
        subWindow.focus();
    }
}
function displayKeyBoardFrom(obj)
{
    lastfocus = obj;
    var language = document.getElementsByName("cmblanguage")[0].value;
    var ifOpen = document.getElementById("ifOpen").value;
 //   alert("in display keyboard==>"+language+"===>"+obj.name+">");
 //       alert("in if=name===>"+obj.name+"===>"+obj.value)
        var top = screen.availHeight * 2/3;
        var left = screen.availWidth * 1/5;
        var width = 650;
        var height = 190;
        if(ifOpen == "1" && language == "Hindi")
        {
//            window("def").close();
            if(subWindow != null)
            {
               subWindow.close()
            }
            subWindow = window.open("../CharacterSet.jsp?lang=1&name="+obj.name,"def","height="+height+",width="+width+",top="+top+",left="+left+",scrollbars=no,location=no,resizable=no","win1");
            subWindow.focus();
        }
        else if(ifOpen == "1" && language == "Tamil")
        {
            if(subWindow != null)
           {
               subWindow.close()
           }
            subWindow = window.open("../CharacterSet.jsp?lang=2&name="+obj.name,"def","height=114,width="+width+",top="+(top+76)+",left="+left+",scrollbars=no,location=no,resizable","win1");
            subWindow.focus();
        }
        else if(ifOpen == "1" && language == "Telugu")
        {
           if(subWindow != null)
           {
               subWindow.close()
           }
            subWindow = window.open("../CharacterSet.jsp?lang=3&name="+obj.name,"def","height=152,width="+width+",top="+(top+38)+",left="+left+",scrollbars=no,location=no,resizable","win1");
            subWindow.focus();
        }
        else if(ifOpen == "1" && language == "Urdu")
        {
            if(subWindow != null)
            {
                subWindow.close()
            }
            subWindow = window.open("../CharacterSet.jsp?lang=4&name="+obj.name,"def","height=266,width="+width+",top="+(top-76)+",left="+left+",scrollbars=no,location=no,resizable","win1");
            subWindow.focus();
        }
    document.getElementById("ifOpen").value = "0";
}
function switchifOpen()
{
    document.getElementById("ifOpen").value = "1";
}

function closePopups()
{
   if(subWindow != null)
       {
           subWindow.close()
       }
}

function formSubmitSimple()
{
//    alert(document.getElementsByName("form")[0].action);
    if(document.getElementById("txtsearch0").value.length==0)
    {
       alert("Please Enter the search Words !!");
       return false;
    }
    else if((document.getElementById("txtsearch0").value=="and")||(document.getElementById("txtsearch0").value=="or"))
    {
        alert("Imroper Search String Entered !!");
        return false;
    }
    else if(document.getElementById("txtsearch0").value.indexOf("?")!=-1)
    {
        if(document.getElementById("txtsearch0").value.indexOf("?")==0)
        {
            alert("Left Wild-Card use not allowed !!");
            return false;
        }
        else if(document.getElementById("txtsearch0").value.indexOf("?")<3)
        {
             alert("Please enter minimum 3 characters for Wild-Card use !!");
             return false;
        }
    }
    else if(document.getElementById('year11')!=null && document.getElementById('year12')!=null &&(document.getElementsByName("docTypeForSearch")[0].value=="TN"))
    {
        var dd1 = new Date(document.getElementById('year11').value);
        var dd2 = new Date(document.getElementById('year12').value);
        var dd3 = new Date();
        var curr_date=new Date((dd3.getMonth()+1)+"/"+(dd3.getDate())+"/"+(dd3.getYear()+1900));
        if((document.getElementById('year11').value=="")&&(document.getElementById('year12').value!=""))
        {
            alert("First Date can not be empty ");
            return false;
        }
        else
        {
            if(dd1>curr_date || dd2>curr_date)
            {
                alert("Entry Date cannot exceed current date");
                return false;
            }
            if(dd1>dd2)
            {
                alert("First date can't b greater than the second date");
                return false;
            }
            else
            {
                return true;
            }
        }
    }
    return true;
}

function formSubmitAdv()
{
    if((document.getElementById("txtsearch0").value.length==0)&&(document.getElementById("txtsearch1").value.length==0)&&(document.getElementById("txtsearch2").value.length==0))
    {
        alert("Please Enter the search Words !!");
        return false;
    }
    else if((document.getElementById("txtsearch0").value=="and")||(document.getElementById("txtsearch1").value=="and")||(document.getElementById("txtsearch2").value=="and")||(document.getElementById("txtsearch0").value=="or")||(document.getElementById("txtsearch1").value=="or")||(document.getElementById("txtsearch2").value=="or"))
    {
        alert("Imroper Search String Entered !!");
        return false;
    }
    else if((document.getElementById("txtsearch0").value.indexOf("?")!=-1)||(document.getElementById("txtsearch1").value.indexOf("?")!=-1)||(document.getElementById("txtsearch2").value.indexOf("?")!=-1))
    {
        if((document.getElementById("txtsearch0").value.indexOf("?")==0)||(document.getElementById("txtsearch1").value.indexOf("?")==0)||(document.getElementById("txtsearch2").value.indexOf("?")==0))
        {
            alert("Left Wild-Card use not allowed !!");
            return false;
        }
        else if((document.getElementById("txtsearch0").value.indexOf("?")<3)||(document.getElementById("txtsearch1").value.indexOf("?")<3)||(document.getElementById("txtsearch2").value.indexOf("?")<3))
        {
             alert("Please enter minimum 3 characters for wild card use !!");
             return false;
        }
    }
   else if(document.getElementById('year11')!=null && document.getElementById('year12')!=null &&(document.getElementsByName("docTypeForSearch")[0].value=="TN"))
    {
        var dd1 = new Date(document.getElementById('year11').value);
        var dd2 = new Date(document.getElementById('year12').value);
        var dd3 = new Date();
        var curr_date=new Date((dd3.getMonth()+1)+"/"+(dd3.getDate())+"/"+(dd3.getYear()+1900));
        if((document.getElementById('year11').value=="")&&(document.getElementById('year12').value!=""))
        {
            alert("First Date can not be empty ");
            return false;
        }
        else
        {
            if(dd1>curr_date || dd2>curr_date)
            {
                alert("Entry Date cannot exceed current date");
                return false;
            }
            if(dd1>dd2)
            {
                alert("First date can't b greater than the second date");
                return false;
            }
            else
            {
                return true;
            }
        }
    }
    return true;
}
function formSubmitAdd()
{
    if((document.getElementById("txtsearch0").value.length==0)&&(document.getElementById("txtsearch1").value.length==0)&&(document.getElementById("txtsearch2").value.length==0)&&(document.getElementById("txtsearch3").value.length==0))
    {
        alert("Please Enter the search Words !!");
        return false;
    }
    else if((document.getElementById("txtsearch0").value=="and")||(document.getElementById("txtsearch1").value=="and")||(document.getElementById("txtsearch2").value=="and")||(document.getElementById("txtsearch0").value=="or")||(document.getElementById("txtsearch1").value=="or")||(document.getElementById("txtsearch2").value=="or")||(document.getElementById("txtsearch3").value=="and")||(document.getElementById("txtsearch3").value=="or"))
    {
        alert("Imroper Search String Entered !!");
        return false;
    }
   else if((document.getElementById("txtsearch0").value.indexOf("?")!=-1)||(document.getElementById("txtsearch1").value.indexOf("?")!=-1)||(document.getElementById("txtsearch2").value.indexOf("?")!=-1)||(document.getElementById("txtsearch3").value.indexOf("?")!=-1))
    {
        if((document.getElementById("txtsearch0").value.indexOf("?")==0)||(document.getElementById("txtsearch1").value.indexOf("?")==0)||(document.getElementById("txtsearch2").value.indexOf("?")==0)||(document.getElementById("txtsearch3").value.indexOf("?")==0))
        {
            alert("Left Wild-Card use not allowed !!");
            return false;
        }
        else if((document.getElementById("txtsearch0").value.indexOf("?")<3)||(document.getElementById("txtsearch1").value.indexOf("?")<3)||(document.getElementById("txtsearch2").value.indexOf("?")<3)||(document.getElementById("txtsearch3").value.indexOf("?")<3))
        {
             alert("Please enter minimum 3 characters for wild card use !!");
             return false;
        }
    }
   else if(document.getElementById('year11')!=null && document.getElementById('year12')!=null &&(document.getElementsByName("docTypeForSearch")[0].value=="TN"))
    {
        var dd1 = new Date(document.getElementById('year11').value);
        var dd2 = new Date(document.getElementById('year12').value);
        var dd3 = new Date();
        var curr_date=new Date((dd3.getMonth()+1)+"/"+(dd3.getDate())+"/"+(dd3.getYear()+1900));
        if((document.getElementById('year11').value=="")&&(document.getElementById('year12').value!=""))
        {
            alert("First Date can not be empty ");
            return false;
        }
        else
        {
            if(dd1>curr_date || dd2>curr_date)
            {
                alert("Entry Date cannot exceed current date");
                return false;
            }
            if(dd1>dd2)
            {
                alert("First date can't b greater than the second date");
                return false;
            }
            else
            {
                return true;
            }
        }
    }
    return true;
}
function prn(userInfo,tblhead,tblwd)
{
//  var starray=;
//alert("int js rpint ");    
var tableContent = tblcon;

    while(tableContent.indexOf("~~")!=-1)
    {
        tableContent=tableContent.replace("~~","'");
    }
    while(userInfo.indexOf("~~")!=-1)
    {
        userInfo=userInfo.replace("~~","'");
    }
    var bars='scrollbars=yes,directories=no,location=no,menubar=no,status=no,titlebar=yes,toolbar=no,';
    var options ='width=600,height=500,resizable=yes';
    var title= 'OpacPrint';

    //if(url.indexOf("http://")<0)
    //url="http://"+url;

    var popup=window.open('',title,bars+options);
    if((tblhead!=''))
    {
        var contentArray=tableContent.split("$$")
//        alert(contentArray[0].indexOf("\u001F"));
        var val=document.getElementById("brieflistarray");
//        alert(document.getElementById("brieflistarray"));
        var tableheader=tblhead.split(";")
        var tablewidth=tblwd.split("$$");
        popup.document.open();
        //alert(tableContent);
        popup.document.write("<html><body onload='javascript:print()'>");
        popup.document.write("<div style='overflow:overflow;height:100%;width:100%;'>");
        popup.document.write(userInfo);
        popup.document.write("<table border='0' width='99.9%' style='font-family:Arial Unicode MS;'>");
        popup.document.write("<tr>");
        for(var j=0;j<tableheader.length-1;j++)
        {
            popup.document.write("<td width='"+tablewidth[j]+"%' style='font-size:20px' align='left'>"+tableheader[j]+"</td>");
        }
        popup.document.write("</tr>");
        for(var i=0;i<contentArray.length-1;i++)
        {
            var fields = contentArray[i].split("^^");
            popup.document.write("<tr>");
            for(var ii=0;ii<fields.length-1;ii++)
            {
                popup.document.write("<td width='"+tablewidth[ii]+"%' cellpadding='5' cellspacing='5'>"+fields[ii]+"&nbsp;</td>");
            }
            popup.document.write("</tr>");
        }
       popup.document.write("<tr><td colspan='"+(contentArray.length-1)+">&nbsp;</td></tr><tr><td colspan='"+(contentArray.length-1)+">&nbsp;</td></tr><tr><td colspan='"+(contentArray.length-1)+">&nbsp;</td></tr><tr><td colspan='"+(contentArray.length-1)+" align='left'>*OverDue Item(s)</td></tr>");
       popup.document.write("</table>");
       popup.document.write("</div></body></html>");
    }
    else
    {
//        alert(tableContent);
        tableContent.toString().replace("**","'");
//        alert(tableContent);
        popup.document.write("<html><body onload='javascript:print()'>");
        popup.document.write("<div style='overflow:overflow;height:100%;width:100%;'>");
        popup.document.write("<table border='1' width='99.9%'>");
        popup.document.write("<tr><td>");
        popup.document.write(tableContent);
        popup.document.write("</td></tr>");
        popup.document.write("</div></body></html>");

    }
    popup.document.close();
}
function prn1(q,w,e)
{
alert("the print value is " + document.getElementById("tablecontent").value);
}
function storeValue(ss)
{
//alert(ss);
tblcon=tblcon+ss+"$$";
}

