function ConfirmRequest() 
{
    if (confirm('Are you sure you want to logout?'))
    {
        return true;
    }
    else
    {
        return false;
    }
}

function textCounter(field, maxlimit ){
  if( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit);
    alert( 'Textarea value can only be 200 characters in length.' );    
    return false;
  }
}


function checkMaxLengthOnKeyPress(foEvent, foTextArea, foMaxlength)
{

    if(foEvent.charCode || window.event)
    {   
        return foTextArea.value.length < foMaxlength;
    }
    else
    {
        return true;
    }
}

function checkMaxLengthOnBlur(foEvent, foTextArea, foMaxlength)
{
    if (foTextArea.value.length > foMaxlength)
    {
        foTextArea.value = foTextArea.value.substring(0, foMaxlength);
    }
}



// Open win

function openWin(url,fiWidth,fiHeight)
{
    var j=window.open(url,"jj","left=20, top=20, width="+fiWidth+",height="+fiHeight+",scrollbars=0") 
}

function openWin5(url)
{
var j=window.open(url,"jj","left=20, top=20, width=700,height=650,scrollbars=0") 
}


 //below function is to validate the type of image uploaded //
function validImageType(source,args)
{
    var lstrerrormsg = "";
    var file = "";
    var type = "";
    if($get('fuGuestImage').value.trim() != "")
    {
        file = $get('fuGuestImage').value.trim();
        type=file.substring(file.length-4,file.length);
        if (type != ".jpg" && type != ".gif" && type != ".JPG" && type != "jpeg" && type != "JPEG" && type != ".GIF" && type != ".png" && type != ".PNG")
            lstrerrormsg += "@Only JPEG,GIF or PNG file.";  
    }    
     if(lstrerrormsg.trim() != "")
     {
        lstrerrormsg = lstrerrormsg.substring(1); 
        source.errormessage = lstrerrormsg.replace(/@/g, '\n');
        args.IsValid = false; 
     }
 }
 
 //testimonial CheckAll
