function JTrim(s)
{
  var i, sRetVal = "";
  i = s.length-1;
  while ( i>=0 && s.charAt(i) == ' ' ) i--;
  s = s.substring( 0, i+1 ); // trim blanks on the right
  i = 0;
  while ( i< s.length && s.charAt(i) == ' ') i++;
  return s.substring( i );
}

function  ValidEmpties(oParentForm, arrObjName, blnAlert)
{
  frmParent = oParentForm;
  intLength = arrObjName.length;
  var i,stValue;
  for (i=0;i<intLength;i++)
  {
    if (frmParent(arrObjName[i])!=null) 
    {
      stValue = JTrim(frmParent(arrObjName[i]).value);
      if (stValue=="")
      {
        if (blnAlert)
        {
          stName  = frmParent(arrObjName[i]).name;
          stName  = stName.replace(/txt/i,"");
          stName  = stName.replace(/cbo/i,"");
          if (typeof(SeparateName)=='function')
            stName  = SeparateName(stName);
          if (frmParent(arrObjName[i]).type=="select-one")
            alert("You must select one "+stName);
          else
            alert("You must input value into "+stName);
          frmParent(arrObjName[i]).focus();
          return false;
        }
        else
        {
//          frmParent(arrObjName[i]).focus();
          return false;
        }
      }
    }
    else
    {
      if (!confirm("\""+arrObjName[i]+"\" is not a control of form "+frmParent.name+"!\nDo you want to continue?"))
        return  false;
    }
  }
  return  true;
}

function _HPEPMouseLeftNav(ListIDStr) 
{
    background = "#2C0E73";
    //background = "#FF0000";
    foreground = "#FFFFFF";
    //foreground = "#270385";
    hiliteBackground = "#ffffff";//ebebeb
    //hiliteBackground = "#270385";
    hiliteForeground = "#2C0E73";
    //hiliteForeground = "#FF0000";
    selectedBackground = "#ffffff";
    //selectedBackground = "#270385"
    selectedForeground = "#2C0E73";
    //selectedForeground = "#FF0000";
	if (event.type == "mouseout")
	{
		ListIDStr.style.backgroundColor = background;
		ListIDStr.style.color = foreground;
	}
	else
	{
		ListIDStr.style.backgroundColor = hiliteBackground;
		ListIDStr.style.color = hiliteForeground;
	}
	
	/*
	if (event.type == "click")
	{
		alert(ListIDStr.style.color);
		ListIDStr.style.backgroundColor = hiliteBackground;
		ListIDStr.style.color = hiliteForeground;
	}
	*/

	
}

function ValidateUIntField(textField, promptMessage)
{
	var value=JTrim(textField.value);	
	if (!(isUInt(value) || (value == "") || (value == null)))
	{
		alert(promptMessage);
		textField.focus();
		return false;
	}
	return true;
}

function isUInt(value){
    if(isNaN(value))
        return false;
    if (parseInt(value)<0)
        return false;
    return true;
}

//a supporting function to check whether the passed value is a valid Non Negative Integer....
function isPositiveInteger(value){
    if(isNaN(value))
        return false;
    if (parseInt(value) <=0)
        return false;
    return true;
}

function SetValueAllCheckbox(FormName, groupid, numRows, Value) {
	for (i=1; i<=numRows; i++) {
		strSetValueCheckbox = FormName+"."+groupid+i+".checked="+Value;
		eval(strSetValueCheckbox);
	}
}

function SetEnableAllTextbox(FormName, groupid, numRows, Value) {
	for (i=1; i<=numRows; i++) {
		strSetEnableTextbox = FormName+"."+groupid+i+".disabled="+Value;
		eval(strSetEnableTextbox);
	}
}
// JavaScript Document
<!-- Begin
loadImage1 = new Image();
loadImage1.src = "images/CompanyL2_0.gif";
staticImage1 = new Image();
staticImage1.src = "images/CompanyL2_0.gif";

loadImage2 = new Image();
loadImage2.src = "images/CompanyL2_0.gif";
staticImage2 = new Image();
staticImage2.src = "images/CompanyL2_0.gif";

loadImage3 = new Image();
loadImage3.src = "images/CompanyL2_0.gif";
staticImage3 = new Image();
staticImage3.src = "images/CompanyL2_0.gif";

loadImage4 = new Image();
loadImage4.src = "images/CompanyL2_0.gif";
staticImage4 = new Image();
staticImage4.src = "images/CompanyL2_0.gif";

loadImage5 = new Image();
loadImage5.src = "images/CompanyL2_0.gif";
staticImage5 = new Image();
staticImage5.src = "images/CompanyL2_0.gif";

// End -->


var menu1=new Array()
menu1[0]='<a href="index.asp?mID=1">Market Research</a>'
menu1[1]='<a href="index.asp?mID=2">Telemarketing</a>'
menu1[3]='<a href="index.asp?mID=3">Tele-Survey</a>'
menu1[4]='<a href="index.asp?mID=1">SMS-Direct Marketing</a>'

var menuwidth='100%' //default menu width
var menubgcolor='#f0f0f0'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="no" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

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


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu