// Jalgaon janta Sahakari Bank Ltd
// Java script source file
// Start date: 01/01/2010
// Authors - Sumesh Patil, UBS

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = '/slideshow/promo1.jpg'
Pic[1] = '/slideshow/promo2.jpg'
Pic[2] = '/slideshow/promo3.jpg'
Pic[3] = '/slideshow/promo4.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
//  End -->

// validate income tax 
function valincometax(f)
{
	if (chkselect(f.ay,"Select Assessment Year...")==0)
		return 0;
	if (chkselect(f.pstatus,"Select Payee Status...")==0)
		return 0;
	if (chkblank(f.income,"Please specify your income to compute tax...")==0)
		return 0;
	if (f.income.value<0)
	{
		alert("Oops... You dont have to pay any income tax as there is loss...");
		return 0;
	}
	f.submit();
	return 1;
}

// validate member login
function vallogin(t)
{
	if(t.uname.value=="")
	{
		alert("Please specify your Member ID....");
		t.uname.focus();
		return 0;
	}
	if(t.upwd.value=="")
	{
		alert("Please specify your Login Password....");
		t.upwd.focus();
		return 0;
	}
	t.submit();
	return 1;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i>a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validatefrm(t,secverify)
{

	if(t.name.value=="")
	{
		alert("Please specify your Name....");
		t.name.focus();
		return 0;
	}
	var emailID=t.email
	if (echeck(emailID.value)==false)
	{
		emailID.value=""
		emailID.focus()
		return false
	}

	if(t.phones.value=="")
	{
		alert("Please specify your Contact Mobile/ Phone Numbers....");
		t.phones.focus();
		return 0;
	}

	if(t.comments.value=="")
	{
		alert("Please specify your Comments/ Suggestions....");
		t.comments.focus();
		return 0;
	}
	if(t.strCAPTCHA.value=="")
	{
		alert("Please specify capture code shown in image above - Used for controlling automated harvesting....");
		t.strCAPTCHA.focus();
		return 0;
	}
	  
	t.submit();
	return 1;
}

function CheckNumber(input)
{
	var str = input.value;
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if ((ch < "0" || "9" < ch) && ch != '.'  && ch!=",") 
			{
       	      	alert("Please Enter Numeric Value...");
				input.focus();
		        return false;
	    	}
	}
	return true;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function testASP(checkvalue)
{
	var ASPCodePat = /<%(.|\n)*%>|<script(.|\n)*script>|<style(.|\n)*style>|<meta[\s]/gi;
	var testForASP = checkvalue.match(ASPCodePat);

	if (testForASP !== null)
	{
		alert("Sorry could not post your contents - submission contains harmful contents...");
		return false;
	}
	return true;
}

// validate new member registration 
function validreg(f,reg)
{
	if (chkblank(f.name,"Please specify full name!")==0)
		return 0;

	bdv=f.bdd.selectedIndex;
	bmv=f.bmm.selectedIndex;
	byv=f.byy.selectedIndex;
	if(bdv>0 || bmv>0 || byv>0)
		if (chkseldate(f.bdd,f.bmm,f.byy,"Invalid birthdate!")==0)
			return 0;

	bdv=f.add.selectedIndex;
	bmv=f.amm.selectedIndex;
	byv=f.ayy.selectedIndex;
	if(bdv>0 || bmv>0 || byv>0)
		if (chkseldate(f.add,f.amm,f.ayy,"Invalid Anniversary date!")==0)
			return 0;

	if (echeck(f.email.value)==false)
	{
		f.email.value="";
		f.email.focus();
		return 0;
	}
	if (reg==1)
	if (chkblank(f.pwd,"Please set a password for your account! It's your key to login.")==0)
		return 0;
	if(f.pwd.value!=f.pwdcnf.value)
	{
		alert("Please confirm your password...");
		f.pwdcnf.focus();
		return 0;
	}
	if (chkblank(f.address,"Please key in the proper address!")==0)
		return 0;

	if (chkblank(f.city,"Please specify your city name!")==0)
		return 0;

	if (chkselect(f.state,"Select state!")==0)
		return 0;

	resi1=f.llineno.value;
	off1=f.llinestd.value;
	mob1=f.mobile.value;
	if (resi1=="" && mob1=="")
	{
		alert("Please specify atleast one contact number!");
		f.mobile.focus();
		return 0;
	}
	
	if (off1!="")
		if (phnocheck(f.llineno)==0)
			return 0;

	if  ((f.resi1!="" && f.off1=="") || (f.off1!="" && f.resi1==""))
		{
			alert("Please specify std code with phone number!")
			f.llinestd.focus();
			return 0;
		}

	if (mob1!="")
		if (mobcheck(f.mobile)==0)
			return 0;
	if (reg==1)
	{
	if (chkblank(f.strCAPTCHA,"Please type the code as shown in the image!")==0)
		return 0;
	f.action="/ca/register.asp";
	}
	else
	f.action="/myaccount/editprofile.asp";
	f.submit();
	return 1;
}

//Blank textfield validation
function chkblank(t,msg)
{
	if (t.value=="")
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

//validation for selection list
function chkselect(t,msg)
{
	selno = t.selectedIndex; 
	
	selvalue = t.options[selno].value; 
	if (selvalue==0)
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

function chkradio(r,msg)
{
myOption = -1;
	
	for (i=r.length-1; i > -1; i--) {
	if (r[i].checked) {
		myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert(msg);
	return 0;
	}
}

//validation for phone/mobile
function phnocheck(input)
{
	var str = input.value;
	if (str!="")
	{
		for (var i = 0; i < str.length; i++) 
		{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return false;
	    	}
		}
	}
	return true;
}

function mobcheck(input)
{
	var str = input.value;
	if (str.length!=10)
	{
		alert("Invalid Phone number...");
		input.focus();
	    return false;
	}
	if (str.substring(1,0)!="9")
	{
		alert("Invalid Phone number...");
		input.focus();
	    return false;
	}
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return false;
	    	}
	}
	return true;
}

function chkseldate(dy,mth,yrs,msg)
{
	td=dy.selectedIndex;
	td=dy.options[td].value;
	if (td==0)
	{
		alert("Please specify date!");
		dy.focus();
		return 0;
	}
	tm=mth.selectedIndex;
	tm=mth.options[tm].value;
	if (tm==0)
	{
		alert("Please specify Month!");
		mth.focus();
		return 0;
	}
	ty=yrs.selectedIndex;
	ty=yrs.options[ty].value;
	if (ty==0)
	{
		alert("Please specify Year!");
		yrs.focus();
		return 0;
	}
	md=monthdays(tm,ty);
	if (td>md)
	{
		alert(msg);
		dy.focus();	
		return 0;
	}
	else
	
		return 1;
}

function monthdays(mon1,yr)
{
	switch (mon1){	
	case "2":
		if (yr==0)
			mdays=29;
		else
		{
			lp1=yr % 400;
			if (lp1==0)
				mdays=29;
			else
			{
				lp2=yr % 4;
				lp3=yr % 100;
				if ((lp2==0) && (lp3>0))
					mdays=29;
				else
					mdays=28;
			}
		}
		break;
	case "4":	
	case "6":
	case "9":	
	case "11":
		mdays=30;
		break;
	default:
		mdays=31;
		break;
	}
	return mdays;
}	

function changepwd(frm)
{
	if (chkblank(frm.oldpwd,"Please specify your old password!")==0)
		return 0;
	if (chkblank(frm.loginpwd,"Please specify new password!")==0)
		return 0;
	if (chkblank(frm.confpwd,"Please confirm the password by retyping it!")==0)
		return 0;
	if (frm.loginpwd.value!=frm.confpwd.value)
		{
			alert("New passwod does not match with the confirm password. Make sure they are same!");
			frm.confpwd.focus();
			return 0;
		}
	frm.submit();
	return 1;
		
}

function resetpwd(frm)
{
	if (chkblank(frm.loginpwd,"Please specify new password!")==0)
		return 0;
	if (chkblank(frm.confpwd,"Please confirm the password by retyping it!")==0)
		return 0;
	if (frm.loginpwd.value!=frm.confpwd.value)
		{
			alert("New passwod does not match with the confirm password. Make sure they are same!");
			frm.confpwd.focus();
			return 0;
		}
	frm.submit();
	return 1;
		
}

function searchby(frm)
{
	stype=frm.srch.selectedIndex;
	if (stype!=0)
	{
	sval=frm.srch.options[stype].text;
	srchtext="Search By " + sval +":";
	frm.txtby.value=srchtext;
	frm.txtsrch.value="";
	frm.txtsrch.focus();
	frm.hsfld.value=frm.srch.options[stype].value;
	}
	else
	{
	frm.txtby.value="";
	frm.txtsrch.value="";
	frm.hsfld.value="";
	}
	return 1;
}

function hidealldiv(cnt)
{
	for(i=1;i<=cnt;i++)
		document.getElementById('hid' + i).style.display='none';
}

function showdivsel(f,i)
{
	s1=eval("f.sel" + i+ ".selectedIndex;");
	s1=eval("f.sel" + i + ".options[s1].value;");
	if (s1==1)
		document.getElementById('hid'+ i ).style.display='block';
	else
		document.getElementById('hid' + i ).style.display='none';
}

function valfile(f)
{
	if (chkblank(f.name,"Name cannot be left blank")==0)
		return 0;
	if (chkblank(f.pan,"Please specify PAN No: ")==0)
		return 0;
	f.submit();
	return 1;	
}

function requestservice(i,j,f)
{
	alert("f.hstatus" + i + j + ".value");
	st=eval("f.hstatus" + i + j + ".value");
	alert(st);
	document.getElementById('divimg' + i + j).innerHTML="<img src='/images/deleteimages.jpg' border=0 height=20 width=20 alt='cross'>"
}

function showsernm(f)
{
	ser=f.name.selectedIndex;
	ser=f.name.options[ser].text;
	ser=ser.substring(0,3);
	f.sernm.value=ser;
}

function confser()
{
	p=confirm("Your service request will be sent to the administrator for approval.Are you sure of submitting the approval request?");
	if (p==1) 
		window.location.href="newfileservice.asp"
		
}

function newuser(frm)
{
		if(frm.userid.value=="")
		{
			alert("Please specify USERID for new account...");
			frm.userid.focus();
			return false;
		}
		if(frm.loginpwd.value=="")
		{
			alert("Please specify login password for new account...");
			frm.loginpwd.focus();
			return false;
		}
		if(frm.fullname.value=="")
		{
			alert("Please specify full name of this account user...");
			frm.fullname.focus();
			return false;
		}
		var emailID=frm.email
		if (echeck(emailID.value)==false)
		{
			emailID.value=""
			emailID.focus()
			return false
		}
		if (chkselect(frm.logintype,"Please select the user logintype!")==0)
			return 0;

	frm.submit();
	return true;
}

function resetuser(frm)
{
	if (chkselect(frm.users,"Please select user!")==0)
		return 0;
	if (chkblank(frm.loginpwd,"Please specify login password!")==0)
		return 0;
	if (chkblank(frm.confpwd,"Please confirm the password by retyping it!")==0)
		return 0;
	if (frm.loginpwd.value!=frm.confpwd.value)
		{
			alert("Login passwod does not match with the confirm password. Make sure they are same!");
			frm.confpwd.focus();
			return 0;
		}
	frm.submit();
	return 1;
		
}

function balerts(frm)
{
	Item = frm.userid.selectedIndex; 
	Resultd = frm.userid.options[Item].text; 
	if(Resultd=="--- Select ---")
	{
		alert("Please specify at least one user to send message...");
		frm.userid.focus();
		return false;
	}	
	if(frm.msg.value=="")
	{
		alert("Please specify text to be sent to User...");
		frm.msg.focus();
		return false;
	}
	frm.submit();
	return true;
}


function chkrecord(f,recid)
{
	topform=window.document.fin;

	if(checkdespatchdate==true)
		if(chktextdate(topform.despatchdate,"Please specify valid despatch date...")==0)
			return 0;

	if(checkentryfields==true)
	{
		if (topform.trucknumber.value =="")
		{
			alert("Please specify valid truck number!");
			topform.trucknumber.focus();
			return 0;
		}
		if (topform.freightpayable.value =="")
		{
			alert("Please specify freight payable!");
			topform.freightpayable.focus();
			return 0;
		}
		if (topform.roadpermit.value =="")
		{
			alert("Please specify Road Permit details!");
			topform.roadpermit.focus();
			return 0;
		}
		if (topform.invoice1.value=="" && topform.invoice2.value=="" && topform.invoice3.value=="" && topform.invoice4.value=="" && topform.invoice5.value=="" )
		{
			alert("Please specify at least one invoice number to proceed ahead...");
			topform.invoice1.focus();
			return 0;
		}
		
		if (topform.invoice1.value!="" && (topform.invamount1.value==0 || topform.invdate1.value==""))
		{
			if(chktextdate(topform.invdate1,"Please specify valid Invoice Date#1")==1)
			{
				alert("Please specify Invoice Amount for Invoice#1 ");
				topform.invamount1.focus();
			}
			return 0;
		}
		if (topform.invoice2.value!="" && (topform.invamount2.value==0 || topform.invdate2.value==""))
		{
			if(chktextdate(topform.invdate2,"Please specify valid Invoice Date#2")==1)
			{
				alert("Please specify Invoice Amount for Invoice#2 ");
				topform.invamount2.focus();
			}
			return 0;
		}
		if (topform.invoice3.value!="" && (topform.invamount3.value==0 || topform.invdate3.value==""))
		{
			if(chktextdate(topform.invdate3,"Please specify valid Invoice Date#3")==1)
			{
				alert("Please specify Invoice Amount for Invoice#3 ");
				topform.invamount3.focus();
			}
			return 0;
		}
		if (topform.invoice4.value!="" && (topform.invamount4.value==0 || topform.invdate4.value==""))
		{
			if(chktextdate(topform.invdate4,"Please specify valid Invoice Date#4")==1)
			{
				alert("Please specify Invoice Amount for Invoice#4 ");
				topform.invamount4.focus();
			}
			return 0;
		}
		if (topform.invoice5.value!="" && (topform.invamount5.value==0 || topform.invdate5.value==""))
		{
			if(chktextdate(topform.invdate5,"Please specify valid Invoice Date#5")==1)
			{
				alert("Please specify Invoice Amount for Invoice#5 ");
				topform.invamount5.focus();
			}
			return 0;
		}
	}
	for(i=1;i<=recid;i++)
	{
		if(skipselectbox==true)
			isok=1;
		else
		{
		iif=eval("f.selcat" + i + ".selectedIndex;")
		iiffocus=("f.selcat" + i + ".focus();")
		iif=eval("f.selcat" + i + ".options[iif].text;")
	
		iid=eval("f.selitem" + i + ".selectedIndex;")
		iifocus=("f.selitem" + i + ".focus();")
		iid=eval("f.selitem" + i + ".options[iid].text;")
		isok=1;
	
		if(iif=="--Select--")
		{
			alert("Please specify category...");
			eval(iiffocus);
			isok=0;
			return false;
		}
	
		if(iid=="--Select--" || iid=="-Select-")
		{
			alert("Please specify item...");
			eval(iifocus);
			isok=0;
			return false;
		}
		}
			
		qty=eval("f.qty" + i + ".value;");
		qtyfocus=("f.qty" + i + ".focus();");
	}

	if(isok==1)
	{
		calwt(f,recid);
		iheight=(parseInt(recid)*35)+50+35;
		//window.document.getElementById('dataentryframe').style.height=iheight;
		tframe.ftable.submit();
		return true;
	}
	else
		return false;
}

function formattext(f,cnt,id)
{
var txtar = eval("document.getElementById('" + id + "')");
txtval=f.descrip.value;

var IE = document.all?true:false;

if (IE)
{
	var sel = document.selection.createRange();
	if (sel!=""){
		switch (cnt)
				{
					case 1:				
						sel.text = '<b>' + sel.text + '</b>';
						break;
					case 2:
						sel.text = '<i>' + sel.text + '</i>';
						break;
					case 3:
						sel.text = '<u>' + sel.text + '</u>';
						break;
					case 4:
						fface=f.fontface.selectedIndex;
						fface=f.fontface.options[fface].value;
						sel.text = "<font face='" + fface + "'>"  + sel.text + '</font>';
						break;
					case 5:
						fface=f.fontsz.selectedIndex;
						fface=f.fontsz.options[fface].value;
						sel.text = "<font size=" + fface + ">"  + sel.text + '</font>';
						break;
				}
			 }
}
else
{
	
	start=f.descrip.selectionStart;
	end=f.descrip.selectionEnd;
	len=txtval.length;
	var sel=txtval.substring(start,end);
	
	if (sel!="")
	{		switch (cnt)
				{
					case 1:				
							sel= "<b>" + sel + "</b>";
							f.descrip.value=txtval.substring(0,start) + sel + txtval.substring(end,len);
						break;
					case 2:
							sel = "<i>" + sel + "</i>";
							f.descrip.value=txtval.substring(0,start) + sel + txtval.substring(end,len);
						break;
					case 3:
							sel = "<u>" + sel + "</u>";
							f.descrip.value=txtval.substring(0,start) + sel + txtval.substring(end,len);
						break;
					case 4:
							fface=f.fontface.selectedIndex;
							fface=f.fontface.options[fface].value;
							sel = "<font face='" + fface + "'>"  + sel + '</font>';
							f.descrip.value=txtval.substring(0,start) + sel + txtval.substring(end,len);
						break;
					case 5:
						fface=f.fontsz.selectedIndex;
						fface=f.fontsz.options[fface].value;
						sel= "<font size=" + fface + ">"  + sel + '</font>';
						f.descrip.value=txtval.substring(0,start) + sel + txtval.substring(end,len);
						break;
				}
			} 
		}
			fillmsg(f);
f.descrip.focus();

}

function fillmsg(f)
{
	window.document.getElementById('fprev').style.display="block";
	showpreview(1);
	window.document.getElementById('preview').innerHTML=f.descrip.value;
}

function showLinkEditor(){
e = document.getElementById('linkInsert');
if(e.style.display=="none") e.style.display = "block";
else e.style.display = "none";
}

function insertLink(f){
content = f.descrip.value;
linkText = document.getElementById('l1').value;
linkUrl = document.getElementById('l2').value;
protocol = document.getElementById('prot').value;
lnk = "<a href='"+protocol+linkUrl+"' target='_blank'>"+linkText+"</a>&nbsp;";
f.descrip.value = content+lnk;
document.getElementById('l1').value="";
document.getElementById('l2').value="";
document.getElementById('linkInsert').style.display="none"; 
fillmsg(f);
}

function showpreview(cnt){
e = document.getElementById('preview');
if (cnt==1)
	e.style.display="block";
else
	 e.style.display = "none";

}

//function to find coordinates on mouse move

//document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {


var IE = document.all?true:false;
//if (!IE) document.captureEvents(Event.MOUSEMOVE)
if (IE) { // grab the x-y pos.s if browser is IE

tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS

tempX = e.pageX;
tempY = e.pageY;

}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
document.form1.MouseX.value = tempX;
document.form1.MouseY.value = tempY;
return true;
}


function showdiv(cnt,uid){

e = document.getElementById('clientdet');
if (cnt==1)
	{
	e.style.display="block";
 	
  // document.getElementById("clientdisp").style.left = (pos_x-1) ;
   document.getElementById("clientdisp").style.top = eval(form1.MouseY.value ) ;

	document.getElementById('tnm').innerHTML="<b>" + eval('form1.nm' + uid + '.value') + "</b>";
	document.getElementById('tfnm').innerHTML=eval('form1.fnm' + uid + '.value');
	document.getElementById('tadd').innerHTML=eval('form1.address' + uid + '.value') + "\n" + eval('form1.city' + uid + '.value') + "\n" + eval('form1.state' + uid + '.value') + "\n" + eval('form1.pin' + uid + '.value');
	document.getElementById('temail').innerHTML=eval('form1.email' + uid + '.value');
	document.getElementById('tphone').innerHTML="<font face='Wingdings'>(</font> (" + eval('form1.stdcode' + uid + '.value') + ")" + eval('form1.phone' + uid + '.value');
	document.getElementById('tmobile').innerHTML="Mobile : " + eval('form1.mobile' + uid + '.value');
	}
else
	 e.style.display = "none";

}

function replacecarriagereturn(textarea,replaceWith)   
{    
 textarea.value = escape(textarea.value);   
  //encode all characters in text area   
  //to find carriage return character   
 for(i=0; i < textarea.value.length; i++)   
 {    
  //loop through string, replacing carriage return    
  //encoding with HTML break tag   
  if(textarea.value.indexOf("%0D%0A") > -1)   
  {    
   //Windows encodes returns as \r\n hex   
   textarea.value=textarea.value.replace("%0D%0A",replaceWith);   
  }   
 else if(textarea.value.indexOf("%0A") > -1)   
  {    
   //Unix encodes returns as \n hex   
   textarea.value=textarea.value.replace("%0A",replaceWith);   
  }   
  else if(textarea.value.indexOf("%0D") > -1)   
  {    
  //Macintosh encodes returns as \r hex   
 textarea.value=textarea.value.replace("%0D",replaceWith);   
}   
}   
textarea.value=unescape(textarea.value);   
//decode all characters in text area back 
}

