	// for date function
	 function showDate(dateS)
	 {alert("ShowDate method in includejs_home.js");
	    if(dateS !=null && dateS!="")
		{
			var arrD= dateS.split("-");
			if(date_format=="mm/dd/yyyy")
			{
				return arrD[1]+"/"+arrD[2]+"/"+arrD[0];
			}
			else
			{
				return arrD[2]+"/"+arrD[1]+"/"+arrD[0];
			}
		}
		else
		return "";
	 }
	 function showDateH(dateS)// function for dates without year on homepage
	 {alert("showDateH method in includejs_home.js ");
	    if(dateS !=null && dateS!="")
		{
			var arrD= dateS.split("-");
			if(date_format=="mm/dd/yyyy")
			{
				return arrD[1]+"/"+arrD[2];
			}
			else
			{
				return arrD[2]+"/"+arrD[1];
			}
		}
		else
		return "";
	 }
	function callwindow(winhref, winname, options)
	{
		var loc = unescape(location.href);
		var lstr = loc.substring(0,loc.indexOf("/servlet"));
		var tmp = "ggs.erm.servlet.setup4.HomePageS?_redurl=" + lstr + "/servlet/";
		tmp += _rep(winhref);
		if(winname == 0)
			winname = '';
		if(options == 0){
			ht= screen.height-200;
			wd = screen.width-10;
			options = 'left=1,top=1,menubar=yes, resizable=yes, location=yes, toolbar=yes, status=yes, scrollbars=yes,height=' + ht + ',width=' + wd;
		}
		window.open(tmp, winname, options);
	}
	function _rep(str)
	{
		var arr = str.split("&");
		var st = "";
		for(var i=0;i<arr.length;i++)
			st += arr[i] + "~~";
		if(st.length>0)
			st = st.substring(0,st.length-2);
		return st;
	}
		
	function display_msg(idi,typ)
	{
		
		var message = "";
		var row=1; 
		MsgErr.recordset.absoluteposition=row;
		for(var j = 0; j < MsgErr.documentElement.childNodes.length; j++)
		{
			var i = MsgErr.recordset("error_id");
			if(i == idi)
			{
				 message  = MsgErr.recordset("description");
			}
			x=MsgErr.recordset;
			x.movenext();
		}
		return_obj = "";
		show_msg(message,typ,'');
	}
	function display_msg(idi,typ,ret)
	{
	
		var message = "";
		var row=1; 
		var st = "";
		MsgErr.recordset.absoluteposition=row;
		for(var j = 0; j < MsgErr.documentElement.childNodes.length; j++)
		{
			var i = MsgErr.recordset("err");
			if(i==3)
			{st=MsgErr.recordset("desc");st=st+"";
			}
			if(i == idi)
			{
				 message1 = MsgErr.recordset("desc");
				 message1 = message1+"";
				 message = message1.replace("~3~",st);
				 break;
			}
			x=MsgErr.recordset;
			x.movenext();
		}
		return_obj = ret;
		show_msg(message,typ,ret);
	}
	
	
	//z = lbl.recordset;
	
	function display_label(idi)
	{
		var message = "";
		var row = 1; 	
		var z = lbl.recordset;
		z.absoluteposition = row;	
		flag = false;
		for(var j = 0; j < lbl.documentElement.childNodes.length; j++)
		{
			var i = z("label_id");
			if(i == idi)
			{
				 message  = z("description");
				 flag = true;
			}
			if(flag == true) break;
			z.movenext();
		}  
		return message;
	}
	
		function hidel()
		{
			document.all.div1.style.visibility = 'hidden';
			if(return_obj != ""){var obj_r = eval(return_obj);
			if(obj_r == "[object]"){obj_r.focus();}}  
		}
		function show_msg(message,typ,ret)
		{
			//alert("going in here too"+ message); 
			// typ = 0 error message 
			// ret return focus;
			top.scroll(0);
			document.all.div1.style.visibility = 'visible';
			//err_message ='<table width="100%" height="100%" bgcolor="#f7f7f7"><tr bgcolor="#bcbcbc" valign="top"><td height="4" width="94%"><b><font color="#ffffff">ERM</font></b></td><td width="6%" align="center"><img src="../images/close.gif" align="middle" border="0" onclick="hidel()" style="cursor:hand"></td></tr><tr><td  colspan="2" valign="top" class="ErrorMsg"><br>'+message+'</td></tr><tr><td align="center" class="2"><input type="Button" value="OK" onclick="hidel()" id="ok"><script>document.all.ok.focus();<\/script></td></tr></table>';
			//document.all.div1.innerHTML = err_message;
			//alert("er_msg--"+err_message);
			
			document.all.div2.innerHTML = "<br>"+    message;  
			//alert(document.all.div2.innerHTML); 
			
			document.all.div1.focus(); 
			
			document.all.ok.focus();   
		}	
	  
	function chkKey(evt) 
	{
		var mykey;
		if (!(window.Event))
		{
			mykey = evt.keyCode;
			if(mykey == 27)
			{
				if(document.all.div1.style.visibility == 'visible')
				{document.all.div1.style.visibility = 'hidden';}
			}
		}
		return true;
	}
	function openpolicy()
		{
			if((location.href+"").indexOf("ctplerm")>-1)
			{
				window.open("http://www.mysmilescrm.com/policies/index.html");
			}
			else
			{
				openhome();
			}
		}
		  function showDateS1(dateS)
        {
            if(dateS !=null && dateS!="")
			{

				var arrD= dateS.split("-");
				var arrd=arrD[2].split(" ");
				return arrd[0]+"-"+month(arrD[1])+"-"+arrD[0];
			return month(arrD[1])+""+arrd[0]+","+arrD[0];
			
			}
			else
			return "";
        }

	   function showDateS(dateS)
        {
            if(dateS !=null && dateS!="")
			{

				var arrD= dateS.split("-");
				var arrd=arrD[2].split(" ");
				return arrd[0]+"-"+month(arrD[1])+"-"+arrD[0];
			}
			else
			return "";
        }   
   	    function showDateSE(sdate,edate)
	        {
	     //   alert(sdate);
	     //   alert(edate);
            if(sdate !=null && sdate!="" && edate !=null && edate!="" )
			{
			var sarrD= sdate.split("-");
			var sarrd=sarrD[2].split(" ");
        	var smonth='';		
        	var earrD= edate.split("-");
			var earrd=earrD[2].split(" ");
        	var emonth='';		
			return month(sarrD[1])+" "+sarrd[0]+" - "+month(earrD[1])+" "+earrd[0]+" , "+earrD[0]+".";
			}
			else
				return "";
        	}
                
        function month(month)
             {
        if(month.charAt(0)=='0')
			month=month.charAt(1);
			switch(parseInt(month))
			{
				case 1:month='Jan';break   
				case 2:month='Feb';break
				case 3:month='Mar';break
				case 4:month='Apr';break
				case 5:month='May';break
				case 6:month='Jun';break
				case 7:month='Jul';break
				case 8:month='Aug';break
				case 9:month='Sep';break
				case 10:month='Oct';break
				case 11:month='Nov';break
				case 12:month='Dec';break
        	}
        	return month;
        }
        function monthN(month)
        {
        if(month.charAt(0)=='0')
			month=month.charAt(1); 
			switch(parseInt(month))
			{
				case 1:month='January';break   
				case 2:month='February';break
				case 3:month='March';break
				case 4:month='April';break
				case 5:month='May';break
				case 6:month='June';break
				case 7:month='July';break
				case 8:month='August';break
				case 9:month='September';break
				case 10:month='October';break
				case 11:month='November';break
				case 12:month='December';break
        	}   
        	return month;
        }  
		function showDateN(dateS)
        {
            if(dateS !=null && dateS!="")
			{

				var arrD= dateS.split("-");
				var arrd=arrD[2].split(" ");
				return arrd[0]+" "+monthN(arrD[1])+","+arrD[0];
			}  
			else
			return "";
        }   
