﻿function openTerms(pageName,pWidth,pHeight)
{
	eval("window.open('" + pageName + "','NewWindow1','toolbar=no,width=" + pWidth + ",height=" + pHeight + ",directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0,top=0,left=0')");
}
function GetMouseOver(cell, id2, id3)
{
      cell.style.cursor = 'hand';
      cell.style.backgroundColor='#e6e6e6';

      cell2=document.getElementById(id2);
      cell2.style.backgroundColor='#e6e6e6';

      cell3=document.getElementById(id3);
      cell3.style.color='#3D6484';
	  return true;
}

function GetMouseOut(cell, id2, id3)
{
	  cell.style.cursor = 'hand';
      cell.style.backgroundColor='#999999';

      cell2=document.getElementById(id2);
      cell2.style.backgroundColor='#999999';

      cell3=document.getElementById(id3);
      cell3.style.color='#FFFFFF';
	return true;
}

function OnlineValidation(control,validatorID,onValidControlID,imagePath, validationGroup)
{
    isValid=true;
    i=0;
    var ControlValidator;
    while(Page_Validators[i])
    {
        if(Page_Validators[i].controltovalidate==control.id || Page_Validators[i].id==validatorID)
        {
            ControlValidator=Page_Validators[i];
            ValidatorValidate(Page_Validators[i], validationGroup);  
            if(!Page_Validators[i].isvalid)
            {
                isValid=false;
                //break;
            }
        }
        i++;
    }
    
    if(ControlValidator!=null)
    {
		if(onValidControlID=="")
			onValidControlID=control.id+"_V";
        var elementV = document.getElementById(onValidControlID);
        if(elementV==null)
        {
            if(imagePath=="")
            {
				elementV = document.createElement("span");
				elementV.id=onValidControlID;
				elementV.innerText="√";
				elementV.style.color="green";
				elementV.style.fontWeight="bold";
            }
            else
            {
				elementV = document.createElement("img");
				elementV.id=onValidControlID;
				elementV.src= imagePath;
			}
            ControlValidator.parentElement.insertBefore(elementV,ControlValidator);
        }
        if(isValid)
            elementV.style.display="";
        else
        {
            elementV.style.display="none";
        }
        
    }
} 

function GetFirstErrorControl()
{
    i=0;
    
	while(Page_Validators[i])
    {
        if(Page_Validators[i].controltovalidate!=null && !Page_Validators[i].isvalid)
			return Page_Validators[i].controltovalidate;
        
        i++;
    }
}