function vernotice(t)
{
	replacecarriagereturn(t.descrip,"<br>");
	if(t.type.value=="")
	{
		alert("Please specify notice type...");
		t.type.focus();
		return 0;
	}
	if(t.descrip.value=="")
	{
		alert("Please specify descrption...");
		t.desc.focus();
		return 0;
	}
	t.action="addnotices.asp";
	t.submit();
	return 1;
}

function cdelnotices(nid)
{
	x=confirm("Are you sure of deleting this notice!");
	if (x==true)	
		{
		document.location.href="delnotices.asp?id=" + nid;
		//window.close();
	}
}
function showiff(rid)
{
document.getElementById('vlist1').style.display='block';
 document.getElementById('iff').innerHTML="<iframe src='viewbranch.asp?rid=" + rid + "' frameborder=0 height=420 width=350>"
 }
 
 function showloan(rid)
{
document.getElementById('vlist').style.display='block';
 document.getElementById('lon').innerHTML="<iframe src='../viewloan.asp?rid=" + rid + "' frameborder=0 height=500 width=375>"
 } 
 
 function valbranch(f)
 {
 	if (chkblank(f.txtcity,"Please specify City Name!")==0)
		return 0;
		f.submit();
	return 1;
 }
  function valfd(f)
 {
 	if (chkradio(f.rbint,"Please Specify Category !")==0)
		return 0;
    if (chkblank(f.txtamt,"Please specify Amount!")==0)
		return 0;
	if (CheckNumber(f.txtamt)==0)
			return 0;
	if (chkblank(f.txtdays,"Please specify Days!")==0)
		return 0;
	if (CheckNumber(f.txtdays)==0)
			return 0;
		
		f.submit();
	return 1;
 }

function showimg(mmid)
{
	
	window.open(mmid,"Geneology","resizable=no,toolbar=0,location=0,menubar=0,status=0,height=200,top=220,left=250,width=430,,scrollbars=0");	
}

function getimg(cntt,ipath)
{
	window.open("dispimg.asp?i=" + cntt + "&folder=" + ipath,"viewimage","resizable=yes,toolbar=0,location=0,menubar=0,status=0,height=700,top=14,left=62,width=900,,scrollbars=1");	
}

function loanval(f)
 {
 if (chkblank(f.loanamount,"Please specify Loan Amount!")==0)
		return 0;
		if (CheckNumber(f.loanamount)==0)
			return 0;
    if (chkblank(f.tenure,"Please specify Months!")==0)
		return 0;
	if (CheckNumber(f.tenure)==0)
			return 0;
	if (chkblank(f.irate,"Please specify Interest Rate!")==0)
		return 0;
	if (CheckNumber(f.irate)==0)
			return 0;
		
		f.submit();
	return 1;
 }

function valrd(f)
 {
 	if (chkradio(f.rbint,"Please Specify Category !")==0)
		return 0;
    if (chkblank(f.txtamt,"Please specify Amount!")==0)
		return 0;
	if (CheckNumber(f.txtamt)==0)
			return 0;
	if (chkblank(f.txtdays,"Please specify Months!")==0)
		return 0;
	if (CheckNumber(f.txtdays)==0)
			return 0;
		
		f.submit();
	return 1;
 }
