/***********************************************
* Drop Down/ Overlapping Content- Â© Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype)
{
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
	return true
}


function overlayclose(subobj){
	document.getElementById(subobj).style.display="none"
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}



/*This function trims input string*/
function trim(inputString) {
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") {
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") {
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1) {
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
	}
	return retValue;
}

/*This function checks for the validity of emailId*/
function checkemail(emailadd)
{
	var result = true;

	var theStr = new String(emailadd);
	var Expression = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	//var Expression = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
	if(theStr.match(Expression))
	{
		result = false;
	}

	return result;
}
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


/********** Function MM_jumpMenu*************/


 /************End *******/
 function SelectDate(x,y)
        {
                a=arguments
                D = document.getElementById('Date1').value;
                if(D){
                        D = D.split('/');
                }else{
                        Dat = new Date();
                        D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
                }
        	
		win=MM_openBrWindow('acdadmin/date-picker.html','win','width=150px,height=180px,center=1,resize=0,scrolling=1,status=no,left='+x+',top='+y);
                if (parseInt(navigator.appVersion) == 2 && navigator.appName == "Netscape")
                win = window.open("acdadmin/date-picker.html","win","status=yes,height=325,width=250,top="+y+",left="+x);
        }
        function SetDate(Day, Month, Year)
        {
		if(Month <9)
		Month='0'+Month;
		if(Day < 9)
		Day ='0'+Day;
                document.getElementById('Date1').value = Day +'-'+ Month + '-' +Year ;

        }


