﻿function ValidateCountries(sender, args)
{   
    args.IsValid = $(".countries").val() > 0;
}

$(document).ready(function(){
        
        try
        {
            if(edit && auth)
            {
                $('.edititem').show();
                $('div.column').addClass('editgrey');
                $('div.full').addClass('fullbottom');
            }
            else
            {
                $('.edititem').hide();
                $('div.column').removeClass("editgrey");
                $('div.full').removeClass('fullbottom');
            }
        }
        catch(error)
        {
        
        }
    
        $('img#logoButton').click(function(){
            
            try
            {
                var tsTimeStamp= new Date().getTime();
                
                if(edit && auth)
                {
                    $('.edititem').hide();
                    $('div.column').removeClass("editgrey");
                    $('div.full').removeClass('fullbottom');
                    $.get('/action/edit.ashx',{edit:false,time: tsTimeStamp},function(data){;});
                }
                else
                {
                    $('.edititem').show();
                    $('div.column').addClass("editgrey");
                    $('div.full').addClass('fullbottom');
                    $.get('/action/edit.ashx',{edit:true,time: tsTimeStamp},function(data){;});
                }
                
                edit = !edit;
            }
            catch(error)
            {
            
            }
        });
        
        $('#getnewcode').click(function(){
            
            $('img#captchaimage').attr('src','/captcha/image.ashx?cache='+(new Date().getTime()));
        });
        
        $('#forgot').click(function(){
            
            $('table.sendpassword').show();
        });
        
        $('span.toggle').click(function(){
        
            $("tr.toggleclose").attr("style","display:none;");
            $("tr.toggle" + ($(this).attr("id"))).attr("style","");
        });
        
        $('span.mailtoggle').click(function(){
        
            $("tr.toggleclose").attr("style","display:none;");
            $("tr.toggle" + ($(this).attr("id"))).attr("style","");
            $.get('/action/misc/mailread.ashx',{mid: $(this).attr('id'),time: new Date().getTime()},function(data){;});
        });
        
        $('a.viewcomments').click(function(){
        
            $('div.comments').show();
        });
        
        $('.preview').mouseover(function(){
        
            $('.preview').addClass('previewlow');
            $(this).removeClass('previewlow');
            
            if( $(this).attr('ref'))
            {
                $('p#preview_description').html($(this).attr('ref'));
            }
            else
            {
                 $('p#preview_description').html('');
            }
        });
        
}); 

function ValidateCountries(sender, args)
{
    args.IsValid = $(".countries").val() > 0;
}


