﻿function ValidateDelete (pObject) 
{
   var pMsg = document.getElementById('txtDeleteJS').value;
   if (pObject!=null) 
   {
      if (event.srcElement.tagName.toUpperCase()=='IMG') 
      {return confirm (pMsg);};
   };
};

function ValidateDeleteButton () 
{
   var pMsg = document.getElementById('txtDeleteJS').value;
   return confirm (pMsg);
};

function logOff () 
{
 if (confirm ("Είστε βέβαιοι ότι θέλετε να αποσυνδεθείτε;")) 
 {
    self.document.location.replace("logOff.aspx");
 };
};

function ShowMenuItems (cObject) 
{
	var cObj = null;
	var tID  = new String();
	var tObj = null;
	
	cObj = GetObjectByID (cObject);
	if (cObj!=null) {
		cObj.style.display="block";
	};
};

function HideMenuItems (cObject) 
{
	var cObj = null;
	var tObj = null;
	
	cObj = GetObjectByID (cObject);
	if (cObj!=null) 
	{
		cObj.style.display="none";
	};
};

function GetObjectByID (pID) 
{
   if (document.all) 
   {
      return document.all(pID);	
   }
   else if (document.getElementById) 
   {
      return document.getElementById(pID);	
   }
   else 
   {
     return null;	
   }
};

function ClearField (cElement) 
{
   var cObj = null;
   
   cObj = GetObjectByID (cElement);
   if (cObj!=null) 
   {
       cObj.innerText = "";
   };
};

function GetDate (cElement) 
{
   var strRet  = new String();		    
   var txtDate = null;

   txtDate = GetObjectByID (cElement);
   if (txtDate!=null) 
   {
      strRet = self.showModalDialog ("SYS_DatePicker.htm","","dialogWidth:200px;dialogHeight:230px;help:no;edge:sunken;scroll:no;status:no;");
      strRet = strRet.toString();
      if (strRet!="-1"){txtDate.value = strRet;};
   };
};

function GetMedia (cElement) 
{

};

function SetMedia (cElement) 
{

};

function GetFile (cElement) 
{
	var strReturn = new String();
	var txtFile   = null;
	
	strReturn = window.prompt();
	txtFile   = GetObjectByID (cElement);
	if (txtFile!=null) 
	{
		txtFile.value = strReturn.toString ();	
	};
};

function SetFile (cElement) 
{

};

function ShowEMail (cElement) 
{
   var strEMail = new String();		    
   var txtEMail = null;

   txtEMail = GetObjectByID (cElement);
   if (txtEMail!=null) 
   {
	   strEMail = txtEMail.value.toString();	
	   if (strEMail.length>0) 
	   {
	       window.open ("mailto:" + strEMail);
	   }    
   }
};

function ShowURL (cElement) 
{
   var strURL  = new String();		    
   var txtURL  = null;

   txtURL = GetObjectByID (cElement);
   if (txtURL!=null) 
   {
	   strURL = txtURL.value.toString();	
	   if (strURL.length>0) 
	   {
	       window.open ("http://" + strURL);
	   }    
   }
};

function HighLiteControl (control,className) {
    if (control!=null) {
        if (control.className!=className) {
            control.className=className;
        };    
    };
};

function ResetElement (pObject) 
{
	if (pObject!=null) 
	{
	   if (pObject.style!=null) 
	   {
	       switch (pObject.className) 
	       {
	           case "clsFormButton" :
					pObject.style.color="#000000";
					pObject.style.border.color="#C0C0C0";
					pObject.style.backgroundColor="#D0D0D0";
					break;
	          
	          default:break;
	       }
	   }
	}
};

function HilightElement (pObject) 
{
	if (pObject!=null) 
	{
	   if (pObject.style!=null) 
	   {
	       switch (pObject.className) 
	       {
	           case "clsFormButton" :
					pObject.style.color="#505050";
					pObject.style.borderColor="#808080";
					pObject.style.backgroundColor="#E0E0E0";
					break;
	          
	          default:break;
	       }
	   }
	}
};

function TriggerSearch (pObject) 
{
	if (window.event) 
	{
	   if (pObject.keyCode==13) 
	   {
            pObject.returnValue=false;
            pObject.cancel = true;
            document.getElementById('btnSearch').click();
       };
    }
    else
    {
	   if (pObject.witch==13) 
	   {
            pObject.returnValue=false;
            pObject.cancel = true;
            document.getElementById('btnSearch').click();
       };
    }
};

