function settextboxval(obj,val)
{
	tempobj = eval("document.form1."+obj); 
	tempobj.value = val;
}
function opencal(txtname,caltype)
{
xpos = 100;
ypos = 200;
wid = 275;
heigh = 220;
if(caltype =='d')
{
xpos = 110;
ypos = 210;
wid = 155;
heigh = 160;
}
if(caltype =='t')
{
xpos = 110;
ypos = 210;
wid = 90;
heigh = 156;
}
		if (window.external) 
			{
				Scene_Wnd = window.open('calendar.asp?txtname='+txtname+'&caltype='+caltype,'CALENDARTIME','toolbar=no,directories=no,menubar=no,scrollbars=no,status=no,resizeable=no,top='+xpos+',left='+ypos+',width='+wid+',height='+heigh);
				Scene_Wnd.focus();
			}
			else
			{
				Scene_Wnd = window.open('calendar.asp?txtname='+txtname+'&caltype='+caltype,'CALENDARTIME','toolbar=no,directories=no,menubar=no,scrollbars=no,status=no,resizeable=no,top='+xpos+',left='+ypos+',width='+wid+',height='+heigh);
				Scene_Wnd.focus();
			}
	return false;  
}
var delop;
function senddel(delop)
{
flag = confirm("Are you Sure to Delete");
if (flag == 1)
	{send1('del')
return false;
	}
}
//Variables to store the previous image which is used to swap out when mouse out takes place.
document.previousobj="";
document.previous="";
// This function swaps in a new image when a mouse over event takes place.
function swapin(obj,img1)
{
	document.previous = new Image;
	document.previous.src = obj.src;
	document.previousobj = obj;
	obj.src=img1;
}
//This function swapsout to the preious image when a mouse out event takes place.
function swapout()
{
	document.previousobj.src=document.previous.src;
}
function emailchk()
{
 len =  document.form1.empmailid.value.length;
	var check_id = 0;
        for (i=1;i<=len;i++)
        {
                val = document.form1.empmailid.value.charAt(i);
                if(val =='@')
                {for (;i<=len;i++)
        			{
                		val = document.form1.empmailid.value.charAt(i);
              			if(val =='.')
                			{
                               check_id = 1;
               			}
        			}
                  }
        }
if(check_id == 0)
{
        alert ("Give valid mail id " );
		document.form1.empmailid.focus();     
		return false;
 }       
else
{
return true;
}
}
function altewithnull(fds)
{
m_var=fds.value
	m_length = m_var.length
	for(i=0; i<m_length;i++)
	{
		if (m_var.substring(i,i+1)== " " )
		{
			alert("Blank spaces not allowed");
			return false;
		}
	}
return true;
}
function alte(fds,alerts)
{
	fields = fds.value
	fields=fields.replace(/^[\s]+/g,"");
    	fields=fields.replace(/[\s]+$/g,"");
	fds.value = fields
	if((fds.value.indexOf('"') != -1) ||(fds.value.indexOf("'") !=-1))
		{
			alert("Special Characters Not allowed");
			fds.value = "";
			fds.focus();			
			return false;
		}
		if(fields=="")
		{
			alert("Please fill the "+ alerts);
			fds.focus();
			return false;
		}
		else 
		{
			return true;
		}
}
function altelist(fds,alerts)
{
		if((fds.options.selectedIndex==0)||(fds.options.selectedIndex==-1))
		{
		alert("Please select the "+ alerts);
		fds.options.selectedIndex=0
		fds.focus();
		return false;
		}
		else 
		{return true;
		}
}
function numchk(fds,alerts)
{
		if(isNaN(fds.value))
		{
		alert("Please Enter Numeric Values for "+ alerts);
		fds.focus();
		return false;
		}
		else 
		{return true;
		}
}
function checkdate(dtfld,alertmesg)
{
slashcount = 0;
startvar = 0;
for(i=0; i<dtfld.value.length; i++)
{
	if(dtfld.value.charAt(i) == '/')
	{	
		slashcount++;
		tempdate = dtfld.value.substring(startvar,i);
		startvar = i+1;	
	//alert("startvar"+startvar+"tempdate"+tempdate);
		if(isNaN(tempdate))
		{
		alert("Enter "+alertmesg+" in the format dd/mm/yy");
		dtfld.focus();
		return false;
		}
			switch(slashcount) 
			{
			case 1:
					if (tempdate >31)
						{alert("Enter "+alertmesg+" in the format dd/mm/yy");
						dtfld.focus();
						return false;
						}
					break;
			case 2:
					if (tempdate >12)
						{alert("Enter "+alertmesg+" in the format dd/mm/yy");
						dtfld.focus();
						return false;
						}
					else {
							  return true
					     }	
					break;
			}
	}
	}
dtfld.focus();	
alert("Enter "+alertmesg+" in the format dd/mm/yy");
return false;
}
function titlehomesend()
{
urlfinal  = new Array()
url = self.location;
url =url +'';
urlfinal = url.split('?')
self.location = urlfinal[0]
}
function start()  
{ 
    objXmlHTTP = new ActiveXObject("Microsoft.XMLHTTP") ;  
    objXmlDOM = new ActiveXObject("Microsoft.XMLDOM")  ;  
}  
function dynamiclistbox(firstlist,secondlist,id)
{
	var url_category ="dynamiclistboxes.asp?id="+id+"&l1=" + eval("firstlist["+firstlist.selectedIndex+"].value");
	start();
	next_data = "";
	objXmlHTTP.open("POST",url_category,false);  
	objXmlHTTP.send("");  
	next_data = objXmlHTTP.ResponseText;
	array1 = next_data.split("~~~");
	count = secondlist.options.length;		
	for(i=1;i<count;i++)
	{
		secondlist.options[1]=null;
	}	
	var count = array1.length;
	for(i=0;i<count-1;i++)
	{	
		array2 = array1[i].split("***");
		secondlist.options[i+1]=new Option(array2[0],array2[1])
	}
}
function dynamiclistbox1(firstlist,secondlist,id)
{
	var url_category ="dynamiclistboxes.asp?id="+id+"&l1=" + eval("firstlist["+firstlist.selectedIndex+"].value");
	start();
	next_data = "";
	objXmlHTTP.open("POST",url_category,false);  
	objXmlHTTP.send("");  
	next_data = objXmlHTTP.ResponseText;
	document.write(next_data)
}
function nullcheckdate(dtfld,alertmesg)
{
	if(dtfld.value != "") 
	{
		return(checkdate(dtfld,alertmesg))
	}
	return true
}
function comdate(sdate,edate)
{
if (Date.parse(sdate.value) >= Date.parse(edate.value)) 
{
/*	alert("End Time is Greater than Start Time")
	document.form1.dlbendtime.focus()
*/
	return true
}
else
	return true
}
document.write("<STYLE TYPE='text/css'>A { text-decoration: none; }A:hover { text-decoration: underline; }</STYLE>");
