﻿function checkMail(mailAddress) 
{
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,4})(\\]?)$";
    if (mailAddress.match(reg1str) == null &&
		    mailAddress.match(reg2str) != null)
    {
	    return true;
    }
    return false;
}

function checkURL(url) 
{
    var urlPattern = /^(?:(?:ftp|https?):\/\/)?(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)+(?:com|edu|biz|org|gov|int|info|mil|net|name|museum|coop|aero|[a-z][a-z])\b(?:\d+)?(?:\/[^;"'<>()\[\]{}\s\x7f-\xff]*(?:[.,?]+[^;"'<>()\[\]{}\s\x7f-\xff]+)*)?/;
    return urlPattern.test(url.toLowerCase());
}


function realPostBack(eventTarget, eventArgument)
{
   __doPostBack(eventTarget, eventArgument);
}

function Grid_DoCallback(action,callBackControl,gridControl,selectionRequired)
{
    if (selectionRequired)
    {
        if (gridControl.MasterTableView.SelectedRows.length > 0)
        {
            callBackControl.AjaxRequest(action);
        }
    }
    else
    {
        callBackControl.AjaxRequest(action);
    }
}

function OpenGridRowForUpdate(gridControl, action)
{
    gridControl.AjaxRequest(action);
}

function AddToFavorite()
{
    try
    {
        window.external.AddFavorite(location.href,'מערכת ניהול האתר')
    }
    catch(ex){}
}

function UpdatePictureClose()
{
    try
    {
        if(document.getElementById("UpdatePictureButton")!=null)
        {
            document.getElementById("UpdatePictureButton").click();
        }              
    }
    catch(ex){}
}
function SetWindowSize()  
{          
    alert(window.dialogHeight)
    window.dialogHeight = 500;
}


function SetWindowSize(oWnd)  
{          
    oWnd.SetSize(oWnd.GetWidth(), parseInt(oWnd.Height));  
}

function CloseWindow()  
{ 
    window.close();
}